Basic Question About Online Game Programming

Blitz3D Forums/Blitz3D Beginners Area/Basic Question About Online Game Programming

WERDNA(Posted 2008) [#1]
Greetings, Mortals.

I have a rather basic question on programming online games.
How do I Synchronize 2 Global Variables with each other?

Example;
The game has a global variable to keep track of the weather.

When the game starts that variable should = 0, and then begin
counting upward to determine the weather.
At first the weather will be clear, but then will get snowy ect, as
the variable counts upwards.

When a second player joins the game, his Global Weather variable
will = 0, since for him, the game just started.

So then the first player might be in the middle of a snow storm
while the second player has clear weather.

How do I make the 2 Weather Variables match up?

The Adventurous WERDNA(Currently caught in the middle of a snow storm)


Cp(Posted 2008) [#2]
Client and server. The vars like that are in the server, and the players connect to the server.The clients contain individual player data, while the server contains data that is the same for all players.


WERDNA(Posted 2008) [#3]
Ok, thanks a lot Cp.

Just one more question,
The server would be the computer hosting the game right?

The Worried WERDNA(The snow storm is getting worse)


Cp(Posted 2008) [#4]
Yes. The server is a program hosting the client programs, seperate from them. Of course, you could always build a host, so the person who makes the online game could host it, and have all the code in one game. :)


WERDNA(Posted 2008) [#5]
Ok, thanks for all of your help.

It is now only a matter of time until Battle Gnomes 2008 is ready for
download:)

The Joyful WERDNA(The snow storm has cleared at last!)


YellBellzDotCom(Posted 2008) [#6]
One thing I do in my multiplayer attempt is when a client joins the game the server will send that client initialization information right from the get go. Things like player positions, object positions, enviromental information, etc. Then you just need to send the client information when things change on the server.


WERDNA(Posted 2008) [#7]
Ok, Thanks Xyle.

I'll probably post some more questions pretty soon about online
gaming, because I have no idea what I'm doing.

The Clueless WERDNA(Lord Of ?)


YellBellzDotCom(Posted 2008) [#8]
Have you started any Network coding yet? I posted a basic udp chat system in the code archives, it uses the same port for both machines for sending and recieving, but I think it gives a good idea of how to set up the basic features needed to pass information in a client/ server setup.

Heres the code archive post...
http://www.blitzbasic.com/codearcs/codearcs.php?code=2261


WERDNA(Posted 2008) [#9]
Thanks, this will be really useful.

And yes, I have started some of my coding, but I'm sure that its
pretty sloppy.

If you don't mind I'll use your code as the starting block for my game,
and just build from there.

Again, thanks for your help, and thanks to you too Cp.
Both of you have been incredibly helpful, and I don't know
what I would have done without your assistance.

The Grateful WERDNA(Lord Of Appreciation)