The hunt for the lost rainbow jewels

The old thread has been locked, because there were no news for a too long time:

But recently I felt inspired to work some more on this project.

I’ve worked on the basics of a magic system, with a first nova type spell effect in place now:

Also I’ve completed the melee combat code, and published a new release:

http://sourceforge.net/projects/jewelhunt/files/r015/

It should work on Windows and Linux. But I haven’t tested the Linux version since a long time …

Since the release I worked mostly on the player stats, and I could finish the character screen. It shows “real” values now instead of dummies, and all the internal calculations for the stats should be in place too (besides those which I have forgotten …)

Next steps will be to set up item modifiers for all the stats and an improved map generator for wilderness type maps.

The current state is still a walkaround demo, to showcase what is already there. No game yet.

Wonderful job so far, man.

Isometric RPGs, that’s what the world needs!!! :slight_smile:

Thanks :slight_smile: I must tailor some aspects of the project to my skills, but I hope I can make it fun nevertheless.

I’ve published a new development snapshot:

http://sourceforge.net/projects/jewelhunt/files/r016/

Since r015, it’s been mostly bugfixes and cleanup work. Item prefixes have changed, and the item-color-depends-on-mods feature is currently disabled. Some item graphics underwent some adaptations too, in lightness and size. The new walls are included as well.

Melee combat still is very clumsy, but it works. Right mouse button is bound to a fire nova spell in this release, which is handy to handle bigger groups of imps. Mana costs and mana recovery is in the demo, but there is not limit … you can continue to cast spells even if your mana is negative already.

Same for life. You can take damage, but your character won’t die.

Slain foes drop items now. 50% chance to become a magic item, 20% chance to become a double-magic item, and a 3% chance to become a rare item with 3 or more mods.

This versions almost feels like a little RPG now.

Hey!

So far, your game looks really promising! The graphics are nice, there is no audio unfortunately (or it did not work). But what really made me stop playing is the horrible fps. I bought a new laptop like 6 months ago which I can play Tomb Raider Underworld with at full settings so I was quite surprised to see your game using so much CPU. You should run the game with the option -verbose:gc. The GC fails in allocating memory a lot (this means the garbage collector uses your virtual memory because your ram is full). Try not to create so many objects in your game loop.

I noticed you’re uses LWJGL2.9.1. I really recommend not to. LWJGL3 has by far much better performance and GLFW is much faster for display and input. Calculating the movement after input really took a while. I hope you can fix this because it really does look promising!

-TBJ

Thanks for the feedback :slight_smile:

Yes, there is very little audio yet, only two sounds when moving item in the inventory, one of them also used if the PC picks up an item.

I wasn’t aware of any performance problems, that’s why I didn’t spend time on optimizing anything. I’m testing on a laptop which is fairly recent, and an older desktop PC, both can run the game at 60 FPS and on the desktop (which I am using right now, so I could check this quickly), the game uses between 3 and 5% CPU while running, far from any sort of problem.

I’ll still try to take a look into the garbage collection problem that you mentioned.

Since I wasn’t aware of performance problems, there seemed to be no need to upgrade the LWJGL version. Usually I stay with a library version as long as possible, because new versions always bring not-yet-known problems.

Are there more people out there who are experiencing performance issues with the game? I got very little feedback so far, and it’s hard for me to guess if it’s a problem of one system only, or a general problem. Particularly since it runs with very little load on my test systems.

PS:

I made a quick test with -gc:verbose but I didn’t see anything scary:

Startup phase:
[GC 33737K->9147K(125952K), 0.0123542 secs]
[GC 42939K->21172K(125952K), 0.0076944 secs]
[GC 54964K->26810K(125952K), 0.0048174 secs]
[GC 60602K->29049K(125952K), 0.0034013 secs]
Display up:
[GC 62185K->41519K(170496K), 0.0083056 secs]
Map creation, moving, entering catacombs, map creation again, monster etcs. Killed a few imps:
[GC 106543K->53479K(173056K), 0.0167703 secs]
Killed more imps, GC didn’t output anything more. FPS were 56…60 during this test.

Seems there are plenty of objects created, but GC times are still low … should I be scared by the last line, when the GC cleaned up 50MB of heap?

I would like to note that I’m using Ubuntu 14.04.3 LTS 64 bit. I had this problems myself when I was testing a small game I made and by actually preventing these many new objects inside the main loop I was able to speed up my game amazingly. Your output looks amazing so I really do wonder if it has nothing to do with my hardware or drivers and if it is Linux-related or not.

I’ll see if I can do a test on Linux.

I’ve been profiling the code for object allocations and found a few places where Integers and Strings were created in bigger counts per frame. I could eliminate a few. The next version will include the improvements, and I’ll keep an eye on it from now.

Maybe there is a link between sound not working on your system and the high CPU usage.

On principle, don’t instantiate anything, ever, inside your main loop. Create fields of the needed types, and reuse them.

If you ever plan to move to mobile, then the GC is a performance killer, and you have to prevent even the smallest instantiation. In particular, start optimizing by loops inside of your main loop / render /draw routines. Don’t use “foreach” loops in those places, for it instantiates an iterator on each loop cycle, and if there’s anything you can cache, do it. For instance, if you’re translating coordinates for isometric drawing, cache them after calculation, and only recalculate if the entity moves. Avoid string manipulations if you can, as well.

The mistake I made a lot was re-creating buffers (FloatBuffer or ByteBuffer) inside my main loop because I needed those as parameters for certain OpenGL calls like glLoadMatrixfv. What I did to change this was actually replacing all those public variables with getters and setters. And whenever I really had to change a position or matrix, I simply re-built the buffer in the setter method. This was a huge speedup for my project and prevented my game to lag less.

Now with more scary! Dungeons became dark …

@TheBoneJarmer: I’ve published a new version which produces less garbage. If this was a problem on your system, this version should run better:

https://sourceforge.net/projects/jewelhunt/files/r017/

You can find a first rainbow jewel in this version, the violet one, but since the temple map is not included yet, there is nowhere to bring it to …

I like isometric games :slight_smile:
And I especially like the look your masonry graphics, together with the lighting effects great mystic atmosphere!

Regarding the garbage collection: If you are using Eclipse, you can analyse the heap with DDMS. Some time ago when I used it… it helped me examining the garbage collection.

Do you use any frameworks/libraries for the isometric graphics?

I’m using LWJGL but no higher level frameworks. Isometric graphics are fairly easy, the axis transforms are like i = y-x and j = y+x, signs depend on the direction of the axes. The graphics are pre-rendered in the right angle and just positioned on screen.

I’m almost certain that garbage collection is not a problem, but on the other hand, I didn’t see any harm in spending some time on optimizing the code a bit further, when TheBoneJarmer said it would be a problem on his system (at the moment I think he was just guessing, because GC was a problem in one of his projects, but the real problem why jewelhunt ran badly on his system was something else). I’m using Netbeans and the builtin profiler.

I haven’t received any feedback yet though how the demo runs on a larger number of systems. On my two test systems it runs fine, so I can only assume it will do so for many others.

Makes me happy to hear that you like the atmosphere of the dungeon screens. I’m also quite pleased with the results of the light mapping.

Good to know. If things go well, maybe I will make an isometric game some day… :slight_smile:
Yea, unless it is a real problem, it’s not worth to spend too much time on it. Just try not to create big/many objects in the hotspots.
Keep up the good work!

At times I’m wondering if going 3D with rigged and animated models, but a fairly fixed viewpoint, so that it looks isometric, wouldn’t be superior. I believe it is, but one must learn a whole lot more to get that working. The approach with pre-rendered graphics which are only placed onscreen is easier, but limited. And prone to visibility glitches, e.g. parts of an object being visible when they shouldn’t.

One can work around it, but it is an ihnerent problem of this aproach, a problem that a “real” 3D solution doesn’t have.

Hey Varkas!

I just downloaded your demo again. It runs amazingly smooth right now. Nice job! I am still playing it while I’m writing this message because I do have some feedback:

  • When I click somewhere my character does not immediately respond. It always take a few seconds before it starts moving.
  • There are no close buttons for windows and clicking outside a window doesn’t close them right away.
  • The information window you see when you hover an item in your inventory sometimes remains active even when your mouse isn’t hovering it.

But so far I really like this! I too like isometric Role Playing Games. Or just these kind of Role Playing Games in general. Good ol’ times that is. Anyway, keep up the good work!

-TBJ

There still seem to be performance issues … the delay in the movement tells me. Pathfinding is done asynchronously. There is a queue for all pathfinding requests of all creatures on the map, and a thread is working through this queue. If you have to wait till your character moves, it means that the CPU was busy with something else meanwhile and the pathfinding took, well, quite a bit longer than on my test systems.

Can you give me some more specs of your system, CPU and ram? My development box has an Intel i7 CPU running at 3.4Ghz, 8 MB ram.

You can close the windows by pressing c and i (character sheet and inventory), that’s the official way, or by moving the mouse out of the windows towards the main window borders (e.g. to close the inventory, move the mouse out of it to the right). I’m lazy on clicking and was looking for a way to close the windows without a click, but it’s non-intuitive and there are no hints for this feature in the game.

Thanks for testing again :slight_smile:

Here you go. My system specs which were generated by the program hardinfo:


-Computer-
Processor		: 4x Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
Memory		: 3969MB (2154MB used)
Operating System		: Ubuntu 14.04.3 LTS
User Name		: YoMammaIsSoFatSheNeedsABeltAsLongAsTheHorizon
Date/Time		: za 26 sep 2015 16:59:04 CEST
-Display-
Resolution		: 1600x900 pixels
OpenGL Renderer		: Mesa DRI Intel(R) Haswell Mobile 
X11 Vendor		: The X.Org Foundation
-Multimedia-
Audio Adapter		: HDA-Intel - HDA Intel HDMI
Audio Adapter		: HDA-Intel - HDA Intel PCH
-Input Devices-
 Lid Switch
 Power Button
 Sleep Button
 Power Button
 AT Translated Set 2 keyboard
 ETPS/2 Elantech Touchpad
   USB Keyboard
   USB Keyboard
 RAPOO RAPOO 5G Wireless Device
 RAPOO RAPOO 5G Wireless Device
 Acer WMI hotkeys
 Acer BMA150 accelerometer
 HD WebCam
 Video Bus
 HDA Intel HDMI HDMI/DP,pcm		: 8=
 HDA Intel HDMI HDMI/DP,pcm		: 7=
 HDA Intel HDMI HDMI/DP,pcm		: 3=
 HDA Intel PCH Headphone
-Printers-
No printers found
-SCSI Disks-
ATA WDC WD5000LPVX-2

Yeah sorry for the unnecessary stuff. The report generator includes them and I’m to lazy to sort it out right now. Hope this helps! D:

-TBJ

Thanks for postingn the specs. That helps to get an idea what I need to aim for. Actually I’ve been thinking, until I’m done with the project, quite poewerful computers will be standard, and I can be lazy on optimizing the code ::slight_smile:

Edit:

To minimize the delay until the PC starts moving I’m now using a thread pool instead of creating a new thread for each pathfinding job. Doesn’t make a difference on my system, but I hope that on slower systems it will help, since the overhead of creating a new thread each time the PC moves is gone.

The other news is that I’ve started to implement item sockets, like Diablo II had them. So one can use runes, gems and jewels to enhance the items.

I’m wondering if I should adopt “Path of Exile” system of typed sockets. It has three socket types, and gems only fit into matching sockets. Also sockets can be linked, so that one gem can affect the working of another gem in a linked socket.

At the moment my thinking is to use untyped sockets (like D2) and links (like PoE). This avoids some of the annoying “good item, but wrong socket types for my gems” problems and still allows the feature of two gems working together via a socket link.

Edit 2:

Wall mounted torches are something fine … and these don’t even stain the walls!

I’ve published a new development snapshot:

https://sourceforge.net/projects/jewelhunt/files/jewelhunt/r019/

Changes since v0.18:

  • Improved visual feedback in combat.
  • Fixed ‘undying’ invisible enemy bug.
  • Added shadow effect for player character.
  • Added wall mounted torches with a light effect.
  • Changed pathfinding to use a thread pool instead of creating new thread instances for each path.
  • Added frost nova spell effect.
  • Added magic rod graphics and item data. They have no function yet, even if you might find one.
  • Added a first draft of the rainbow temple map.
  • Improved temple graphics.