demo .005 -
http://www.mediafire.com/download.php?4f3w2kawudss6bs- Implemented force application system for manipulating game objects
- Fixed display bugs with reloaded ammunition and thrown grenades
- Added item throwing and a quiver action to prepare items for throwing
- Added fuse/alarm system for triggered object actions throughout the game
- Reworked grenades and tied them to throwing, force and fuse systems
- Added general systems for filtering/sorting menu items
- (q)uaffing action added for drinkables
- Made certain player-only actions accessible to other entities
- Added external .txt config file
- Exported variables to bodyparts.py, constants.py and options.txt
- Changes to map, character and monster generation scripts
- Upgraded combat calculations
Fixed some things, added some other things. I did start splitting the project up a bit, and throwing, grenades, force and fuses are all working as hoped for the moment. Anything near an exploding frag grenade gets blown a fair distance in a random direction.
It's crude, but it's drawn up by a measure of distance, force and object mass, and the throw/force functions are tied to one another - basically, enough force with make an object 'throw itself' and handle collisions as a projectile. Didn't get to the locker yet, but I think next should be a simple door before reworking the construction and generation stuff, unless there's something specific anyone would suggest first.
Suddenly realized this was python so I could check the source code to help you out more, so I did that...
I'm not sure what to think. The mess is HORRIFYING in some places, and I'm not sure if it's salvageable. It's a feat of amazing heroism you've gotten so much done, but I worry you might have to scrap the majority of the code and start over almost from scratch. The tutorials made a lot of things in ways that just don't work for this type of project, and that seem to be the whole source of the problems, YOU didn't know anything wrong. You realy hd some bad luck in stubling over that thing.
Checking over the tutorials, there doesn't seem to be any of them that dosnt introduce something that, at least for this project, counts as a critical flaw. This is just my opinion thou, this is your project. Skimming your code, here is my advised coarse of action, based on what I know of what is usualy cosidered good coding practices:
Put some of the global variables in all-caps at the start into a class of some kind.
Throw out the tile and object classes, and redo them from scratch this time based of Parts from the very beginning. Maybe make an "Assembly" class, and use inheritance on it adding ONLY position (self.x and self.y, ONLY) to "LoseObject"s and ONLY blocked and block_sight to "Tile"s. All the other properties of the curent "object" class that are kept would be in the new Assembly class to be inherited by both. You could easily have a function to convert lose objects to tiles and vice versa as well, which might come in handy for a lot of things.
You're probably best of losing a LOT of the current creature functionality for the moment; health, stats, inventroy, pretty much everything combat related, even mass, gender, and age. Whats left is prety much the names and display tile, which are probably easier to re-code than try to salvage.
The AI code is a loss as well, and the movement code will nneed to be rewanped to work with the legs part being sent a direction wich they are to try to move and so on rather than the AI being alowed to change the position directly. Also, whoever made that tutorial was an ass to make you just through all those hoops with vectors when four if statements comparing X and Y coordinates and adding or subtracting 1 would do.
the bp_in front of Part properties confirmed redundant, you do have it in the names of all Part instances asready.
Item and Projectile classes need to be removed, they should just be LoseObjects
Prety much everything in the Entity class needs to go as well according to me, but that's more of a subjective taste. The whole thing with stats, levels, and XP is more an RPG thing than a survival horror thing. It, not the Lose Object, should also have any AI like functions such as moving or interacting, then once the parts system is implemented you can stop reading them as things done with telekinesis and instead reading them as intention for the responsible body part to respond to. The curent Attack function is sort of like this.
The Skill class is on of the few cases where *you* seem to have actually done something wrong. It' should probably just be a pert of Entity, with skills in a map so that custom and highly specific skills like "dealing with [specific person]" can be easily added just like any common one. Class systm I'd scrap, but if you want to keep it just have it give the skills directly from whaere the manue is rather than via this weird function.
Basic and Confused Monster obviusly need to be done away with.
The whole system of levels and their generation does not quite fit with a modern building style, as well as not being as scary as fearing to attract the entire 3d buildings worth of creepies, and theres no reason to not load the entire world at once on any remotely mmodern system wich will make it seem more alive (in fact, simulte it for a week of in game time before the game starts so stuff can happen!).
Modifying your level generation algorithm you be moree indors-y should be trivial; just chaneg the room making function to line the inside of each room with new walls rather than just flooring all the way to the edges, remove the check for colisions with previus rooms just leting them colide, and increase MAX_ROOMS to somehting like 300 or 1000 instead of 30.
The path map stuff is supringly well done, thats a keepers.
you should probably have some kind of master list of standard objects, parts, and tiles somewhere, wich some kind of hirarchy that lets you easily change lots of things at once towards higher complexity.
@bazilions of functions more: I'm stoping here for my sanitys sake.
My consonances.
... this is a lot of stuff and I'm starting to be involved a lot with it, do you have skype so we can chat about it and maybe I can help you out more directly?
Looking through the code, I'd have to agree with Armok.
Generally a base class ought only to define properties that WILL be used, not that MIGHT be used. It is up to child classes to implement their own specific functionality (eg, not all Objects will have a gender).
Also don't be afraid to split the project into multiple files, so you'd have all your map stuff in one file, all the creature stuff in another etc.
Code refactoring is an inevitable thing, something that should be happening in an almost continuous cycle so that the code remains as good as you can make it.
I figured it being a godawful mess, and I'm sure the inexperience shows. I'm not afraid of re-working everything, since it seemed necessary as a matter of course, though I wouldn't doubt it's grown to a bit more horrifying a mess since this update ^_^ But yeah, going into this I anticipated that it would have to be entirely reworked, probably more than once. Stats, XP, levels are all but gone now. ATM, Skills are incremented by practice alone, and they should raise slowly enough to warrant adopting different playstyles according to one's skillset (difference in physical combat effectiveness between a martial artist and most other classes is substantial).
A move to child classes (and changing all the current ones) seemed pretty necessary after learning what they were, and I agree on just about all the points made, though I'm not sure I get the level gen wall lining bit (although I did add a cheap wall-drawing function and allow room intersections before I saw the post, so it seems we're thinking on similar lines). I'm very tired though, comprehension is duller than usual.
I don't understand why the Projectile / Item classes need to go, since they seem pretty useful in controlling specific behaviors - couldn't they be well-suited as a child of the 'object' class? (which ended up renamed to 'WorldObject'). Skill class does seem like a dud even to my newbie eyes, it's been a pain to work with (though I was pleased to get it sorted by skill level in the menu). I do like character classes though, and the SCP world is ready with ranked positions and occupational titles, but the flaws and merits therin are worth discussing.
Thank you both for checking it out and all the advice, I appreciate it. I don't have Skype, but I can PM my email if that works. I have some further ideas/questions but I need some sleep before I can finish forming them. If you happen to look at the updated code, I'd like to know about anything else I've done wrong - seems good to learn what not to do. I'll try and split the code further too, though I've really just begun to learn to do that (really, all this) properly.
I do find this comforting though:
Code refactoring is an inevitable thing, something that should be happening in an almost continuous cycle so that the code remains as good as you can make it.
I've tried to keep a similar mindset, so it's a happy thing to see it posted by someone more knowledgeable than I.
The demo link throws up an invalid or deleted file error. Might wanna fix that.
Thanks, I'd forgotten to update it in the OP.