Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Network turn-based game question


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
4 replies to this topic

#1 goodeddie   Members   -  Reputation: 109

Like
0Likes
Like

Posted 28 March 2013 - 05:44 AM

When should I broadcast my own action?

 

Do I broadcast on state change? Like if I start moving, I broadcast it. But do I also have to broadcast when I stop moving?

 

Or do I just broadcast on a valid input like when I press a button and it's valid?



Sponsor:

#2 Kylotan   Moderators   -  Reputation: 3338

Like
3Likes
Like

Posted 28 March 2013 - 06:28 AM

It depends on your game.

 

Usually, by 'turn-based', people mean a game with discrete player positions. For example, in Chess, a piece can only be in one of 64 different places. So there's no need to send updates during movement, because movement can be represented instantly (eg. Bishop from B1-E4). The receiving side can decide to animate that if it wants - but that's a presentation decision, not something intrinsic to the rules of the game, and there's not usually a reason why the sender would need to explicitly show the game object moving through those intermediate positions. So typically there would be one message sent, describing the change in terms of the game rules. You wouldn't send hardware-specific input (eg. button presses), nor would you need to send start/stop actions, because you can usually describe it adequately in one message.

 

Even if you do have a continuous game world (as opposed to a discrete one), there's still no need to be sending updates in real-time. It's a turn-based game and all that matters is that the other player gets to see what happened during the turn and gets an accurate representation of the game state at the start of their next turn. So when you send the updates is up to you, as long as the recipient gets all the information they need to recreate the events of the past turn, and the game state at the start of this turn.

 

Most games are essentially real-time, which has different requirements. You need regular updates of the other player positions in order for them to be valid at all times. In this case, the simplest situation is just to broadcast the player's current state, all of the time, so that the other computers can just update their local values based on the new information. It also helps to broadcast start and stop messages so that any guesses about what a player are doing (eg. extrapolation based on past velocity) can be corrected if necessary.



#3 goodeddie   Members   -  Reputation: 109

Like
0Likes
Like

Posted 28 March 2013 - 06:47 AM

Thanks!

 

My server is slow and low on memory so I'm trying to limit the number of messages sent to one or two. Then I let the client side handle drawing the movement inbetween the start and the end. But thanks!

 

Another question I have is: In a network game, does the client send it's state change to the server and the server adds it to a queue and the server loops through that queue and broadcasts it?



#4 KnolanCross   Members   -  Reputation: 1360

Like
0Likes
Like

Posted 28 March 2013 - 10:13 AM

Thanks!

 

My server is slow and low on memory so I'm trying to limit the number of messages sent to one or two. Then I let the client side handle drawing the movement inbetween the start and the end. But thanks!

 

Another question I have is: In a network game, does the client send it's state change to the server and the server adds it to a queue and the server loops through that queue and broadcasts it?

 

That is one way to deal with it, but mostly you should receive a message from a player, say:

 

move from [1][5] to [2][7].

The server receives and process the information. In this case you can just process broadcast the message.

But if you have a game like a Final Fantasy Tactics and the char that just moved lays a trap on [3][6]. In this case, the server shall process the information, but must not broadcast the trap postion (since the enemy player should not know where the trap is, otherwise he will not step on it).

 

In other words, you can simply broadcast messages, but you should be careful on what you are broadcasting, some information must not be sent to other clients.


Currently working on a scene editor for ORX (http://orx-project.org), using kivy (http://kivy.org).


#5 goodeddie   Members   -  Reputation: 109

Like
0Likes
Like

Posted 28 March 2013 - 11:40 AM

You can only broadcast moving from one pos to another pos after you're done moving lol but thanks! I think I'll just send to server at start of action.






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