Make the game before or durring the multi-player code ?

I am just not sure which direction to go with this. I am not sure if I should write the multiplayer code… to connect client / server first… using simple text… and then build it up… and try to make the game based off that foundation. OR should I make the game… as if its a single player, and then add multi-player once all the game is fleshed out ?

If you already have a solid understanding of networking and have made working games with it then I would suggest making the game itself first. If you have no experience in networking/have never made a game example then just write a test program; you don’t want to try to implement multiplayer for the first time in a full-fledged game.

Usually I started with the the network communication layer. Most games work well with a datagram-like API for the networking, so unless you know that your game needs srtreaming, make an datagram (message packet) transport API first and test it thoroughly.

Then make the game on top of that.

if you are about to implement game logic which needs to be (somewaht) secure to hackers, make sure it will only happen server side. Clients are much easier to hack into than your server logic.

Get something playable first. Always. That means single player without networking. Then once you have game play etc worked out, if it even works, adding networking its not that hard. Or more importantly, no harder than starting with networking. Only that when you start with networking you spends hour, days and weeks to get networking going and you still don’t have a game at all.

I find it’s easier to debug and test modules if they are developed independently. But game-first can works as well, if you keep a reasonable separation of logic, data and view. If you entangle these too much you don’t find a good place later where to put the networking layer in.

That’s why I advice to develop the networking first. If you have it already, you will design the game so that networking is actually possible with the design. It’s be a pity if you have a game, designed for multiplayer, but with code that can’t be network-enabled without big rewrites.

Make a game with a common control system for either single player keyboard/mouse input or network communication. Then develop either control module in whatever way you please.

Definitely not - as that would result in a complete rewrite. You don’t just add multiplayer functionality to a game. It is a completely different beast.

I have never done any network programming before, do you guys have any good ideas of where to learn some game networking concepts?

Well, I would make the game first. Then I would completely work on a separate networking base. then slowly integrate it into the game, and slowly add what you need, then optimize. I like to work separately so I can ensure it will be as efficient as possible and things are taken step-by-step.

Get your game working first, but design it so you can easily add multiplayer.

what I’m doing for Captain Failure is:

If you’re playing locally, the client creates the server, keeps a reference to it, and calls a method to give the server input state. The client also has a Vector declared thet is set to reference the server’s entity container for drawing.

If you’re on a network, the client connects to the server, and sends input over the network. the networking code on the server calls the aforementioned input method. The client’s entities array is updated over the network by spawn messages, position messages, etc.


class client
{
vector entities;
server serv;

init()
{
// initialize opengl, etc.
if(singleplayer)
{

serv=new server();
entities=serv.entities;
}
else
{//open network connection
entities = new Vector();

}
}

loop()
{
// get input

// for each in entities draw()

if(singleplayer)
{
serv.giveinput(input state);
}
else
{
//send input over network
// update entities from network
}

}

class server
{
Vector entities;

init()
{
if(!local)
{
// open network
}
}

loop()
{

if(!local)
{//get input over network
//giveinput(input state)
// update entities
// send entity state over network
}
}

I think designing the game to be multiplayer from the beginning is the better way. It doesn’t really complicate design too much and may even force you to adopt a clean structure for your code.

As suggest deepthought, just be sure to have two buffers with inputs and renderingState yoy manipulate by direct reference, and integrate networks transfert betweens clients and servers buffers later.