Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (542)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (604)
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  
  What about ObjectStreams...  (Read 1409 times)
0 Members and 1 Guest are viewing this topic.
Offline b0LbiT

Senior Newbie




Hardware: parts of a computer that can be kicked


« Posted 2004-10-21 06:55:24 »

Hi folks...

i have finished my fisrct basic Network code and would like you to have a look on it.

First question:
I'm using Oject Streams for the communication between clients and server.
Is the use of this streams much less performant as DataStreams?

Question two:
i have written a small space simulator where spaceships can fight each other.
I realise the synchronization between server World and client world as follow:

The server world has a mainloop.
in the loop the server do the following:
- sync the time
- update all sprites
- check collison
- sends worldstatus

The world status is a WorldData Object which contains the position, velocity, color and some more attributes (e.g. name, enrgie are optional) continously to all clients.
The World state is timestampted

The clients recieve the data and store them.
in the mainloop, the clients do the following:
- calculate the lag (timestamp of World - current time)
- update the world status with the lag
(it s a simple interpolation based on the velocity of each sprite)
- check player controlls and send them to server
(each controll is a simple object)
- paint the world

What could i optimize?
Is this strategie acceptable?

Question 3:
I have problems to connect the modells of my sprites which are flieng around in the werver world with my SpriteViews, which should be managed on the client.
i can't  assign the model on the server to the view on the client.

To solve this i implemented a little Renderer, which decide based on a casting, weather to paint a ship or ah shot (e.g.)
But i don t have a view fpr each sprite on the client..
I hope you can understand my problem.
if i could implement a connection betwwen a server model and a client view, i would be able to reduce the data, which is neccesarry to draw the Sprite.
(e.g. playername, color)

I hope someone can help me here.

Thanks in advanced
Offline jherber

Junior Devvie




Java games rock!


« Reply #1 - Posted 2004-10-21 23:06:51 »

the serialized objects are sent over the wire, so there is some extra overhead.   you can actually write your object stream to file and look at it to get a feel for the size of your protocol dialogues are.  if you are working on a lan, it probably isn't a big deal.  one problem you may run into however is that you "wire" objects must synchronized between client and server.  if you are dynamically updating clients then you can see that this becomes a minor annoyance.
Offline b0LbiT

Senior Newbie




Hardware: parts of a computer that can be kicked


« Reply #2 - Posted 2004-10-22 03:47:23 »

A WorldStatus with some Objects in it ... approx. 10 is about
1,10KB
is this big, small OK... i have no experieces with that stuff

Quote

one problem you may run into however is that you "wire" objects must synchronized between client and server.


This is my problem.
I have no synchronization between Objects, because i can't gat any relation between objects on the server and objects on the client.
in the world status there are infoemation about the sprites stored.
e.g. position.
with these inofs from the server about the sprites, the client can draw the sprietes, but in don t have a ship 1 on the client for ship 1 on the server....

So i always have to send the hole world also when nothing has changed
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #3 - Posted 2004-10-22 05:07:16 »

Dont have time to reply in detail, I'm afraid, but the benchmark for an online RPG game in real time is that each client should send/receive less than 1kB per second.

For a deathmatch FPS game, you would expect a max of something like send = 1.5kB/s, receive = 2.5kB/s, because that's the MAXIMUM you can consistently afford to send/receive on a dialup connection. In practice, you ought to be able to get it lower than that. But you don't especially need to.

So. If you're sending 20 updates a second, you know your update size ought to be around 100 bytes max.

Oh, and ObjectStreams are completely crap for games, in general. They are massively wasteful of bandwidth and latency. Don't worry too much for now - get your game written, and working, using OS's on the LAN. Then, when it works, go and read about protocols and work out how to write your own messages into bytes etc. And at that point worry about the stuff above, like how much data you expect to send.

malloc will be first against the wall when the revolution comes...
Offline b0LbiT

Senior Newbie




Hardware: parts of a computer that can be kicked


« Reply #4 - Posted 2004-10-22 07:35:13 »

OK... i keep on working with ObjectStreams

Now i have "only" to solve the problem with the relation between serverlocated SpriteModels ans clientlocated SpriteViews ...

It would be great when you could write somthing to that problem when you have some time.

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

 

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

The first screenshot will be displayed as a thumbnail.

Elsealabs (10 views)
2014-12-28 10:39:27

CopyableCougar4 (17 views)
2014-12-28 02:10:29

BurntPizza (21 views)
2014-12-27 22:38:51

Mr.CodeIt (14 views)
2014-12-27 04:03:04

TheDudeFromCI (19 views)
2014-12-27 02:14:49

Mr.CodeIt (26 views)
2014-12-23 03:34:11

rwatson462 (57 views)
2014-12-15 09:26:44

Mr.CodeIt (47 views)
2014-12-14 19:50:38

BurntPizza (94 views)
2014-12-09 22:41:13

BurntPizza (115 views)
2014-12-08 04:46:31
How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
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!