Author Topic: Thinking about some RPG..Android version.  (Read 110026 times)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Thinking about some RPG..Android version.
« Reply #15 on: December 29, 2011, 12:08:29 am »
I wasn't really satisfied with the performance in motion...while it was fine when standing still, it suffered greatly from moving. My first thought was that this was caused by the additional collision detection that takes place in that case, so i optimized that part of jPCT-AE some more. This wasn't totally pointless and it improved the engine's overall performance...but for this problem, it didn't really help.
I then realized that the performance drop came from the visibility detection for trees and bushes...and that's something that happens inside the game, not the engine. A part of this process uses Math.acos()...which is slow, so i replaced it with some approximation...which was fine, but didn't really help either... :(
I then tweaked the method that does the actual visibility checks (some simple distance and angle checks, but done for thousands of entities per frame) to death. That finally helped. I reduced the time spend in this method from around ~25ms to ~10ms per frame just by doing a lot of micro optimizations. The code now looks like as if somebody has puked java keywords...but it's fast.
So...as much as the Dalvik VM has improved over time, it's still very keen on micro optimizations.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Thinking about some RPG..Android version.
« Reply #16 on: December 30, 2011, 12:33:06 am »
He's walking!



Currently, he walks around in a radius of 8000 units around his spawn point. He chooses a random target and gets there using some tweaked A* heuristic. Once he reached the target, he idles for a few seconds and then chooses a new target. He follows the terrain (to a degree....) by using a 800*800 heightmap with linear interpolation between the cells and some additional interpolation based on it's last position...the result isn't perfect but acceptable. He is able to avoid trees and houses because the heightmap reserves one bit for marking obstacles (yes...that's hacky, but it saves memory on Android...). When not in view, he doesn't move at all (which has to be changed to a degree, because otherwise, you could abuse it).

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Thinking about some RPG..Android version.
« Reply #17 on: December 30, 2011, 01:51:18 pm »
21 fps is not much. Have you divided the surface into multiple parts? Maybe it can help with collision and rendering. But game look nice, I look forward to some testing version :)

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Thinking about some RPG..Android version.
« Reply #18 on: December 30, 2011, 09:26:05 pm »
Actually, i think 21 fps is pretty good for what it does. In fact, it's higher than i expected it to run at. The terrain consists of around 6300 triangles. I'm using an octree for collision detection (without it, performance is around 10 fps instead) but not for rendering, because it's usually faster to render everything in one draw call even if only a small part is actually visible than to split the geometry into pieces (like the leafs of an octree) and use multiple draw calls after determining which parts are actually visible. The additional overhead is higher than letting the gpu decide in most cases...at least in this one. The terrain uses four texture layers blended by a custom shader, the visibility processing for bushes, trees and houses has to be done, which means that around 8000 entities have to be processed (more or less...) each frame, the animation takes it share as well as the A* implementation and finally, all trees, bushes and the smoke from the chimneys are all animated...i think that 21 fps is pretty good for all this. At least, i haven't seen anything like that done in an RPG on Android. Stuff like Earth and Legend looks great, but it's world is divided into small sections and each of them is extremely limited in size...not comparable to the open world that you have here...
My goal is to make it playable on a Galaxy S class device...i don't expect it to run well on less powerful devices. I don't think that i'll finish this before the end of next year...
« Last Edit: December 30, 2011, 09:30:33 pm by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Thinking about some RPG..Android version.
« Reply #19 on: January 04, 2012, 12:17:59 am »
Added foot steps and random bird sounds as well a rough day/night transition. I've also fixed a misconfiguration of the lens flare, which reduced performance somewhat.

This is in bright day light...



...and this at night...


Offline Hrolf

  • int
  • **
  • Posts: 84
    • View Profile
Re: Thinking about some RPG..Android version.
« Reply #20 on: January 04, 2012, 04:14:37 am »
Very nice! Any thoughts on game-play?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Thinking about some RPG..Android version.
« Reply #21 on: January 04, 2012, 10:30:59 pm »
Very nice! Any thoughts on game-play?
Or in others words: Why am i focusing so much on technical things and not on the actual game? Well...that's because i'm still not sure how much content i can stuff into the device and that actually defines how far i can go gameplay wise. Before starting with the actual game, i want to be sure that the device can handle it.
ATM, i'm planning to revive the fantasy world that i created for my Amiga RPG twenty years ago...it was nothing special, just some AD&D inspired world with a dozen enemy types (i don't think that i can bring them all back here...), lots of dungeons (i still have to find a way to create dungeons that look good enough but are easy to make) and some quests as well as a main story line. Unlike in todays RPGS, the main story wasn't backed up by quests but it developed itself through hints you found and people you met on your journey through the dungeons and cities. I still like this idea, so maybe i'll do it this way again.
For inspiration, i played various other Android 3D RPGs, especially Realms of Fortune and Earth and Legend. While the latter has nice very graphics and effects, it's actually a bad RPG. It has a pointless story about some elementals that you have to free for whatever reason, stupid quests, static enemies, lots of grinding and the world is devided into very small sections.
Realms of Fortunes looks worse and has no real story at all as well as a random world. Personally, i don't like RPGS that have no story or purpose other than leveling up. But regardless of this, it pays attention to detail and is the far superior game compared to Earth and Legend...but the controls suck IMHO.
I'm currently planning to do it better... ;)
« Last Edit: January 05, 2012, 08:12:23 am by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Thinking about some RPG..Android version.
« Reply #22 on: January 05, 2012, 11:40:31 pm »
I made a little video that shows the current state: http://www.youtube.com/watch?v=_vesmHaDCow

Offline Thomas.

  • double
  • *****
  • Posts: 833
    • View Profile
Re: Thinking about some RPG..Android version.
« Reply #23 on: January 06, 2012, 12:46:02 am »
I like day and night transition, tree and shrub animation, it is smooth and nice :) And actually everything is nice, I look forward to some more screens and videos :)

Offline Hrolf

  • int
  • **
  • Posts: 84
    • View Profile
Re: Thinking about some RPG..Android version.
« Reply #24 on: January 06, 2012, 06:24:23 pm »
That does look good! Very smooth indeed.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Thinking about some RPG..Android version.
« Reply #25 on: January 08, 2012, 11:57:55 pm »
City walls...currently, you can't enter the "city", because there's no gate or gap in the wall... ;) And the collision detection makes you jump onto the walls sometimes...anyway, here they are:



Note: I just wanted to point out again that almost all artwork is ripped or used with permission. None of it is considered to be final...i'm just using it as a placeholder for the real thing...
« Last Edit: January 09, 2012, 04:11:32 am by EgonOlsen »

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Thinking about some RPG..Android version.
« Reply #26 on: January 09, 2012, 10:36:18 pm »
Leaving town...for this, i had to rework the gate-model in a way that it has open doors instead of either closed or crushes ones. I used DeleD as an editor, which was simple enough to use for me. Sadly, the door case of this gate has no top and i wasn't able to add one with my limited skill set...but it's all just placeholder art anyway, so...



...and back again...

« Last Edit: January 09, 2012, 10:57:44 pm by EgonOlsen »

Offline Bryan

  • byte
  • *
  • Posts: 26
    • View Profile
Re: Thinking about some RPG..Android version.
« Reply #27 on: January 10, 2012, 02:50:32 am »
The progress on this is really looking good man.

What are you using for modelling?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Thinking about some RPG..Android version.
« Reply #28 on: January 10, 2012, 09:41:40 am »
What are you using for modelling?
Actually nothing. As said, most meshes are either from the public domain or used with permission. I consider them to be placeholders and if the game is finally done, i'll go and see where to get proper models from. If i have to edit something (like i did with the gate mesh), i'm using this: http://www.delgine.com/...it's simple enough to use. You can't do everything in it, but you can start working after 5min...you don't have to recover 5 weeks from the first shock like with Blender.

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11770
    • View Profile
    • http://www.jpct.net
Re: Thinking about some RPG..Android version.
« Reply #29 on: January 11, 2012, 01:54:49 pm »
Added fences to enclose areas where a stone wall isn't appropriate: