• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Rhodesy_25852

Client/Server logic on same machine, singleplayer as a local multiplayer

9 posts in this topic

Hello,

I've been doing a fair bit of research on the best approach for putting networking play into a game im working on, and I've read that many games today are developing their singleplayer gameplay just as a local hosted network game.

Does anyone have experience in this, or have any articles on the best approach for this?

I am conflicted with the idea of how to handle game logic for this, because if your "client" is running predictive logic that the server is master over (client predicts, server validates), then are you not leading to running the same logic checks twice on the same machine?

Is there a better way to look at this? A better way to separate or even merge the logic depending on the type of game you're playing (singleplayer or multiplayer) and keep the simple design of only having to develop one core part of the game that can be shared by both the single and multiplayer aspects?

An example of this would be:
[list]
[*]Client moves, sends input to server.
[*]Client hits a wall, has client logic to handle collisions.
[*]Server handles the input and it too detects the collision, sends result back to client.
[*]Client reads server response and if needed corrects.
[/list]
[i]And with this, there are two of collision handling checks.[/i]


I've love to hear other peoples experience of this sort of idea/problem and how they've gone about it.


Many thanks.
0

Share this post


Link to post
Share on other sites
One approach might be to have the client-server split existing in your single player game as you describe, but disable the whole client prediction side of things.

Essentially, your client never bothers predicting anything (or if it's more convenient, predicts that you don't move at all), and your server effectively sends correction messages each and every frame regardless of what the client says has happened.

Edit: Beaten to it - I just said more or less the same as Ashaman73. Edited by C0lumbo
0

Share this post


Link to post
Share on other sites
[quote name='C0lumbo' timestamp='1355140436' post='5009053']
One approach might be to have the client-server split existing in your single player game as you describe, but disable the whole client prediction side of things.

Essentially, your client never bothers predicting anything (or if it's more convenient, predicts that you don't move at all), and your server effectively sends correction messages each and every frame regardless of what the client says has happened.

Edit: Beaten to it - I just said more or less the same as Ashaman73.
[/quote]

Can potentially add extra latency (one, two frame), you'd have to be careful with that.
1

Share this post


Link to post
Share on other sites
Yeah, I thought about not having the client do any prediction/checking if it was a local running game, and just have the server side do it all... lag will be minimal and not have much (if any) effect on the gameplay.

If it turns out to be the only suggestion that might be the way to go. [img]http://public.gamedev.net//public/style_emoticons/default/cool.png[/img]


With regards to transport, I have already done what Ashaman73 suggested.... I will create a UDP transport, possibly a TCP one too at first (as it's a bit easier that writing a reliable UDP one) and I have a local transport that simply writes and reads from a buffer. Edited by IamRhodesy
0

Share this post


Link to post
Share on other sites
From experience, having a locally-hosted server with [b]full functionality[/b] is much more useful than the negligible overhead of latency compensation mechanisms. It's extremely valuable to have your logic be identical in "single" and "multi" player modes, because that way whenever you play SP you're also testing your MP logic. This is great for code coverage and making sure your systems are robust. It also eliminates a lot of points of failure because all your code is the same path - you don't have special cases.
0

Share this post


Link to post
Share on other sites
[quote name='ApochPiQ' timestamp='1355164739' post='5009142']
From experience, having a locally-hosted server with [b]full functionality[/b] is much more useful than the negligible overhead of latency compensation mechanisms. It's extremely valuable to have your logic be identical in "single" and "multi" player modes, because that way whenever you play SP you're also testing your MP logic. This is great for code coverage and making sure your systems are robust. It also eliminates a lot of points of failure because all your code is the same path - you don't have special cases.
[/quote]

+1000 :) It's always a bit of a long shot trying to persuade your lead / design that it's a good idea to start from a multiplayer framework and work your way down to single player game design, but it is a far more robust way than the other way round. The problem is, multiplayer is more often than not an after-thought, and it does involve some extra care and design steps.
1

Share this post


Link to post
Share on other sites
Thanks all for the input.

Onto my next item (which itself could be a new topic) regards to entity systems:

I have one written out working nicely, now I wondered if anyone else has used these with networked games? My view is to have one running on both client and server, and try to keep them synced.

Anyone else?
0

Share this post


Link to post
Share on other sites
You could call that reflection, and is pretty much what I've seen done, with added synchronisation mechanisms.

There are a few caveats. For example, do your objects require in-order notifications of changes, or can work out of order.

For example, a change in one entity might trigger a given behaviour in another. If this arrives out of order, mayhem can ensue.

Also, does it requires an entity state to be mirrored (meaning any changes in the entity must be reflected together), or you can run updates on atomic elements out-of-order (your elements when changed will be flagged for transmission, and you can transmit the changes in any order and time you want).

This mainly depends on data dependencies, what entities depend on others, and what atomic elements / components depend on others, ect... In general, the less the dependencies, the better.
2

Share this post


Link to post
Share on other sites
It's worth noting that if you use a reliable in-order delivery protocol (i.e. TCP or a layer on top of UDP) it simplifies synchronization dramatically. All you have to do is transmit a stream of timestamped events that modify the game state.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0