I’m working on an action RPG game and I’m trying to figure out the best way to handle items (weapons, armor, potions, etc.) and NPCs (townsfolk, monsters, quest mobs, etc.). I’ve looked at a few database things, but I’m lost as to which one to use. The issue is that I’m working on a project for computers (PC and Mac) and consoles and I need a solution that works for both. I would also like a way to enter and deal with items via website instead of entering through Unity. Nothing wrong with Unity, but I’m going to have other people create and enter items into the database and having everyone using Unity just doesn’t seem like a good idea.
What would be the best database to use that flexible, easy to use, and works on both consoles and computers?
Any help or discussion would be greatly appreciated.
Why is XML good? Is there a way to encrypt it so that the data can’t be easily modified? I’ll admit that I don’t have much experience with it and what little experience I do have is from messing around with it using Ogre 3D back in the day.
You never mentioned security, is there a reason you don’t want it to be modified? Is the game single player or multiplayer? Is it competitive? Is it an MMO? All these things matter.
You could encrypt XML, but it’s not like that can’t be broken. The question is why do you want to encrypt it?
I just don’t want game files modified if at all possible. Of course, it’s a PC, so people will probably do it at some point. I just don’t want that process to be easy. It’s not an online RPG or MMO, though. The game is a single player action RPG. Not a loot game like Diablo or Torchlight, but there’s still a decent amount of stuff to get via quests and such.
You should let them cheat themself, if you do it via XML and if it’s done right your game would be moddable to an extent. Mods are the essence of some PC games and it’s what can make or break some games.
There’s no reason to not let players cheat a little if it’s single player, if they’re having fun then that’s all that matters.
I’d like to be able to add things to the game and I just don’t want people “cheating”. It’s an option I can explore later if I wish to go that way. It’s a philosophical thing, but I don’t like cheating personally, and I’d prefer if people played the game the way it was supposed to be played.
I considered that. The issue I have is whether or not this will work on consoles as well. None of the packages I saw on the Asset Store mentioned anything about this. I don’t want to pay money for something that ultimately won’t work.
Well, XML in the simplest form is just a text file. Encrypt the text file and decrypt it at run time. But if you want to go the way of securing your single player game, you’re going to need to do a lot of prevention from things like memory editing etc so people can’t give themselves 5 billion humans(oo…I just got a game idea, ergh…another one to add to the pile of thousands of sim game ideas) or whatever currency you use. There is no way to completely secure your game completely(except for a few things that aren’t viable), this would not be so much of an issue on a console though.
That should work :). If it doesn’t, I’m sure he’d be willing to offer you a refund as it clearly states it works on all platforms. You can ask him.
Yeah. Nothing will stop the hardcore from haxin’ their way to victory. However, I want to make it hard enough for the average Joe to avoid it. Again, it’s just a philosophical thing.
I’ll have to look into it. MySQL was my first choice, but after looking over some assets I was worried about the console side. I guess I can check with the guy to see what he has going on.
I wouldn’t use Mysql, unless you’re keen on shipping it with your game, dealing with install issues, and paying license fees for using it commercially. XML is fine. But the simplest thing is just to keep your data in a serializable class, and then serialize and deserialize it. Binary format will mean it’s harder to view/edit/cheat.
I used XML for practically everything from entities to quests. It took me an hour at max to write a script that would take a giant xml file (a very large amount of quests, npcs, entities, dialogue) from Articy Draft, which would then be used in combination with reflection to create the entities(without any extra programming even for new entity types, the variable names and types just had to match up along with the entity type) and put them in an organized array with their ID or I could have just loaded up individual entities at runtime(but as my game was quite large, had a lot of entities and that was on the server I loaded up all the “non-unique” entities at the worlds loading phase). I also made a “blacklist”, instead of a white list for what variables I would prefer not to be modifiable by the XML, although I never used it. I could have also encrypted the whole file, decrypted it at the loading screen but while it might be slow to do it that way it’s what loading screens are for :).
For entities generated at runtime(I had one million at minimum) I used NoSQL, storing them in a somewhat efficient way with proper indexing so I could grab them. I would have used XML for these, but as there was a huge amount I felt the “runtime costs” of loading them up with the costs of getting the correct .xml file from my hard drive would have been both time consuming and bad for my hard drive(I did have this at one point though, it ran in a separate thread, but this was before I realized I needed a solution that scales well).
It really does depend on what your game is, knowing it’s a RPG and single player isn’t enough. I still suggest XML either way though.
In fact, now that I think about it, I highly recommend you take a look into articy draft. It’s perfect for teams(has team collab), has a free student version that’s a 30 day trial etc. They also have a plugin for .NET etc but it’s .NET 4.0+ and sadly unity does not support that to my knowledge.
Is there a particular reason you don’t want to use XML?
Well, when I was messing around with it with Ogre3D, I told myself I wouldn’t screw with it again after that. No offense to anyone, but just isn’t something I want to mess around with. Even if that weren’t the case, I don’t want the data open for everyone to read. Won’t be a problem on consoles, but any PC guy will be able to get to the data and I don’t want that stuff messed with…if possible.
I’d like a different solution. I guess there aren’t any standards for how people deal with databases. Looks like back to the drawing board.
Sorry you had such an unfortunate experience with XML, I have nothing but song and praise(except for that day I had to first wrap my head around it heh).
Understandable(hope you can deal with me repeating myself(which I’ll stop doing after this post hehe)
It’s just text, you can encrypt it just like you’d encrypt a save file. There’s nothing special about it. It doesn’t require the file to be read “as is”, it can be read from a string if need be.
If you secure the .xml files itself, then the persons next plan might be to target memory etc, if you have a method of doing this that makes it harder than modifying code so you can isolate where it decrypts an xml file and then outputs it to a file you can modify, then encrypt it again so your program can use it, let me know. I do have lots of half-decent methods of preventing people from screwing around with variables with cheat engine, even those with lots of experience but it still would be less work than the former method.
The standard is XML IMO. Console games use it (PS3 Xbox 360) and the future generation will too, so do games like sky rim etc. Your only other option is to use something like NoSQL, json, inseranothermethodhere or just roll out your own format.
Either way, not disagreeing with you here, just letting you know what I know, maybe someone more experienced than I knows of a better way to do it… I’ll end here, since I’m just repeating myself and you’re trying to get a different answer and I can’t give it, I’ll let someone else chime in now that might have a different opinion on how to do things :).
I personally think there’s plenty of room for improvement in these areas and so far there hasn’t been anything revolutionary that’s come out, maybe I’m out of touch though. I definitely would like to see something better than XML so I can understand why you wouldn’t want to use it somewhat and I’m curious to see what other people think is a good solution because this has been a topic I’ve spent some time on in the past.
The advantage of serialized classes is that the loading/saving of complex types is handled for you. You can create a main class to hold all of your data and simply serialize/deserialize it. If you have gigabytes of data that all has to be accessed randomly, then this is not a valid solution, as all your data is held in memory. However, for the vast majority of games this is not the case. You can use dictionaries to use standard key/value searches in place of selects, etc.
You can certainly use the XMLSerializer to read/write XML of your classes, but it’s a little more limited than the binary serializer. However, using XML does give you the ability to hand edit the files.