Hello all,
I am trying to write a simple real-time game that will can be played on a single computer, or with multiple computers over a LAN network. Because it could get messy very fast, I want to make sure that I have a good foundation before working on the details. Ideally, I would like to separate the logic and graphics, but I am having trouble figuring out how to do that.
Let me describe what I came up with: when the game is started, a UI is opened for the user to decide whether to start a local game, join a remote game, or start a dedicated server (and mess with settings etc.). Everything will be displayed on a single GamePanel (a JPanel inside a JFrame) which will use active rendering for everything. Different screens (main menu, running game, etc.) will be handled by using different GameState objects, which will handle their own rendering on the GamePanel.
When a game is started, a server will manage the game, and clients (which represent players) will connect. The clients may or may not have GUIs, depending on if they are AI or human. The server will handle the logic of the game, and send out each update to every client (perhaps 20-30 ticks per second). The clients will manage the UI (if present), listen for input, and send commands to the server.
My problem is that I do not know how all of these components will interact with each other. And this leads me to ask: Am I on the right track, or is there a better way of doing things? I have searched the forum, and own KGPJ, but still am confused about how to organize a game. Please, let me know what I am doing wrong, and show me how it can be done better.
Thanks 