Want to write an MMO? Here's a Darkstar JME Integration Wiki I Wrote

Hi guys,



It’s taken me a while, but I’ve written a Wiki on my very basic (so far) JME/Darkstar integration project:



http://code.google.com/p/jgcloud/wiki/DarkstarJMEIntegration



I would REALLY appreciate if someone skilled could have a runthrough and see what I’ve missed. Is it easy to understand? Should there be more?



Let me know what you think  :|



Richard

Hey thanks a lot. I will have a look on this tomorrow.

Shameless bump !

Shameless bump?

Yeah, you know… When you push your message back to the top by writing something pointless… Like this  :smiley:

Hi Richard, thansk for writing this tutorial, I tried this today.



My main problem is not in your tutorial but that I'm on a older 32-bit Mac with a unsupported Soylatte JDK 6 (Darwin). I gave up and created a VirtualBox with Fedora, had to install ant and junit and java and vim… ("What world are we living in!!") Took forever.



I encountered a strange bug where the conf directory ended up in TestdarkstarServer/conf/ instead of in DarkstarServer/sgs-server-dist-0.9.11/conf/.

Where is the bat file meant to be generated (it was also there)? I had to move files and change paths in the bat file to make it work – I'm sure I got something wrong in one of the project.properties, but I don't see what.



( By the way, can you please use slashes instead of backslashes? I mean in paths of a "java -jar" call in the bat file. Or create a second .sh file with normal slashes instead. Java understands both kinds, but the "foreward"slash works on every operating system, not just Windows. )



Well in the end I managed to start the Darkstar Server in the VirtualBox, but now I don't have enough RAM to run NetBeans, the game clients, and VirtualBox at the same time. ARGH.  :x



I have a real Linux box at work, I'll try again later this week… ("Nothing, boss! Just configuring some Java libs! it's java, and java is work related, right? tanks? what tanks?")  :smiley:

First, great work!  Well-written and to the point :slight_smile:


zathras said:
My main problem is not in your tutorial but that I'm on a older 32-bit Mac with a unsupported Soylatte JDK 6 (Darwin). I gave up and created a VirtualBox with Fedora, had to install ant and junit and java and vim... ("What world are we living in!!") Took forever.


If it's one of the intel macs, then Snow Leopard gives you JDK6 (we won't count how many years overdue that was :p), PPC machines are, of course, SOL

zathras said:
Well in the end I managed to start the Darkstar Server in the VirtualBox, but now I don't have enough RAM to run NetBeans, the game clients, and VirtualBox at the same time. ARGH.  :x


How much RAM did the VM and host have?  I know the IDE's are hogs, but I would've though Darkstar would take relatively little to get running

Well i still have the problem to understand what exatly does darkstar do ? (And now don't just say persistence)

I mean what is the pro/contra against a simple sql/networksystem solution?

Maybe that can't help you:



http://tinyurl.com/yjjlems

The pro's (though I'm not the one to validate this):


  • It's scalable, and should be able to handle many requests from clients in an efficient manner.

  • "Persist" your world objects so they're up and ready to go when you restart the server.

  • erm.....



Let me tell you what it doesn't do:

  • Persist in any useful way.

  • UDP



The lack of UDP really dissapoints me (UDP is a non-reliable "faster" way of sending data packets, perfect for things like player locations). It only uses TCP, which I know is reliable, but I noticed sometimes a delay of 1.5 seconds even on my local Wirless network. Not really workable if you're sending player locations every 100ms.

I've posted this on the PDS website, and they have suggested I write the "UNRELIABLE" protocol using their "pluggable" transport mechanism.... Holy sh*t ! I took one look and ran a mile!

So what I would do is create a generic interface between the client and the server, and use Darkstar as a replacable test-bed. For its faults, it's certainly quick (relatively speaking) to get going and you can either replace it, or modify it as you need later.

http://lmgtfy.com


Now that is hilarious!
sbook said:
If it's one of the intel macs, then Snow Leopard gives you JDK6 (we won't count how many years overdue that was :p), PPC machines are, of course, SOL


Yup, I will need to buy Snow Leopard and more RAM. ( What is SOL, speed of light? Second Order Logic?  :D )

sbook said:
How much RAM did the VM and host have?  I know the IDE's are hogs, but I would've though Darkstar would take relatively little to get running


500MB out of my 1GB. Subtract two operating systems from that. Darkstar wasn't the problem. Well, I tried it again yesterday on an newer Ubuntu machine with a real JDK 6, with no luck.

Richard, can you please add a few lines of info about ...

  • what is which file trying to accomplish? (like, JAR A calls JAR B with config C)?

  • your directory structure? I have the sgs-server and sgs-client directories, and the two sample projects from you repo. I need to update the bat file to work in my system, it cannot find any classes (from the command line) the way I have it structured.

  • where the properties are and what you use them for? (copy files, where, why?) Your doc says the property only needs to be changed "if you use a different version". Actually every user will have to adjust the path, no "if" there.

  • what do you have on your classpath? I must be missing something.


That would help!

Hi,



I'm struggling to answer most of your questions sbook


what is which file trying to accomplish? (like, JAR A calls JAR B with config C)?


I'm hoping that's explained in the complete wiki... Give me an example of what is missing. Remember, the source code is well documented too.

Your doc says the property only needs to be changed "if you use a different version". Actually every user will have to adjust the path, no "if" there.


No "if" for you certainly, but "if" people are using Windows and Darkstar version 0.9.11, then they won't need to change the Netbeans properties file.

your directory structure


Updated with the specific locations of each file on the PDS server tree.



I'm wondering if somebody who uses a mac may be able to guide you on the classpath and batch file setup. It's weird on the server side, because this is all Darkstar specific, and shouldn't need any classpath definitions.

Ricahrd


richard_hawkes said:

Updated with the specific locations of each file on the PDS server tree.


Thanks, that's helpful.

richard_hawkes said:
I'm wondering if somebody who uses a mac may be able to guide you on the classpath and batch file setup. It's weird on the server side, because this is all Darkstar specific, and shouldn't need any classpath definitions.


OK, good to know I can exclude fixing the classpath. When I ran startDarkstarTestServer.bat it kept whining it couldn't find testdarkstarserver.TestDarkstarAppListener, so I first figured I'm missing that JAR on the classpath. Then, second theory, I might need to update a property in your spcript to make sure the Ant script copies the files in the right directory (I see now that it does). Third theory, I may be running the script from the wrong directory, and the paths are somehow relative to that. I'll figure it out and report back.

Hah. I got it.



I know why the bat file didn't end up where it should. The Ant script should be:



       

<echo message="Copying batch file to Darkstar directory"/>

        <copy toDir="${darkstar.home.dir}/…">

            <fileset dir="conf" includes=".bat"/>

        </copy>





Your script originally tried to copy from "/
.bat". This worked for you by chance, but for Linux or Mac users, or Windows users who don't put their files in the top level of the "c:" drive, it silently fails and never copies anything.



Now it runs and connects and everything. (Don't you love it when you can just hit the Run button a few times and Netbeans goes "OMG I CAN HAS CLIENTS!!!1!" and whee, you run eleventeen clients!)



One more question: What is this chasecamera meant to do? For me it just goes in circles, up in the sky, through the ground, back to the tank, before I have even touched a key to move the tank.

Thank you Zathras, I will make the update to the source code and check it back in.


What is this chasecamera meant to do?

Bloody good question. I am using the default JME ChaseCamera and getting pretty p*ssed off with it ! It works now (for you too I hope), but man, it bounces all over the place and is uber-sensitive on my PC. There are a number of "TO-DO"s for me, and writing a decent chase camera implementation... This might be just reconfiguring the JME one, or (tremble) writing my own.

You 'll figure it out.



Today I was wondering what would make more sense:

Broadcasting each player's location, or broadcasting the action (x units foward, left turn, etc)?



If we track locations the clients have to interpolate how the player got there, it may not be smooth but everybody would end up where he ought to be.

If we track actions then each client could respond to the input for others the same as for local player input (animate and move locally); but I don't know how deterministic this is, would clients get out of sync? Physics games might get out of sync, what about normal ones?

Just brainstorming. 

Yep, you’re referring to dead reckoning, and I can see that some of the additional values that need to get passed around are “curernt speed” and which buttons I’m holding down (left, right etc). This could allow for the server to “guess” where I will be and pass this to the clients. It’s an involved area. There’s a great article on it here: http://www.mmorpg.com/discussion2.cfm?post=2228522#2228522 (scroll to the top). It’s in C#, but you’ll get the idea.



In terms of smoothing the movement out, I have implemented a very effective interpolation model in the latest cut of my code.



svn co http://jgcloud.googlecode.com/svn/trunk/DarkstarJME darkstarjme-latest



Take a look at the “Interpolator” class. Each remote player gets its own Interpolator instance, and the TankGameState.updateRemotePlayerLocations() (which is called by TankGameSate.update(…) every frame) checks for new updates, as well as gets the current remote players interpolated position.



Of course, you’re never seeing where they are at this very moment, you’re seeing where they were X milliseconds ago (depending on the update interval and latency). But if the update intervals are frequent (eg every 100ms or faster), then I don’t know that it’s going to be so bad.



If the latency is greater (eg when playing over the internet), then you need to start thinking about dead reckoning again. And now we come full circle back to the top of this post :wink:



Cheers

Richard

very good article indeed! Obviously copied and pasted from a game framework documentation, (s)he didn't just jot that down casually in the forum. somebody got paid for writing that. :wink:



if you have ever "played" secondlife you can see prediction at work quite nicely. Sometimes a character walks straight on in a fast pace, through walls even and over the edge of the island, and then it goes blip and he's back (if you're lucky).



Knowing about these unavoidable package headers is essential to choose the right optimization strategy (more data, less packages). Would that work in darkstar too, what kind of packages do they have?



I also thought about mixing the two approaches, but the article is even more ahead.



they send navigational input (and use it for dead reckoning), predict where it's going and pretent that's a fact until told otherwise. Now and then we send real player coordinates to correct the estimate. And they add interpolation to the correction too, I didn't think of that.



well I haven't implemented anything if that sort yet at all. I'm still considering how to design my base game so it does not make it too hard to extend to multiplayer later. Multiplayer is not a requirement for my game idea, but if I'm writing my own basegame anyway, I might as well decrease the number of obstacles for future enhancements.



I guess everything needs to be as abstract as possible, eg the player is basically an NPC that happens to respond to user input, right?



PS: edit: typos © by Apple iPod spellchecker prediction interpolation… sigh