WIP: Tank game – Contest Entry

Post the code you use to load the model…

I just used this

[java]

Spatial mesh;

public Tank(String id) {

this.id=id;

this.health=1;

this.movementSpeed=1;

initListener();

<strong>mesh=asset.loadModel("model/tank.mesh.xml");</strong>

if (id.equals("p1")) {

mesh.setLocalTranslation(-10, 0, 0);

}

else{

mesh.setLocalTranslation(10, 0, 0);

}

mesh.addControl(new Controller(this));

initPhysicsControl();

}//end of constructor

[/java]

of course without those strong thing

cant edit that post anymore…

little update



and here is the runable jar file

http://199.91.153.47/sfhtf2bil7rg/pr1cu460cjjgoin/STG.jar



red blocks there are suppose to be wall, just dont have time to make them yet, so i just load some red cube.



problems :

bullet can fly through wall.

bullet can fly through bullet

tanks can run through tanks



tried physicscollision listener but didnt success, still need to try a lot.

so far is the progress 0.15% done ^^

time to go and play games to find solutions

1 Like

Looking better. What OS are you using?

I use Linux, but I think that jar file can run on win and mac too

did you get any problem with running it ?

if you want i can test it on win

No no, I just liked the theme :wink: It should run on all Operating Systems with Java.

Your physics spatials aren’t colliding at all? How are you moving them? And what controls and kinda collision shapes are you using?

@memonick said:
No no, I just liked the theme ;) It should run on all Operating Systems with Java.


Not quite ;). There have to be LWJGL builds available for the architecture? Besides the big three you can get to Solaris by default.

Btw it looks he isn’t applying “smooth” to him models in blender. The tanks and everything are flat shaded.

@sbook, I didn’t understand the last part :confused:

I think sbook thought the game is being developed in solaris.

All shall be explained



Java Native Interface - Wikipedia


@glaucomardano said:
I think sbook thought the game is being developed in solaris.


I was explaining to Nick that it can't really run on every platform that supports Java because of the native library dependency

Hmmm.

well the models are just rat labors, just they are all half ass made. I dont remember if i smooth them in blender or not, i think i didnt do it



the tanks are all character control, moved with setwalk and setview

wall- the red things in middle are rigidbody, static i think(mass 0 , no kinematic mentioned)

bullets are rigid and kinematic (mass>0 & kinematic = true) moved with setlocaltranslation(quite bad, but setphysicslocation somehow doesnt work, or i messed somewhere up)



all above are if I remember well ^^



I already have idea how to detect collision for tank vs tank, just have to make some test and try



the other 2 are real problem and i might not get them to work before deadline, may be I will have to retreat from contest soon ^^

@memonick

with theme you mean the white title bar ?

and can you edit my first post ?

I wanted to add this

WASD - control for player 1

arrows -control for player 2

space = fire for player 1

o = fire for player 2



I just cant edit any posts and may be you can do it for me as moderator ^^

bullets are rigid and kinematic (mass>0 & kinematic = true) moved with setlocaltranslation(quite bad, but setphysicslocation somehow doesnt work, or i messed somewhere up)


Fact. setPhysicsLocation() doesn't work because it's a kinematic rigid body. Why did you make the bullets kinematics?
About the tanks, maybe you didn't setup their character controls right, it's a bit hard. And what kinda collision shapes are u using for the tanks and walls and bullets? Make sure the collision shapes are setup properly, you can enable debug shapes in physics space so you can debug them.

well it was long time ago, some days may be, i made some testcase to check which one i should use, charactercontrol,kinematic or dynamic and so on

I think i wanted to use dynamic(mass>0&kinematic=false) on bullet, but whenever the bullet is added to scene it stay in a place and doesnt fly as I wanted at all.

I used this in update and it doesnt work,

bulletRigid.setPhysicsLocation(bulletRigid.getPhysicsLocation().add(direction));



the tank uses boxcollision

floor is also box or factor, may be box

bullet … yeah also box

the border around floor is factor



so why kinematic on bullet ? I dont know

do you know something better than kinematic?

Normen did testcases for both cases a long time ago, if you take a look at the TestWalkCycleAnim you’ll see a model character controlled with a capsule collision shape who collides with things properly. And for the bullets and walls, you can take a look at the TestBrickWall.

i think i took a look at them before, but I will give them a try again. may be I can find something interesting there.

thanks