Game Development Community

CRPG's and spell/items lists

by Bradley Crawford · in Technical Issues · 03/22/2001 (2:25 pm) · 1 replies

Just starting work on the base algorithm coding of my new project until V12 is released and looking for confirmation I'm heading in the right direction.

I'm working on a CRPG, possibly multiplayer and I'm wondering weather to store the spell and item details in structs or 2-way linked lists.

I'm thinking that structs are the way to go and then just have a pointer to the struct for each spell the player or mob has memorized or a pointer to each item the player, mob, merchant has on them and I'm thinking that using either structs or linked list will use up the same amount of memory for storage while a struct-based system will be less CPU intensive since it won't have to be traversed each time but just after some other opinions.

The only other thing I can see to do would be to have the merchant list as an sql query that's executed then the player goes to buy/sell and then use the results to populate their stock which will allow for more realistic merchants (ie they may be out of stock of something next time the player visits, while having new stock in) but I can't see that working for players/mobs as well and would like to have an all-in-one solution if possible unless the benefits of having multiple solutions based on the entity outweight the costs of coding entity-specific routines.

Thanks to all in advance.

#1
03/22/2001 (2:43 pm)
If you mean the master list...I'd say HashTable, for two reasons. One, I like hashtables. Two it's something you will be accessing all the time, and it won't change, so this will provide O(1) search time, and you can even do a perfect hash.