• Advertisement
Sign in to follow this  

items in an rpg?

This topic is 4496 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i'm making a simple orpg, and it will contain thousands of items. i'm thinking of how i want to save the items in the server. i thought the smartest and fastest way would be to save them all in an array. when i want to work with an item i could just use the index of the item and use the item that is already in memory in the array. one of the things i'm wondering is if there would be any need to save the index in the item class. it doesn't seem like i would ever need it, but maybe there would be a reason for it. i've also thought about saving all items as a binary file and then reading them when i need them. but since the server will be needing them a lot it will probably be stupid to do that imho. any help would be apreciated. thank you for your time.

Share this post


Link to post
Share on other sites
Advertisement
during school I made a rather simple Earth2025 style game, to store item data I had alot of luck using a Database, which ever style would be up to you of course. I found this worked well, I set up a routine that would maintain a dataset of the items, this allowed me to keep a hard copy so to speak on the server and incase of any inconsistancies with the dataset you could reload it off the database. I planed on having the surver run in the background of which ever comp it was on so I had it watch the dataset and if parts were not used recently then I would shrink the dataset down removing those elements, just loading them up once they were used again. i.e. the advanced tech stuff wasnt in mem if it wasnt used yet.

You could also store the items in a vector and use a pointer system for access or even the indexing you mentioned. Also your idea for the binary file might not be to bad, have them stored there while the server is shut down for what ever reason that way you can reload incase the server needed shuting down for any reason

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement