Giving ElectroServer more memory

So after last time, I thought I’d given ElectroServer more memory, but it turns out I hadn’t. I’m not exactly sure why, but I suspect it’s something about how Media Temple is set up.

So rather than call the main ElectroServer app (which is just a shell script), I’m opening the ElectroServer jar file, and that way I can tell java how much memory to use (and other options) as parameters.

I’m pretty sure Java is installed somewhere on Media Temple (you need to install the dev tools) but I couldn’t find it anywhere! And if I just typed java it couldn’t find it. I even ran a find command, but it was nowhere! But then I realised that the Java runtime is packaged with ElectroServer in the jre folder!

So with a bit of fiddling I worked out that I could start ElectroServer with more memory by running the jar file, but I had to do it while in the server subfolder within the ES install.

../jre/bin/java -Xmx128M -jar lib/ElectroServer4-bootstrap.jar -mode StandAlone -config config/ES4Configuration.xml

where 128M is the amount of RAM made available.

[UPDATE]

There is a better way! Thanks to Paul Hayes (a colleague at Plug-in Media, see comments below) I have now realised that ElectroServer’s main app is nothing more than a shell script that you can edit. Furthermore there is a line you can uncomment right at the top to change the Java parameters :

# Uncomment the following line to add additional VM parameters
# INSTALL4J_ADD_VM_PARAMS=

Change this to :

# Uncomment the following line to add additional VM parameters
INSTALL4J_ADD_VM_PARAMS="-Xmx512m"

Where 512 is the amount of RAM in Mb you want ElectroServer to use.

ElectroServer security sandbox violation error

I suddenly started getting a really weird error from Flash when trying to connect to ElectroServer :


Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation: http://games.seblee.me/moonlander/MoonLanderViewer.swf cannot load data from 72.47.193.154:9899.

I posted to the ElectroServer forums and quick as a flash, Teresa got back to me – apparently ElectroServer was running out of memory. But apparently that’s not surprising – all Java gives it is 64Mb by default! But before I could fix it I had to stop ElectroServer from running, which isn’t easy when it’s running in the background.

Earlier Teresa had told me how to do this.
Continue reading “ElectroServer security sandbox violation error”

Multi-user gaming in Flash – Lunar Lander tests

Lunar Lander multi-user tests

Lunar Lander multi-user tests

Anyone playing my Lunar Lander game won’t know it, but we’re spying on them! The game gets around 20,000 hits a month, which is very roughly one a minute or so, so I thought it’d be the perfect vehicle to test out some real-time gaming techniques.

I’ve replaced the original game with one that transmits your position to ElectroServer, although you won’t notice any difference at all. The only way to see the all the current players is via the swf below :
Continue reading “Multi-user gaming in Flash – Lunar Lander tests”

Further adventures with ElectroServer

As there has been a lot of interesting talk on my recent live chat example I thought it’d be nice to actually see what you’ve been saying! So I checked out the Logging Chat By Room tutorial on the ElectroServer wiki.

After some minor tweaks I got the Java extension compiled (the methods should not be marked @Override as the class isn’t extending anything) and tested them locally – all was fine.

So I uploaded them to the server and restarted but ElectroServer wouldn’t come back! There was a Java error message and it was just way beyond my capabilities to troubleshoot it. Thankfully, Teresa from ElectroServer checked the forum at 7.30am on a Sunday morning and responded to my plea for help! She assures me that she’s not usually so ultra-responsive but I have yet to see evidence of that! So far, the support I’ve got from Teresa is just phenomenal.

I never did quite get to the bottom of what happened, but I suspect it was a problem with a persistent room as I had been playing with those settings in the web admin interface (frankly without really knowing what I’m doing 🙂 ) . But I fixed it by reinstalling ElectroServer with these instructions, and I was back where I started! I’m still working on getting chat logging done, but in the meantime I wanted to try something a little more interesting to me. There’s a tutorial on the ElectroServer wiki which extends the chat example and shows everyone’s mouse as they move it around!

And here’s what it looks like screen captured :

And here’s the actual app!
Continue reading “Further adventures with ElectroServer”

Installing ElectroServer on MediaTemple

Further news to report on my ElectroServer adventures! I’ve now got an ES4 installation up and running on a MediaTemple Dedicated Virtual server. It was actually pretty easy too, thanks to this tutorial from Greg Sidbury.

I had no problems following although there are a couple of bits that confused me. The first was that the download link didn’t work so I just found the Linux RPM link on the ElectroServer download pages and used that, which for the current version is :

[not available]

The other thing that got me is that I put in the domain name into the ES4Configuration.xml which didn’t work. I should have put the ip address for the virtual server (which you should find in your Media Temple account or you could always just ping your domain from a terminal window).

Once I’d opened the ports and started the server running I tried to telnet in to port 9898 (the default chat port) but it was refused. So I edited the crossdomain.xml on the main webserver to include the IP address of my home internet connection and it seemed to be OK after that. (At least I think that’s what fixed it!).

So apart from a few minor hassles it was pretty seamless and only took me an hour or so. I must admit to feeling way out of my depth, this isn’t something I’m particularly expert on so please feel free to comment with further advice 🙂

Installing ElectroServer on Mac OSX

[This post is obsolete – ElectroServer doesn’t seem to exist any more]

What else to do in the Christmas holidays but finally get my head around ElectroServer? 🙂 Of course the first (sometimes significant) hurdle in getting started with any multi-user technology is just installing the server on your machine! ElectroServer4 (ES4) is Java based so it should work on OSX, but most of the documentation is for Windows, so I spent today installing it on my MacBook and thought I would share what I learned.

ES4 runs on Java 1.6 and OSX is shipped with 1.5. You can find instructions on getting the update here, but whatever you do don’t complete the steps to make 1.6 the default Java Virtual Machine (JVM), otherwise FlexBuilder won’t work any more!

Now you need to download the Unix package (the one marked “without JVM”) on the ElectroServer downloads page [sorry, no longer available], and unzip it somewhere suitable (I put it in my documents folder).

Then open up a terminal window and navigate into the folder where you unzipped it. (Handy shortcut : type “cd” followed by a space and then drag the folder from the finder onto your terminal where the full path name will be inserted).

There’s a file in here called ElectroServer that you run but you need to tell it where to find the latest JVM. According to this rather useful thread [link no longer available] you can do this by typing :

export INSTALL4J_JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home/

And then start the server normally by typing :

./ElectroServer

At which point you should see the happy message :

16:28:08,523 [main] INFO  DisplayLogger  - 
-=-=-=-=-=-=-=-
Starting ElectroServer 4.0.6
-=-=-=-=-=-=-=-
Computer Information
	Operating System: Mac OS X
	Operating System Architecture: x86_64
	Processors Available: 2
	Memory Available: 682Mb
-=-=-=-=-=-=-=-
Virtual Machine Information
	Virtual Machine Vendor: Apple Inc.
	Virtual Machine Version: 1.6.0_17
 
 
16:28:14,863 [pool-1-thread-1] INFO  DisplayLogger  - 
-=-=-=-=-=-=-=-
ElectroServer has started successfully

After several hours of fiddling around this was somewhat of a relief.

The next problem was that I couldn’t navigate to the admin panel which by default you can find at 127.0.0.1:8080/admin. But whenever I pointed my browser at it all I got was an empty binary file in my downloads folder. Thank goodness for Twitter where Matt Bolt saved the day with his tweet :

@sebleedelisle Make sure you’re using https, not http – I run into this constantly 🙂

Thank you Matt! I have no idea how I would have figured that one out without you! So I just navigated to https://127.0.0.1:8080/admin and it worked.

I expect to be furthering my adventures in ElectroServer over the next few days so I’ll keep you informed of how I get along.