Server updates

Hi all!

Just a question: How i should set simpleUpdate() method for the server? As a client has 60fps for the simpleUpdate().

Can you suggest according your experience?

I rely on this page: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:headless_server
(Next Steps)

Thanks.

I don’t use headless server because I couldn’t really see the point. Still, I don’t really understand the question. If you have things to update then you’d update them. If you don’t have things to update then you don’t update them.

Can you be more specific?

@pspeed said: I don't use headless server because I couldn't really see the point. Still, I don't really understand the question. If you have things to update then you'd update them. If you don't have things to update then you don't update them.

Can you be more specific?

OOo! Interesting!
But if I need to update some Entitiey states or check any Components/events/connections from time to time?
So you do not loop any things on the server at all?

Edited: or if i need to create a timer for a game? For example, a game will be running 10 minutes. i guess i should create a timer on the server.

I use a http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html

I didn’t really need all of the other stuff that a headless server provides and I needed lots of stuff that it doesn’t.

Servers are multithreaded by their very nature, anyway. You’ve got messages coming in from clients on background threads, etc… so you would need to be up on all of the java.util.concurrent stuff.

HostedConnection session data is safe because you are guaranteed that a hosted connection will never be called simultaneously from different threads at the same time. (It’s part of SpiderMonkey’s contract.) But everything else you will have to deal with.

I have some things (game simulation) that I run very often (60 FPS) and other things (like network status updates) that I only send 5 times a second.

@pspeed said: I use a http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ScheduledThreadPoolExecutor.html

Servers are multithreaded by their very nature, anyway. You’ve got messages coming in from clients on background threads, etc… so you would need to be up on all of the java.util.concurrent stuff.

Aha, i understand it. How many threads do you use for servers? Or it depends on hardware?

@pspeed said: I have some things (game simulation) that I run very often (60 FPS) and other things (like network status updates) that I only send 5 times a second.

But you make any updates anyway. :slight_smile: Is it ok if i use simpleUpdate for such a reason? even with multithreading.

If you can think of something from headless application that you will use other than simpleUpdate() then I guess it makes sense. But if that’s the only thing then we grab all of the other stuff you don’t need when a scheduled executor will do the same thing?

SpiderMonkey creates its own threads internally. You shouldn’t worry about how many it creates… it just does. I think I have two or three threads besides those. I don’t remember.