Jump to content
  • Advertisement


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


In Need of Multiplayer Action Game Theory

This topic is 6926 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, ever play asteroids? I''m thinking of making a multiplayer version with many ships I think i''ll use client-server architecture, that sounds right but I mean, how will I go about this? Spline-curve interpolation, dead reckoning, sending input commands, calculating collisions on the server? It just overwhelms me! Is there anyone that can help DarkAgito

Share this post

Link to post
Share on other sites
Client event happens(constant stream of updates such as x and y positions)..send to server
server okay''s it, sends it out to all players. then show it on their screen..might be slow such as syncronizing stuff.

rest is just thoughts..

I know nothing about graphics and math.
but server, this is jsut an idea.

of course to prevent cheating(who would make a cheater for a small game though? ha) server doens''t keep track of movements..but keeps track of data..such as meters (shots, fuel if that''s in there)? so no cheating is allowed.
for your game I assume basic commands
moving(thrust), firing, rotating and hyperspace?

have the server keep track of hyperspace
I don''t know how...
client sends hyper space command
server picks position and sends out to all players
so that games don''t pick other random values.
coordinates updated...?
your physics rules could determine possible positions on the server side. and supply data if a player is lagging.

personally, I''d freeze the game, instead of have players jumping around like in diablo...

what about the asteroids how do you controll them?
okay, maybe
the server puts initial data in..and the game follows those rules..
vector? asteroid a is this direction at this speed.
if i''m right..doesn''t the asteroid always go the same way in the game?
and since of course players constantly send out packets of their position...if they shoot a asteroid
the server picks it up, checks if that was possible by that ship (where it''s at and velocity(?) blah blah)

server update the players that the asteroid exploded
and this info goes back to players.

client sends out something...server okay''s it...sends it back..then the event happens.(don''t allow things to happen on the client, unless the server okays it)
I don''t know how to do their bullets..
if your getting packets only half a second...(I don''t know i''m b''sing this) and a bullet was fired...graphics would happen late...account for hits at same time by same ships

have server running master game too
say time frame 1, player1 arrives on time 2 a bit late 3 a bit later...
take player ones data...and 2 and 3
average it all
1 of course being most significant..
and then 2
followed by 3 having little influence. ( why should 1 and 2 be penalized for 3 laggin), also have syncronizing stuff too ever now and then...just so player 3( the lagging one) could catch up maybe?
I dunno...
this is just ideas..I just blurted this all out cause you had no idea..how..ohwell of course my ideas generally have no follow through so don''t use them without anybody else''s technical help.

Share this post

Link to post
Share on other sites
CodyVa is right about the cliënt - server way. Positions have to updated every time, and be sure new position != old position, and the server has to recognize the new position. A sort of time counter is also usefull for the updates of the game status. ( like do time++ ) and it just has to take the new time new_time or something u made. so it updates it.

also be sure that the (client1_x & client1_y) != (client2_x & client2_y)
so a player position cant go in someone else its position. If its a 3d game , the z has to be included. (doh!)

for shooting its like get the position of the player, and its like y++ ( shoot forward ) till the bullet == object
if bullen == object
hit == 1;
while hit == 1;
//the hit code , and damage
( if new.health <= old.health )
damage == true;

the result has to sent back to client again
server -> client
so it updates it. ( you''ll need another code to make multiplayer available and stuff )

and if (client_health <= 0)
destroyed == true;
int respawn()
// try to random some numbers to respawn to a position
new.position ==// the numbers you got

// set health back to 100% again
return health;
health == 100;

this is just a part of the code. try to make one your own
I hope this can help u a bit.


Share this post

Link to post
Share on other sites

I''m working on a similar sort of game to the one you seem to be thinking of. Mine is a massively multiplayer, top-down space trading/combat game. (I also am looking for interested persons, but that''s beside the point). In its present form, it could be converted to make your game in a couple of days.

Anyway, the server-approach recommended by CodyVa is needed to implement a secure (non-hackable) game, and is also the best for massively multiplayer games. However, the back-forth is a bit slow for a real-time game. What is needed is a compromise. For example - the clients take actions, and transmits those actions to the server. While it is waiting for that reply, it keeps the game running by calculating what it expects the server to reply. It also keeps caculating other player''s positions etc. based on previous data. The server replies with okay or a position update if not okayed. Periodic synchronisations are also sent as well, just to make sure everyone is where they should be.

Well, that was confusing. Multiplayer is not easy. I am working on it at the moment, and there is so much to think about. And I am not worrying about internet play. Remember, what works on a local LAN (lag < 10ms or 100ms max) will probably (99.8% sure) not work on the internet.

So, now that I have scared you, have fun. (Also, if you''re interested in my game, email me)

Share this post

Link to post
Share on other sites
Thanks for all the responses, they do help... just make me realize that it IS hard, and it''s not just me =)

So I decided to put that game on hold, and work a little bit on a simpler game, just to get used to how it all works. Thanks everyone

Share this post

Link to post
Share on other sites
Keep in mind I don''t like online multiplayers.

Where are the games with the computer controlled AI?

I''d much rather go against alot of computer controlled..then have to wait and lag with 2 other people...
maybe scrap the idea of multiplayer and go with that...
I know you dont wanna hear it, but why not just have great AI?

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!