I worked a bit with KryoNet and created a simple Android chat client/server where the server just forwards messages to the connected clients. It was incredibly easy to setup and now I want to create a turn based combat game with some RPG elements for android. You have several professional games like this around. They all heavily rely on the server to do the logic and retrieving player information like inventory, characters etc., for good reasons of course. But I'm still wondering about some things and a couple of practical examples would be great.
- What would be a good way to store things on the server side? If we have a look at my Heroes they can be customized so there will be many of the same types of heroes but they will mostly. Same goes for items, attributes on items get rolled randomly. So all this needs to be stored individually.
- A database on the server side sounds good. I can add all items to a player inventory and link them when a Hero equips them.
- I expect the database will grow very quickly even if my game just has a couple of hundred active players. And I am not certain how well a Raspberry Pi will handle a ton of queries.
- I have some experience with MySQL and MSSQL and know how to build prepared statments against injection. How different would this be security wise? Can a published APK be unpacked and show all my queries? And where to store the DB credentials. If I'm going to do this I pretty much want this to be water tight and worse case scenario have frequent backups.
- Raw files like XML files would be pretty good too I think.
- I have to write and read files every time the player changes or requests information. But these files will generally be very short and I know the exact location of them. This means no multiple complicated DB queries.
- Security wise I have no clue how good this is, or should I say how bad this is? A database can obviously be protected very well, files are just files, whenever someone gets access to the server I will be screwed I guess.
- A database on the server side sounds good. I can add all items to a player inventory and link them when a Hero equips them.
- Regarding combat and other player interactions, should I do all the calculations on the server side? Or can I let the client handle most things? How do (semi) professional games handle this?
- Should I sent something like "playerX wants to attack heroA from playerY with heroB". And do all calculations at the server.
- A lot of data need to travel through the server this way.
- Very secure I guess in terms of cheating. But is this really nececary?
- I could resolve combat on the client side and just send the damage and a heroID or other small data over.
- Small packets relieving stress on the server.
- Prone to cheating? How big is the chance that someone sends packages to my server and accepts that package? For KryoNet they have to be sending the same package class and I can add additional protection for this.
- Should I sent something like "playerX wants to attack heroA from playerY with heroB". And do all calculations at the server.
- I initially want to run my server on my own network on a Raspberry Pi. After publishing, would this be a bad idea for any reason and should I pay for a host?