How should I design a system for an action game (think in Golden Axe) where events can happen remotely?
I’m using TCP for this because the client is in flash.
There’s so many options, I can make a binary protocol (I don’t like this idea, I found it to be too hard to mantain) but I was also thinking that passing jsons through clients and server can be slow (Is that a exaggerated concern?).
What about the internal architecture for the server? And for the client? I’m really lost, If it’s a question that is too big, please indicate me some material so I can formulate a better question next time.
The question is a bit widespread – so I am mostly giving you pointers to think about which can be refined to be more specific.
This essentially applies to design of Application layer protocol (sometimes including session layer). Application layer protocol has following elements
A. definitions of messages:
How many messages do you need? HTTP has GET, PUT, POST as used mostly. What are the essential unique communications client-server needs to do? Which message followed by which other makes sense – and which ones don’t?
B. design of structure and encoding of messages:
When sockets receive arbitrary length of bytes – the primary tasks is to find where does the new message start and when it ends? How are bytes represented – ASCII, binary, B64, ASN.1?
C. Is this stateful or stateless?
If there is a state to be maintained by the server during the execution of the message/command or across multiple requests – then that state machine must be consistent and robust; all events orders must be addressable by this state machine to ensure that the protocol doesn’t go in the deadlock.
D. Is there a session, authentication or some identifier?
Identification of who’s talking to whom, whether one is authorized and or authentication is valid (during session) and maintaining such sessions becomes key to ensure right entities get right information.
Any application layer protocol design really has the questions to be answered. These are things I had learned when I was exploring BEEP. I leave upto you if that is of some good use to you or not. However, but there is a great deal of learning from it; and you are right on the context of it.
See:
1. An Overview of BEEP – The Internet Protocol Journal – Volume 5, Number 2
2. BEEP, understanding why it was created, Marshall T. Rose
3. Building port oriented applications and BEEP