The Daily Click ::. Forums ::. Klik Coding Help ::. Question about making a Host-Client online game
 

Post Reply  Post Oekaki 
 

Posted By Message

Diefox

Possibly Insane

Registered
  23/02/2003
Points
  3481

VIP MemberGOTM -SEPTEMBER 2009 - 2nd place!GOTW WINNER APRIL 2010!
15th June, 2009 at 00:30:26 -

I have some doubts about making that kind of game.

Lets say I have a simple online game for 2 players, one start the game and becomes de host, then the other player connect to the host and then they play.

How should I program that kind of game? should I make all the important things happen only in the host and then just send the results to the client.

for example: imagine I have a Pong game, so whenever the ball hits the "goal" in the client version, nothing would happen, but when the ball hits the goal on the Host, then the player would get the points.

I dont know if I made that clear, hope someone could understand what I said and help me.

 
__________
amandapps.com

Sumo148

Super amazing fantastic user

Registered
  26/01/2009
Points
  530

360 OwnerThe Cake is a LieVIP MemberPokemon Ball!I am an April FoolI donated an open source projectSanta Hat
15th June, 2009 at 00:50:26 -

use the OINC extension to code online MMF2 games. It's very possible to do everything you just said.

 
n/a

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
15th June, 2009 at 01:52:48 -

There are many different ways that will all work when you're making an online game, each with pros and cons, but the ultimate decision is up to you. There's the way it should be done... but there's also a difference between the theory and the application when designing an online game.

Here's what you should do:
All scoring/sensitive data should be handled by the server. For a pong game, this means the goal scoring.

So on the server's screen, if the ball goes into a goal it should add to the score and then send a message to the client saying that a goal has been scored either towards or against their favour. The client will then respond by respositioning the ball and changing the score.

What you suggested is exactly how you should code it. Although coding it client-side would also work, it's not the proper way to do it for more advanced online games so you should learn good habits now by coding it server-side.

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Diefox

Possibly Insane

Registered
  23/02/2003
Points
  3481

VIP MemberGOTM -SEPTEMBER 2009 - 2nd place!GOTW WINNER APRIL 2010!
15th June, 2009 at 02:03:35 -

thanks andy, thats exactly what i'm trying to do. all the important data like scoring and even the ball positions are handled by the server, the client only sends positions and other stuff that the client can do.

but tell me more, I'm still green at online games, any piece of information about the logics of making an online game would be nice.

 
__________
amandapps.com

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
15th June, 2009 at 08:57:24 -

Is there a certain type of game you have in mind? If you told me an online game that you would like to make in future I could explain the best network coding system to have for it.

The main thing you should remember is that clients can be manipulated/hacked/edited. That's why all sensitive data such as damage done by players, how much ammo/health they have should be done by the server or at least checked periodically. But like I was saying before of theory vs what really happens > you won't experience hackers/cheaters in any of your online games until they get popular. So you really only have to worry about it later. If you're just playing with friends then they're obviously not going to hack their game... if they do I think you need some new friends!

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Diefox

Possibly Insane

Registered
  23/02/2003
Points
  3481

VIP MemberGOTM -SEPTEMBER 2009 - 2nd place!GOTW WINNER APRIL 2010!
15th June, 2009 at 16:05:00 -

for now I'm just trying to make a simple Pong game, with itens, powerups and stuff like that, just to get used to online programming. This pong game will be a Host-Client type of game, one player hosts and then sends his ip to his friend, they connect to each other and play.

BTW, does anyone know if OINC's "host server" action works?

 
__________
amandapps.com
   

Post Reply



 



Advertisement

Worth A Click