Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (404)
games submitted by our members
Games in WIP (289)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Few Questions  (Read 820 times)
0 Members and 1 Guest are viewing this topic.
Offline fubz

Senior Newbie


Projects: 1



« Posted 2005-12-29 19:02:36 »

Ok, i've done a lot of reading, here and on google, about networking.  I've even went and coded most of it in TCP, but there are a few problems and i have to rewrite it from scrratch so i need to start over the right way. 

Ok, my game is a platformer, and as i was reading UDP was reccomened for this type of game.  My only question is.... what data do i send/don't send?

Should i send keypresses to the server and let the server handle it?  Then i read you want to send last position and velocity etc, incase of packet loss and out of order packets.  I'm not really sure how to keep the players synced on everyones screen, and then what if keypresses dont make it? Then what?  The biggest problem would be shooting.... how do you make sure that when a player shoot, and it hits, that everyone registers.  Or do you just kinda let it fly by showing all the shots on the client, and if the server doesnt get the info, oh well.

Also, how big do you think the packets should ever get?  It seems like alot of data to send from server to clients.  Especially if there was only like 8 players, you need positions, velocitys, player state, etc.
Offline Jeff

JGO Coder




Got any cats?


« Reply #1 - Posted 2005-12-30 00:30:03 »

Ok, i've done a lot of reading, here and on google, about networking.  I've even went and coded most of it in TCP, but there are a few problems and i have to rewrite it from scrratch so i need to start over the right way. 

Ok, my game is a platformer, and as i was reading UDP was reccomened for this type of game.  My only question is.... what data do i send/don't send?

Thats an over simplification.  Is this an Internet or LAN game?  Over LAN TCP is fine.  Over Internet TCP *may* be fine too depending on your game.  if this is a traditional twitch platformer then no matter which way you go you have major latency issues to overcome over the net,.

Quote
Should i send keypresses to the server and let the server handle it? 

You *might* just get away with this on a LAN, maybe.  Yould never get away with it on the net.  In general for latency reasons you want to handle player response locally.  If you need to do cheat-checking then Id run a parallel game on the server that "double checks" the results.  (or let other players double check ech other is is more typical for a lock-step type game.

I believe Kev Glass just completed an internet lockstep based RPG that would have similar characteristics.  He might be willing to share his techniques (or even some code) with you.

Quote
Then i read you want to send last position and velocity etc, incase of packet loss and out of order packets. 

This is only for open loop asynchronous games.  It sounds to me like youve got a lock-step design.

Quote
I'm not really sure how to keep the players synced on everyones screen,

You don't.  Open loop games show only an approximation of the other players' actions.

Quote
and then what if keypresses dont make it? Then what?  The biggest problem would be shooting....

Every game has *some* critical data. You either need to send this by TCP or effectively re-invent TCP on top of your UDP with redundancy and re-trasmit frames.

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline kevglass
« League of Dukes »

JGO Kernel


Medals: 54
Projects: 20


Mentally unstable, best avoided.


« Reply #2 - Posted 2005-12-31 15:17:53 »

All my code for everything I've done recently is at:

http://www.cokeandcode.com/feck

I'd hardly call the RPG complete Wink but the networking model worked pretty well. I generally referred to it as distributed simulation - but thats just because of some old background Smiley

HTH

Kev

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars and Titan!

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
cubemaster21 (32 views)
2013-05-17 21:29:12

alaslipknot (40 views)
2013-05-16 21:24:48

gouessej (70 views)
2013-05-16 00:53:38

gouessej (69 views)
2013-05-16 00:17:58

theagentd (78 views)
2013-05-15 15:01:13

theagentd (73 views)
2013-05-15 15:00:54

StreetDoggy (113 views)
2013-05-14 15:56:26

kutucuk (137 views)
2013-05-12 17:10:36

kutucuk (136 views)
2013-05-12 15:36:09

UnluckyDevil (145 views)
2013-05-12 05:09:57
Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38

Java Data structures
by Roquen
2013-03-29 13:21:12

Topic Request
by kutucuk
2013-03-22 21:42:01
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!
Page created in 0.084 seconds with 20 queries.