2
« on: June 17, 2012, 02:23:32 PM »
Hey guys, I'm excited to have stumbled upon these forums! I decided a couple months ago to take up a programming language (windows assembly) and to keep things interesting I started working on a rogue variant from the very beginning to help me learn. I have a couple questions though:
How do you keep track of everything in the game, do you keep everything in seperate tables? For instance my tables looks like this right now:
2 columns, each field DWORD in size:
Main table:
# mobs, pStruct (pointer to a table of existing structures)
X|Y, pChar (pointer to a char sheet of X,Y)
X|Y, pChar (pointer to a char sheet of X,Y)
X|Y, pChar (pointer to a char sheet of X,Y)
...
...
etc.
pStruct:
# structures, Reserved
RoomX|RoomY,RoomW|RoomH (each are WORD size)
Wall_X|Wall_Y,pChar pointer (pointer to char sheet of wall)
Wall_X|Wall_Y,pChar pointer (pointer to char sheet of wall)
Wall_X|Wall_Y,pChar pointer (pointer to char sheet of wall)
...
etc.
pChar: 1 column, DWORD in size
pointer to name/race id
symbol
color
MobID - unique id# for this mob (word size each: # area it belongs to|# obtained from a loop counter)
STR|INT|DEX|CON (1 byte each)
HP|CURRHP (word size each)
status code - 0:dead, 1:normal, 2:in_combat, 3:fatality
weapon/armor/item codes
pointer to personal memory->
DWORD == # steps to an encounter/item/etc
DWORD == pointer to char sheet of encounter/item/etc.
(if pChar was for an item/structure instead of a mob, fields other than nameptr, symbol and color would have different meanings)
Is this a good approach to have every mob and item in the game to have their own personal record/character sheet? Should I be concerned how much memory I'll be taking up?
Also after a lot of head banging and hair pulling I finally have my collision detection an pursuit code up and running somewhat, just wondering though are there standard algorithms for such things?
Also is there a standard database of monsters/items for roguelikes I could use as well?
Thanks for any info!