"Chaos : In the darkness" just released on Steam!

Wrong it’s the opposite jre32 run on Windows 32bit and Windows 64bit.

Ok I’m not a specialist and have not tested. I believe you are right.
So… I don’t know how to make the app run for 32bits OS.

It will crash due to memory consumption of the JVM :confused: (that was the main raison I switched to 64)

Same here, that is why launch4J is great. No need to work with XML. Everything is done through the GUI.
You should have a look.

1 Like

Wait, you are using more than 4GB of memory at a time? I’d really like to know what takes so much space.

Use less memory. As another has hinted, you must be using a crazy amount.

Well, the new Star Wars Battlefront game demands 16 GB of RAM for the highest settings.
I always bought a lot of RAM for all of my computers, because it’s fun to make stuff with it. :chimpanzee_closedlaugh:
EDIT: it’s 8 GB RAM + 2 GB G-RAM for minimum, 16 GB RAM + 4 GB G-RAM for “recommended” :rocket:

But yeah, MMO games usually have low required specs to run on as many computers as possible.

Did you look for memory leaks (are possible with Java too)?

I was about to ask you…
I know steam has some pre-built functions for installation, but I dont know how it works, did you look at on how it works ?
Maybe it could create an jre directory and setup it for you automatically…

1 Like

My game Asteroid Hunter when I released the demo also required 4 gb of memory…
Then after some tuning I found out it was because of the nebula pictures resolution on the skymap, I just swaped it to smaller pictures and it went from 4gb min to 1gb min, and almost no diference on the nebula on the screen…
Sometimes its something very easy to fix, anyway, 4gb is too much, and I found out that there is a lot of players with 2gb max on their system, even the ones with good graphic cards …

Yes, but there are two kinds of RAM - the one on the mainboard and the one on the graphics card. Let’s not forget that. The gfx card memory is typically a lot smaller (1 GB, 2 GB typical, around 4 GB with a very good card, up to 6 GB and more for CAD workstations). Okay, on systems with integrated gfx chips the usual RAM is used by both (the GPU and the CPU portion of the chip).

Textures (your nebula) is typically graphics card memory (call it G-RAM).

Example: my G-RAM versus my other RAM - it’s 2 GB versus 16 GB (upgrade planned for the 2 GB).

Nope. It’s both actually. It’s in RAM until you see it… then it’s ALSO in G-RAM.

Thanks for that info. I thought the RAM gets freed after the texture was sent to G-RAM. :chimpanzee_closedlaugh:

If I do not specify any arguments to JVM, Chaos use average memory 2g - 2.5g MAX
If I specify Xmx1500 (for example) the garbage collector manage to keep memory under 1.5g to 2g MAX

I think this it acceptable for a game like this.

But when using Xmx1500 on JME SDK 32bits, a got a JVM exception like ‘unable to reserve enough memory’.
I do not get this exception with JME SDK 64bits.

I have made some tries, in 32bits, the maximum I could set for Xmx arg is 1g.
That is why I’ve switched to 64 bits (and btw, I’m far away from 4g usage !)

I do not investigate a lot on this, but it does not matter anymore since launch4J works much more easily than Steam API. (my though)

You just need to add a depot for the JRE (make sure you are in default branch of your app), and add it to the distribuable package.

Do you set the direct memory heap size also? The default is really small and has a huge impact on JME.

I think 32 bit Java can only accept a max heap of 1.2 gig. Similarly for direct memory heap. Though you might find if you increase the direct memory heap that you can get away with a much smaller max heap.

I do not set anything else in JVM arguments except Xmx value.
Regarding JME, can you please provide some example of how should I configure that ?

here are defaults, found in ETC folder jmonkeyplatform.conf file.

default_options=“–branding jmonkeyplatform -J-Xms24m -J-Dsun.java2d.dpiaware=true -J-Dapple.laf.useScreenMenuBar=true -J-Dawt.useSystemAAFontSettings=lcd -J-Dswing.aatext=true -J-Xmx512m -J-XX:MaxDirectMemorySize=2048m -J-Dsun.zip.disableMemoryMapping=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true”

Honestly, I’m bad at java memory understanding.
I never get the differences between max heap and direct heap… Do they stack ? setting both to 1g will reserved 2g ??
Why setting Xmx to 2g do not prevent from getting 2g+ usage ? I’m lost at these points…

Heap is the memory space for java objects (not for java itself), direct memory is the memory space for native objects like meshes, textures, bullet objects etc. All of that together (java, java objects and native objects) make up your overall memory use.

…after reading past few posts, im genuinely curious to know, how come, memory goes over 1 gig?? Im hardly crossing 850 megs and there is quite a lot of things going on…hmm…

…also, for packing JRE with your game, you could do just this…

…MY_GAME.JAR file is in a dist folder…

  1. copy the system JRE folder to dist\jre-win-1.8.0_60 (basically version you use in development and its already installed on your machine)

  2. create a .bat file with the following line in it jre-win-1.8.0_60\bin\java.exe -jar MY_GAME.jar

…and you are done…double click on your BAT file and that will do…similar thing you can use for OSX/Linux, without bothering customer for download of specific JRE version, and instead, game will run on version you used for development…

1 Like

The Java memory settings are from Java’s perspective. The JVM will have to allocate more memory to manage all of that. The JVM has to allocate all kinds of memory for its own management, even beyond just what’s necessary to manage its own heap. For example, every thread has to allocate its thread stack. This is not included in the Java heap size.

…and as Normen says, there are other factors like native (direct) memory usage.

General advice, set the heap size to somewhere around 512 meg and the direct memory size to double that for JME apps. Set -XX:MaxDirectMemorySize just like you do -Xmx… in the command line options for your app. On a 32 bit platform, set direct memory to 1 gig and try to keep heap as low as possible without causing GC churn. I think I finally had to raise Mythruna up to 640 meg only recently.

The issue with direct memory (which is most of the kind of memory that a JME app uses) is that it doesn’t count when the garbage collector decides if it should run or not. So if your heap size is too big then you risk getting out of memory errors (direct memory) even though there is really plenty of freeable stuff. So you want to find the sweet spot of a heap size that keeps GC healthy so that it keeps direct memory from filling with old garbage.

So another thing that would be interesting to know is what kind memory errors you got that prompted you to raise your heap size.

1 Like

That is the exception raised when crash happens.

java.lang.OutOfMemoryError: Java heap space

I think the sweet spot is around 1.5g. It prevent memory from growing too much, forcing gc too work harder. (no performance impact IG, I have a poor hardware config (ATI 5700 serie, 6go RAM, Core 2 duo 3g) and the game still run quite well (50 - 60fps), no matter what you do or wherever you are.

For those who asked for how I made the process “burns” that much memory, some Chaos stats :

  • No instance so no loading screen when in game (I speak about Dungeon instancing, where only dungeon’s assets are loaded in memory…)
  • Three dungeons material sets (5 to 8 materials per set), with mini 4 textures per materials (diffuse, bump, glow, specular)
  • Each dungeon is a maze of 7 unique models.
  • about 30 different character models. As for dungeon, each characters’ material use 4 textures and some of them include some additionnal stuff like weapon or specific fx (Parcticle Emitters)
  • 400 to 500 monsters for the whole Adventure mod. (Not visible at the same time of course !)
  • about 30 diffrent weapons, with the same 4 texture per material
  • about 80 unique FX (J3o containing sets of ParticleEmitters)
  • about 50 fx sounds (wav, some of them are streamed. Not ogg because we experiment some weird result with ogg on some PC)
  • about 30 env sounds
  • 4 streamed songs
    … plus hundred of images for the whole Nifty GUI like in game windows frame, button, spell icons etc…

So yeah, its quite easy to use more than 1g memories… But I admit, everything can always be optimized.

Chaos is my first game (lonely programmer on this project) and I certainly have a lot to learn, especialy for technology around the game such as optimization, deployment, multi player handling, etc… I promisse I will do better on the next one ! :stuck_out_tongue:

1 Like