JGN in StandardGame design BASICS

Hi,



First: sorry darkfrok for writing not into your forum, but I haven't recieved an email after I did the registriation.



We are writing a game in StandardGame design using GameStates (without using the tree support) and would like to start implementing JGN as fast as possible as our projekt moves on and we have only few spare time to read all 3 SimpleGame examples. Much better would be a half exmaple with StandardGame, really. We only need a syncrhonization of a vew vehicles driving together in a LAN adn physics synchronization.


  1. How do we have do design our GameStates to be optimal for JGN?



    First questions:

    a) Do we need a whole StandardGame thread running in HEADLESS mode as the server game (to be synchronized)

    b) Is it possible to have the main GameState to run in both graphical or headless mode?

    c) If so, we have a problem that NPEs are thrown as the input and somthing else important we don't know are not beeing updated in HEADLESS mode, solution?

    d) JGNServer has TWO constructors (for MessageServer or InetSocketAddress) which one to use?

    e) Which JGN classes will have to be subclassed in any case of a game?

    f) Correct to say use either MessageListener or SynchronizationManager? which should one use?



    The start is always most difficult ://:

    A simple design in a "godfather" class with the starting main() would be very helpful.

    Lets use the StandradGame, one main GameState "mainGame" implementing the actuall game and server/client setups. A simple examle would be much appreciated.



    Thanks for your help!
mathias4u said:

First: sorry darkfrok for writing not into your forum, but I haven't recieved an email after I did the registriation.


I just re-sent the registration e-mail. Let me know if you don't get it this time.

mathias4u said:

a) Do we need a whole StandardGame thread running in HEADLESS mode as the server game (to be synchronized)


In the majority of scenarios I recommend running a separate VM (even during testing) for your server that would likely use StandardGame headless.

mathias4u said:

b) Is it possible to have the main GameState to run in both graphical or headless mode?


Yes, in my games I typically create a custom GameState that has specific information to that game and takes a Mode along with it that determines if it's graphical or headless. In headless I just ignore all the graphical aspects of the game and simply use boundings.

mathias4u said:

c) If so, we have a problem that NPEs are thrown as the input and somthing else important we don't know are not beeing updated in HEADLESS mode, solution?


I have no idea what you're asking... :o

mathias4u said:

d) JGNServer has TWO constructors (for MessageServer or InetSocketAddress) which one to use?


Either one is valid, they ultimately do the same thing where InetSocketAddress makes it a little easier if you don't already have MessageServers defined it will create them for you.

mathias4u said:

e) Which JGN classes will have to be subclassed in any case of a game?


Technically nothing *has* to be subclassed, but often you'll find yourself adding your own custom Messages that extend Message (or some derivative).

mathias4u said:

f) Correct to say use either MessageListener or SynchronizationManager? which should one use?


If you are synchronizing graphical objects in your scenegraph (positional) you should be using SynchronizationManager. MessageListeners are for the core of JGN.  I would recommend looking at the tests in JGN to see more of what you can do.

Thank you for answering our questions, that helped alot to start at the right track!



I also got the registration e-mai once, thx. So next posts will be on http://forum.captiveimagination.com

I can provide all monkeys with a very simple example of JGN using StandardGame and GameStates.

This example made to be understood easily.

It also has the ability to search for certains servers hosting a game.

You could use this as base understanding of JGN and customize it to fit your needs. Therefore I marked all parts with “customizable”.

Have fun.

Thank you very much for the sample :), and darkfrog for the answers.

I would also like to say thank you for the sample code.  However, I'm having a problem opening the file; I keep being told the zip is corrupted.  Am I the only one having this problem?

Not sure if it's the case with this, but if it was created with WinZip a lot of times to put in proprietary stuff that other unarchivers don't understand and you can only open it with WinZip.

Heh :slight_smile:

I'm actually using Winzip 11.2, which isn't quite the latest version, but pretty close to it.  I'm being told that it's not a valid zip archive, so I was actually wondering if it was archived with some other tool and then given the zip extension by default.



Oh well.  I'll just have to dig into the examples.

Yeah, your're right.

I used WinRar to make the archive and renamed it as .zip  :frowning:



I will change the archive to the correct ZIP format in this evening.



Sorry having problems with the archive…

mathias4u said:

Yeah, your're right.
I used WinRar to make the archive and renamed it as .zip  :(

I will change the archive to the correct ZIP format in this evening.

Sorry having problems with the archive..


That was a bit of a late reply...heh :P