Jump to content

  • Log In with Google      Sign In   
  • Create Account


Singleplayer / Multiplayer Approach


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 James Leighe   Members   -  Reputation: 222

Like
0Likes
Like

Posted 17 September 2011 - 10:09 PM

So, the game will have a singleplayer and a multiplayer.

I was thinking of making a client and a server and even in singleplayer you host a server and connect with your client to simplify the codebase.
The problem is that so many things are allot less efficient with this model and like twice the memory is used for some things...

I could make a special singleplayer 'client' that integrates the server and client but that seems like allot of maintenance work when something changes.

How would you guys do it?

Thanks!

Sponsor:

#2 6510   Members   -  Reputation: 151

Like
1Likes
Like

Posted 18 September 2011 - 12:41 AM

In singleplayer mode I only exchange the network components by using a direct in-memory approach instead of TCP or UDP.
The game's core with its client and server components stays the same.

#3 James Leighe   Members   -  Reputation: 222

Like
0Likes
Like

Posted 18 September 2011 - 02:11 AM

The only issue (that may be somewhat unavoidable) is that I have to store two instances of the same information (position of objects for example).

This can get bad if for example I was using dynamic terrain and had to store terrain data twice.

#4 In.Vain   Members   -  Reputation: 108

Like
3Likes
Like

Posted 18 September 2011 - 07:57 AM

These are your options:
1. Do nothing and ask your potential customers to upgrade their RAM.
2. Reduce the memory requirements of your software until you are happy with storing all necessary data as often as it is necessary.
3. Create a third mode of execution that calls the server- and client-subfunctions on one single set of data.

Regarding the third option:
The main server function does these things:
a) Receive user input from clients.
b) Apply game rules to the game state.
c) Broadcast changes of the game state to clients.

The main client function does these things:
a) Receive updates of the game state from the server.
b) Collect user input.
c) Send user input to the server.
d) Apply (local) game rules to the (local) game state.
e) Render the local game state.

(There are a few other things, but let's truncate that.)

The ServerClientMix-Thing is supposed to do the following:
a) Collect user input.
b) Apply game rules to the game state.
c) Render the game state.

If you reordered your main server- and client functions so that the three main sub-functions of the ServerClientMix-Thing were member functions of neither the client nor the server it'd be easy to create the ServerClientMix-Thing as a seperate entity.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS