Monday, February 27, 2012


More work done, mostly in other roguelike things as  I thought it would be good practice. I got old style Rogue like dungeon rooms (based off some reading) and a bit of line of sight work. Not directly related to project but gets me in the mind set.

What I do have is in the image. A huge mess that I call a hydra ,it's made of necks and heads that shouldn't' be there. To keep this somewhat short I'll breeze over the idea of how dungeons will be generated. a hallway is placed down connecting to it, then one or more hallways are connected to it until finished for the length. This allows hallways to have an order which require puzzles, room cleared of enemies, keys to open the door to go onto the next hallway and so forth until the dungeon is finished.

Problem up there is that should be 3 hallways of 4 rooms. There is a lot more than that in some order I barly understand what it's doing. Probably a simple bug, but would take a long time to find. Lunch breaks don't offer all that time and my weekends are sorta dominated. Though I keep cracking.

Saturday, February 18, 2012

updates event handler edition

Do gibs even belong in this game?
Alright more progress. I had events working before, and have had enemy entities moving around and such. But finally got in "attack" code right now. It happens when an entity moves onto another entity and right now only the player entity has it. Automaticaly sets the others HP to -9999 and their color to red, after that I had to get on_death functions working to properly drop gibs (and later real items), remove itself from the room, and add a death message to the event handler. Right now the event handler is really just a glorified list that keeps 5 lines of text in check, but it's effect is much more so I'll take a moment to talk about it.

The philosophy behind the event handler is that it gets passed to every instance that uses it so that they can take care of themselves. So you get hit and the character object that defines you does calculations, sees that it has an event handler and uses the event handlers add function to put another line on there. This is also used for the doors, the item pick ups, everything. It keeps the main loop from having to know what every single entity does under the hood to properly display the text which I find to be quite useful.

Now I'm not sure wha tthe next step shoudl be. I may play with giving the enemy mobs some attack code and properly patching them up so they don't "eat" each other by destroying their fellow moblin/goblin/mogoblin id at locations or walk through "doors" and cause all sorts of trouble.

Wednesday, February 8, 2012

Late night quick post

A little more gets added each day. Most important was actually last week but mock up a proper "scene" just didn't seem to get my programing spirits up as tacking on more stuff. So no ascii in game image.

What we do have now is saving through good old fashioned not really efficient pickling. Took a few days to uncouple TKinter from the data structures and getting methods all to the top most module for remembering functions and it was golden. Size was a little big so I subclassed some dictionaries to act as 2d lists, which I could further optimize by making it just a single dictionary with some more trickery and math in it, but I don't do math well. The save right now is about 16 KB which through zipping can get down to 10 KB, not bad for out of the box saving.

I can improve this through some better class sub classing and getting rid of irrelevant data to be saved (like stats in a wall or objects). Though the real size change would come from me writing my own save output. For now though pickling is the way to go and lets me examine a world to a degree and modify it on the fly without recoding in the middle of it.

So saves and loads done. Next I overhauled the display system getting it more towards useable. I have event text coming out at the bottom that is triggered through various things. Only holds 5 of the past events and no logs at the moment so a bit limited but workable. After that I set up somewhat of an internal scripting system to allow events such as stepping on to give commands to the engine without a whole bunch of function nonsense (as there is enough of that) so stepping on an item can tell the DM to remove it from teh room. Somewhat proper object orientated design as the item never needs to know the room it's in or how to interact with it. Last I got done was the beginning of puzzles. I can get objects to disappear and be placed by stepping on them. So things such as switches are now possible. Next I'll see about getting damage back into the game and smack a few mobli-goblins around in the test dungeon. I've already had them spawned just  to see if they'd persist room transition but had no interaction with them beyond trying to get past them as they move about randomly.