How to store item info?
I'm working on setting up my character for equipping weapons and armor, as well as his inventory slots. My question is, what is the best way to store all that info regarding each item?
For example: a sword would have Name, Attack, Attack%, Magic, Buy Cost, Sell Amount as its basic data.
So if you consider the large amount of all weapons and armor and items in a game, I can't imagine it would be wise to create large arrays of each item type and try referencing them whenever I need to?
Would it be better to store this info in an xml file, and create objects from the data only when needed? And if so, how do I protect that data in the xml file so players can't access it and make a weapon do a million damage or be worth 10 million gold. Is there a way to encrypt it?
About this post
- Posted
- Archived
- Score
- 1 · 67% up
- Kind
- Text
- ID
- ph5v91
6 comments
If you're making a multi-player game, then your server would handle the creation of those items. There are many ways to create items and info you're talking about, most of it is personal preference and depends on your engine.
You can store that in a database that only the server has access to. To prevent clients from trying to cheat you would just use the server values of the weapon. The server would be the absolute authority.
Not multiplayer.
Then you can't stop that. If people want to cheat, they'll find a way. You can never trust a client's data.
As /u/dj-riff said there is no way to stop player from cheating. But you can just make it harder so not every player with Notepad will be able to do that. And the only option is to avoid saving plain text.
There are some options for that:
And of course you can combine those options. Like encrypting data and inserting it into your executable. Or compressing your data and encrypting it. And so on... But remember that these are just ways to make it harder.
Data segment
[ F.A.Q | Opt Out | Opt Out Of Subreddit | GitHub ] Downvote to remove | v1.5
Ah thank you! This is the info i was looking for!