I'm thinking to implement a game, but I have some design and technical questions.
Explanation of the game:
There will be a map, divided into little squares. The map will be stored in an array, whose elements are of the type terrain. In this type there will be stored practically all the information that I need (as attributes of the class: type of terrain, how many people are in there, and so on; in general there will also be not primitive objects like inhabitants or warriors, etc).
Until now, no problem but:
The game is turn-based and played locally from different people but with a shared save file.
A player cannot know what happens in all squares, just in few of them. But he is able to add and remove information in arbitrary squares, like move some warriors from cell A to cell B(the other players cannot know about this movement, only if they are in one of those cells).
So everybody needs to save and a load the same map each time: By loading the map, I create again locally the whole data-structure, and I copy in it the information stored in the save file. I do my turn by adding/removing/modifying the info in the map through the UI and in the end I save again the info in the shared file on the internet, so that a second player can do his turn.
The game will use qt as graphical user interface.
Now my questions are:
- Which way is the best to store datatypes: serialization in a binary file or xml parsing? Anyway, I need something very very basic, just save all my objects and load them. Platform independent!!
- My idea is to save the shared data (the map) on the web, and then the application loads from there and saves directly there. In this way, no more than one player at time could play.
- What about the memory, the map will have 1000000 cells, i.e. an array with 1000000 elements of type terrain --> I don't how big it could be..
- I need the game to be cross-platform, is it possible to create a stand-alone executable for Linux, Windows and Mac with Qt?