Isometric 3D / 2.5D game related questions

Hello,

I’ve begun to play with the HUD wiki tutorial and the Joystick controller in order to display an isometric 3D sprite

with walking/standing animation.



The prototype works fine:











…however I’ve got some questions for the next steps:



1/ About framerate, I guess I can’t get fixed framerate. My main class extends SimpleGame but and I’ve added some

code (found in FixedFramerateGame) but the way the BaseGame handles the main loop prevents it. Would it be possible

to create a FixedFramerateSimpleGame class in the jME framework or such a feature already exists?



2/ Now, I want to handle more complex stuffs: jumping, using sword, the two lasts together, and object carrying while standing or walking.

I’ve read that Finite State Machine are good to handle this, what do you think?

If yes, is there some [standardized | formalized] code existed in jME to handle sprite animation through Finite State Machine?



3/ About physics, I guess I’ve got even more questions:



    3.1/ Concerning collisions in an isometric world, how would you do it? Using “virtual” bounding box to give volume to the 2D sprites?

          Note: the sprites as well as the background are 2D sprites or tiles.



    3.2/ What about the gravity? Is jMe-Physics adapted even for 2.5D games?



    3.3/ Must I maintain a Z coordinate for my Hud so that it will walk on the ground?



4/ And more generally, is jME the good choice for isometric 3D games? Are some things planned to handle this type of game?





Thank you in advance for your lights!

Niggle


as i mentioned in another thread, the main problem with 2d sprites would be accurate 2d collision detection

though, for most isometric games simple circle(radius) collision is enough

Sounds absolutely possible. And sounds like you should use ortho 3D (parallel perspective camera) not 2D (ortho queue). The trickiest thing are the sprite animations but you seem to have got them already.

1/ sure that’s possible. I remeber darkfrog saying something about making one… darkfrog?

2/ there is no FSM code in jME afaik. But it’s really simple to make one yourself when your triggers aren’t that complex.

3/ jME Physics is for 3D physics only (does not matter if isometric or not, of course). You could still use it as you can ‘approximate’ 2D with 3D shapes that stick at the same z position. But you may want to use a 2D physics engine (e.g. foundational physics) if your sprites are all in the same plane.

4/ of course jME is fine for 3D isometric games. This does not mean you have to use sprites, though. I think sprite support is somewhat rudimentary…

irrisor said:

1/ sure that's possible. I remeber darkfrog saying something about making one... darkfrog?


Great, that's cool news  XD !!!

irrisor said:

2/ there is no FSM code in jME afaik. But it's really simple to make one yourself when your triggers aren't that complex.


I found this one: http://unimod.sourceforge.net/fsm-framework.html, does someone know it?

irrisor said:

3/ jME Physics is for 3D physics only (does not matter if isometric or not, of course). You could still use it as you can 'approximate' 2D with 3D shapes that stick at the same z position. But you may want to use a 2D physics engine (e.g. foundational physics) if your sprites are all in the same plane.


I'll look at this, but I don't understand what you mean by "if your sprites are all in the same plane", could you explain?
Note: my sprites are in the same plane because they are huds too *but* their boundingbox have three dimensions.

irrisor said:

4/ of course jME is fine for 3D isometric games. This does not mean you have to use sprites, though. I think sprite support is somewhat rudimentary...


Wow, I have good results (for now), what do you mean by "somewhat rudimentary"? Performance or API?  :?

Anyway thanks for your comments!  :)
Niggle
  1. if your sprites only move in two axis, x/z and their y-axis position is allways 0 for example, then you can treat the simulation as 2d(if you don't need them to be able to jump and land on top of each other…


  2. i think he refers to the api…
MrCoder said:

3. if your sprites only move in two axis, x/z and their y-axis position is allways 0 for example, then you can treat the simulation as 2d(if you don't need them to be able to jump and land on top of each other...


The player sprite can walk in 4 directions and can also jump or fall on higher or lower ground level.
The player sprite (Quad) position is fixed in the center of the screen and all others entities (enemies, terrain, objects) move.

Well in fact following is what I think:
- Regarding what I have: images that represent Sprites and Terrain (diamond tiles)
- Regarding what I want: be able to easily handle z-ordering, collisions and physics (jME-Physics) and maybe particle and light effects (like in a pure 3D world)  :D

Would it be possible to use jME to:

a/ display using Quad in ortho mode the sprites and tiles (so in a plan)
b/ handle the 3D notions (for z-order, collisions and physics) with Bounding Volumes?

Since I'm new to jME, I certainly miss something but would it be possible (extending Spatial?) ?  :?

Note: I'm aware that the mapping of tiles with Volumes might not be accurate.

Sorry if what I say looks like confusing 

i suppose that depends on the form and the size of the sprite. the bigger the sprite, the worse the circle collision accuracy.

Im interested in how you made the animations work correctly. Making a 2d sprite walk… I'd have no clue how to achieve something like that. I'd guess for each second you press a button you move X spaces into the direction and change animation together with it. (Swithing thru 14 animations per tile-step for instance).



Someone also mentioned each would need to have a node?

That way you can attach properties to the node (Walkable/nonwalkable etc.) and wheter you stand on a tile you can fetch all the needed data.



Finally, using for instance real 2d (with the HUD and stuff), will that use OpenGL as well? In other words, do you need a 3d card to run it or do you basically need a 3d card for everything you use jME with?



Thanks!

(hope i didnt hijack the topic)

I need a plugin that notifies me when my name is mentioned in a thread…I have a tendency to just skip these days, so apologies for the late reply. :-p



I had done some work on this, but never prepared it for inclusion into jME.  I'll try to get some time to look into it soon…can you add an issue on the issue tracker for me so I don't forget?  (as much as that has helped with the sound features…hehe)



darkfrog

But Darkfrog, you should already know by now that we're always talking about you! :stuck_out_tongue:

@darkfrog: i hope you never get that plugin as there is a special, hidden forum section called "Complaints about darkfrog".  :evil:



@darklord:

i don't know if you have to do X animation steps per tile but you surely have to rather correlate animation with movement speed. if you define something like a SpriteAnimation object which defines an animation (sprites and their order) you could also attach the movement speed to that animation object if you don't want your sprite to to move arround unrealistically. of course would apply only to sprites who move arround.



and of course all graphics you do with jme use opengl (2D or 3D - they are just rendered/projected a bit differently).

hehe, well, sfera it would be nice to know where to find it as I often have complaints myself. :-p



darkfrog

MrCoder said:

though, for most isometric games simple circle(radius) collision is enough


sfera said:

i suppose that depends on the form and the size of the sprite. the bigger the sprite, the worse the circle collision accuracy.


The sprites are really small not bigger than 96x96 and fit in a box.
darkfrog said:

I had done some work on this, but never prepared it for inclusion into jME.  I'll try to get some time to look into it soon....can you add an issue on the issue tracker for me so I don't forget?  (as much as that has helped with the sound features....hehe)


Issue 218 https://jme.dev.java.net/issues/show_bug.cgi?id=218  :D

However, I didn't find your nickname to assign the issue to you.

Thanks again!
Darklord said:

Im interested in how you made the animations work correctly. Making a 2d sprite walk... I'd have no clue how to achieve something like that. I'd guess for each second you press a button you move X spaces into the direction and change animation together with it. (Swithing thru 14 animations per tile-step for instance).


For example, for the action walking in the south-west direction, I simply created the different frames as individual gif.
I then used a filename convention to order the frames and tell how many time the frame will be displayed i.e.:
- sw-walking-0-64.gif      <-- here, it is the first frame of the animation which contains 64 frames before cycling (0 to 63), this frame is displayed during 7 animation ticks
- sw-walking-8.gif          <-- here is the second frame which is displayed at the 8th tick and for 10 ticks
- sw-walking-17.gif
- sw-walking-25.gif
- sw-walking-32.gif
- sw-walking-41.gif
- sw-walking-49.gif
- sw-walking-56.gif    <-- last frame before cycling to frame 0 once the 63rd tick is reached


- sw-jumping-0-24.gif
- sw-jumping-12.gif

- sw-standing.gif

I also use the joystick controller and an InputAction to handle direction changing as well as standing / walking action.
While I press the left, right, up or down button, the sprite is walking and I maintain a counter for animation ticks reset to 0 whenever
the direction changes or I stop to push the buttons.

Now internally, I create (currently) a big texture (512x512) with all the frames (which you can see in the first message) and I modify texture coordinates
to display the right frame at the right time.  :)

The prototype is free though not really distributable yet.  :wink:

As stated above, the sprite don't move, it is all the other objects (terrain, enemies...) that move; it adds more dynamic and I also find it great!

Darklord said:

Someone also mentioned each would need to have a node?
That way you can attach properties to the node (Walkable/nonwalkable etc.) and wheter you stand on a tile you can fetch all the needed data.


Hmmm, in this game, the sprite can be on 4 tiles at the same time, to say that the movements are really free. Since I find I'm not really clear,
I'll tell that I can move of say 1/4 of a tile in the 4 directions (NW, NE, SE, SW) at a time.  :-o

Darklord said:

Thanks!
(hope i didnt hijack the topic)


No your comments are interesting  :)

Press F2 in a SimpleGame. Look in the SimpleGame and super classes how this is done.

ORTHO places items in 2D Ortho mode, where there is no camera, and translation is used for screen coordinates (pixels).



If you use the ortho projection on the camera, you can have a normal 3D scene, but without perspective drawing. That means, no matter how far objects are from the camera, their size stays the same. For this mode, do not use the QUEUE_ORTHO, just use the QUEUE_TRANSPARANT and QUEUE_OPAQUE.

llama said:

ORTHO places items in 2D Ortho mode, where there is no camera, and translation is used for screen coordinates (pixels).

If you use the ortho projection on the camera, you can have a normal 3D scene, but without perspective drawing. That means, no matter how far objects are from the camera, their size stays the same. For this mode, do not use the QUEUE_ORTHO, just use the QUEUE_TRANSPARANT and QUEUE_OPAQUE.


Well for this case I just can't stop setting my tile object to ORTHO since my tiles are in a "already 3D rendered state":



So I've got to place them just like in 2D mode. Now, is there a way to move them when I modify the local translation of my camera node?  :?

If I try to update the 2D iso with setLocalTranslation, then I can manage it to do want I want (2D coordinates doing like in 3D parallel mode) but
then my BoundingVolume act strangely :cry: