General Starter Questions

Sorry,am a total noob at JME and 3D stuff in general but slowly learning. 

Started my first jme game about 4 nights ago, a platform Super Mario type game for a JGO contest.  Have a few starter questions to get going.  Got til end of Month to complete… (Optimistic I know).  Really just using this as an excuse to get started with JME to move onto more advanced stuff.







If any1 can help on any of the below would appreciate it, have tried searching the forums + sample code but still a bit stuck…


  1. Firstly, to move the character I am using cam.setLocation… Am not sure if this is the best/only way for movement… I cannot work out how to increase the speed  (I can of course just move the cam by greater intervals but this can make the animation a bit choppy).


  2. Input… How do I disable the Mouse from working? And how can I use the cursor keys for movement… Am currently using KeyBindingManager, but when I try and use the cursor keys, it just uses JMEs default movement (works ok if I use non-default JME keys)…


  3. For textures is there sample code/methods to import spritesheets?  And do I have to create a seperate TextureState for each texture, or can I use 1 TextureState for multiple textures.  I have loads of textures so want to simplify/optimize the whole process. 


  4. Minor thing, on some (but not all) of my textures I get flashing horizontal/vertical lines when I move (see the black arrow in the image)… I have seen this before a few times (and in MWorld too)… I checked my images for transparency and am sure they are ok, anyideas what causes this.


  5. Having a problem with collision detection.  I used BoundingCollisionResults as in the TestCollision example.  When Mario collides with wall the CollisionResults.getNumber increases from 408 to 409/410 so its kind of working (dont know what these numbers mean tho)…  However this collision detection doesnt help in preventing him from walking into walls as I need to test that if he moves left say, the resulting movement would NOT result in a collision…  Hope its clear what I mean here,  any ideas how to do this? (was thinking of doing my own collision detection using my 2x2 array but this would be a overkill )…



    Anyway, thanks in advance, apologies if questions seem basic.  Sorry for posting in General section but didnt want to create 4 different posts in different categories…

    SteveyO
  1. Are you extending SimpleGame? Make sure you remove the default controls first… or move away from SimpleGame altogether (there's a tutorial about this in FlagRush)


  2. Not sure what you mean with a spritesheet, but I'm sure someone else will… as for 3, yes you need a new TextureState for each different combination of textures (don't worry too much about this, they are pretty cheap). You can however reuse the same TextureState for different objects, as long as they use the same textures.


  3. Hm, haven't seen this before. Make sure no texture compression is used (Image.GUESS_FORMAT_NO_S3TC instead of Image.GUESS if you're using this anywhere), and make sure the the "far" plane of the camera is not needlessly far away.


  4. What kind of boundings are you using? Sphere or BoundingBox? If you use SimpleGame you can press B to visualize the boundings. I think normally for a platformer you'd write your own collision system, but since you're short on time jME's should be able to do the job. getNumber is supposed to return the number of Collision so… not sure what's going on there…

Thanks for your reply…

2)  Yes, am extending simple game.  Just couldnt work out how to remove the default controls,  will give flagrush a try later to see if this helps.

3)  For a spritesheet I mean instead of having seperate files for each image to combine them all into 1 image file.  And then when importing the textures you specify the width/height of the texture and the importer would put all the images into an array of textures (or something like that).  Probably more common for 2D engines tho.

4) Seen quite a few times,  will mess about with this to try and isolate when/how it happens.

5) Am using Bounding Box.  Have figured out my getLength problem last night, was due to Nodes. I now have all my level objects in 1 node and my mario character in a sperate node.  getLength now works a treat (returns 0 and 1 for collission), getting close…  It occured to me late last night that I can possibly solve my problem by moving my Bounding Box (i.e. if the player moves left, then move the bounding box left and then check if its a collision)… Will give a try tonight when home, not sure if possible.

Thnx again.

Still struggling with point 1) if any one can help.

I know its a bit basic but need to understand the speed thingy (as it is impacting my collission detection)…  One of the 1st things that struck me when I started looking at JME is that the default keys WASD move really slowly but the mouse rotation moves really quickly… Why is this case?  Maybe am missing something obvious.

Thanks

  1. You just mean the speed at which there is movement when you press a key? That's controlled by the action you've created for that (and I don't know which type you are using)


  2. you can do this by loading the texture as many times as you need it (when you use TextureManager for this, the data will be cached so it'll load quickly), and then setting a different scale and translation for each texture.

1)  Yep mean movement speed.  What I have now is in my SimpleUpdate method I am setting the cam.location(new Vector3f(…)) based on the position of my Mario Sprite (Quad) which is always centered. 

When mario is moved left or right I am using the quad.setLocalTranslation(new Vector3f(…)) method to move him (and I set my cam.lociiton accordingly)…  Currently when I want to speed mario up I am just increasing the X-Value in my setLocalTranslation… 

Think I need to understand the engine a bit better… Thanks anyway.