Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (776)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
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 2522 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
is this big, small OK... i have no experieces with that stuff


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

« 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  

hadezbladez (271 views)
2018-11-16 13:46:03

hadezbladez (148 views)
2018-11-16 13:41:33

hadezbladez (281 views)
2018-11-16 13:35:35

hadezbladez (65 views)
2018-11-16 13:32:03

EgonOlsen (2119 views)
2018-06-10 19:43:48

EgonOlsen (2143 views)
2018-06-10 19:43:44

EgonOlsen (1356 views)
2018-06-10 19:43:20

DesertCoockie (1952 views)
2018-05-13 18:23:11

nelsongames (1595 views)
2018-04-24 18:15:36

nelsongames (2242 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!