• 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.

Archived

This topic is now archived and is closed to further replies.

Zenroth

network game loop

10 posts in this topic

Typically in a 8 player environment you generally do not want to have everyone have to synchronize -- except in the case of RTS. If you DO synchronize, have it done on time not frames and have the clients simulate eachother between syncs.
0

Share this post


Link to post
Share on other sites

I may be a little slow, but what is the difference between
time-based and frame-based? They both use time?

0

Share this post


Link to post
Share on other sites
Time-based is not fixed to any given frame rate. That way you don't have to cap everyone's frame rate.

- Splat

0

Share this post


Link to post
Share on other sites
Ahh so like i was saying lock their logic loops(keys,communication,ect),but leave there fps open. And use dead reckoning.

So if that is correct what is generaly the best way to lock there logic loops but keep the fps open.

0

Share this post


Link to post
Share on other sites
If you are doing a completely deterministic game, like StarCraft, where every computer has to show exactly the same thing you will have to sync your logic loops. I do believe that some action games, like Quake 3, are not perfectly deterministic though. In other words, if the local machine doesn't know the answer it guesses. I would be VERY interested to know the details of the algorithm that is used by games like that. It's my understanding that not even time is syncronized exactly except on the server. Hence, the client game loop must be able to adjust it's game clock based on data recieved remotely. Anyone have any ideas?
0

Share this post


Link to post
Share on other sites
Well what im working on is more like quake than starcraft,but its peer to peer, not 3d and really shouldnt have that much info it would need to pass back and forth. Basicly just x,y the dir and when an event happens like if the ship(im not using ships but it works) fires,is hit,dies,ect. I fiqure collision detection well be off of the viewers screen. Thue im not sure bout that.

I suppose for reciving i would use another thread in the backround. And im planning on using directplay.

0

Share this post


Link to post
Share on other sites
Well, I have been known to be wrong, but listen to my suggestion for a minute:

I think locking any loop is not the best of ideas. Why does the logic loop need to be locked at 40fps? Why not, if your frame rate is capable of 60, of updating the objects in your game at 60 frames per second.
Ideally, you want to pretend that you are playing single player (with a few noticeable changes). Just have a normal, unlocked game loop, ie:

Check input, update status of objects, display, repeat.

Now, you're network code is NOT going to always have new data, so you will have to use dead reckoning or statistical prediction. The idea is, while you are not receiving data from the other people, pick the least obtrusive, highest probability action and continue it.

Now, whenever you get data from the other connection, it will obviously have slightly lagged ACCURATE data. It will also have a timestamp that can tell you WHEN that accurate data was really accurate. You then take that data, run statistical prediction from its time to the current time, and update the position of that object.

Overall, that method should give you excellent results in the display of remote objects, keep them accurate, and all without using a constant logic code (which begins to fail if, for example, the machine runs a background process that sucks up CPU.) With this method, you replace a tick/logic frame delta timestamp in network messages with a real time timestamp:

This works very well because, if you wanted to, you could store the timestamp as absolute time since the game was started. A 4-byte timestamp gets you 1/10th of a millisecond resolution for a timeperiod of about 5 days long.

Realistically, you would restart the timestamp every 5 minutes (since a client that hasn't gotten data in 5 minutes is in deeper trouble anyway). Therefore, a 19-bit timestamp at millisecond resolution works in this scenario.

- Splat

[This message has been edited by Splat (edited October 23, 1999).]

0

Share this post


Link to post
Share on other sites
I could see that working. Just wish i could find some examples on doing something like that. Closest i can thing of sadly is duel(uses dead reckoning and some prediction i belive)
0

Share this post


Link to post
Share on other sites
I do pretty much that - and it works OK! Only, the prediction is nothing fancy (or even intelligent ). It's simple physics:

When I receive a package saying Object A is at location P, moving with velocity V, and the package containing this info is T ms old, the predicted position of A will be P+V*T...

/Niels

0

Share this post


Link to post
Share on other sites
What is the best way to generaly structure the game loop for a peer to peer type action game with up to about 8 players. it well be realtime to. I mean is it best to have the logic loop run on all machines at a constant 40fps per second no matter what and the graphics run as fast as they can(faster machine get smoother graphics,slower get choppy ect,but all the input ect isnt effected by this.)

Or do i need to cap framerates and such?

0

Share this post


Link to post
Share on other sites
Exactly. Dead reckoning works perfectly fine for a whole hell of a lot of situations. You also might add a LITTLE physics code, because the following would be really funny:

Guy is heading towards edge of cliff. You now stop receiving packets from the server. Now, if you JUST use dead reckoning, this guy keeps running and running on thin air hehe If you also do calculations for gravity, then he falls to his doom just like you'd expect.

Zenroth: I imagine finding good source code to a network/prediction part of a game would be REAL hard to come by. This is the kind of thing that is generally too complex and specific to a given game to be real helpful.

- Splat

0

Share this post


Link to post
Share on other sites