So have been working on my game for a while and I think it’s time to get everything into a nice and clean state. The game aim to be a tactical MmoRpg, square grid base. For the moment its build into 5 main sections.
The client (UDP and TCP)
The connection server (UDP)
The world server (UDP)
The combat server (TCP)
The game editor (NA)
For the moment I simply send strings through sockets. They start with a 3 digit code, that represent the packet type. For example a 000 is a connection packet, and the 010 can be a movement packet. The client sends a string, the server receives the string, check the 3 first character, go into a switch case to see what type it is. It takes the class, use the build packet method and start applying a regex on the string. It then takes the info in the regex as they are supposed to be presented, and usually send a packet to anyone concern but the packet. Same Thing when the client recive a packet.
A pretty simple and stray forward thing, but I felt like it’s missing something. Btw, yes, everything is built around asynchronous packets. At the moment if the client misses a packet it completely ignore it. This is something that will need to be changed, but for now, it doesn’t seem to cause real problems.
The problem comes from my division between the world and combat server. At the time I though it would be clever to be able to use 2 computers for one server, and the 2 packet type (udp and tcp) at their best.
The world part is mostly movement and chat. Those 2 things can easily take a packet lost whit-out been catastrophic.
The combat part is built around turns and single actions. Each action has its own packet. A packet lost would make the player unable to follow the combat correctly. The idea would be to put an id on each action and increment this id for every action, so that if the client does lose a packet he can backtrack every missed action to get to the actual state.
The stupid thing I did was to put the world and combat into 2 different projects and act as if they would never be on the same computer. This is making thing really hard and don’t offer much as the 2 computer need to frequently send each other info, using tcp. I believe now it would be way easier to make each zone a separated server and put both the combat and world into the same computer. But as I do this I could also refactor my packet conception.
So to recap, here are my questions
Does String send into packet whit 3 digit code make sense or can I do
better?
Does my use of TCP and UDP make sense to you?
Should I have my world and combat server merge into one project?
What would spieder monkey do to help me at this point?
Thanks you