Jump to content

Please, take a look at my simple Aircraft Shooting Game


DellaFree
 Share

Recommended Posts

Hi guys! The puzzle is completed. Here is the final result of my small and simple project (for my university exam) : http://www.babylonjs-playground.com/#6FFQW#16.
As you can see, it very very simple; you are an aircraft and you should fire at the ships, before they reach the island and start to fire to the tower where is the poor dude. It was the best I could do. There are some things that are not completed yet (the TODO in the code), for example the minimap and the fire system of the aircraft (as you can see, it very difficult to fire to a ships, you should do a bit of practise XD).
These are the main things that I try to adjust (especially the fire system; I'm spending a lots of time on it without any success), but I think that with your help
(if you want) I will find a quickly and working solution :D .
So,having said that, what do you think about that? Please be honest and feel free to give any suggestions or criticisms :D I will appreciate a lot.
Also feel free to modify , add , cancel what you want to make it better :D
I would say thank you for all guys, for all the help and time you have spent answering my questions. This forum it simply amazing :D
 

Link to comment
Share on other sites

Lookin' fantastic, DF!  You should be proud.  You have certainly come a long ways in a short time!  Well done. 

 

I think this is the first time I have ever seen our water shader happening in the playground.  Cool! 

 

I see a little bit of z-fighting (tearing/sparklies) on the ground/water (in firefox) that seems to get worse as time goes-on.  Mostly seen during higher altitude steep banking. 

 

But, I had a few of Jerome's lathe demos running at the time, and Blender, and a few hundred other windows open, so those things could be factors.  Z-fighting sometimes happens when two (un-merged?) meshes overlap each other, position-wise.

Link to comment
Share on other sites

Great job! Looks really cool and is fun to play. :D

 

Maybe you could simply increase the size of the island and the ships. So it will be easier to hit them even if the targeting is not perfect yet. I remember you those flight demos in the other thread and I thought the last version worked a bit better. Right now it seems like it always shoots higher than I aim. I always crash on the ground when trying to too hard to hit a ship :P

 

I really like that simple style of the plane and the ships. The island and the tower somehow have a different style (less simplistic). Maybe you could even that out, decide if you want a more realistic or more simplistic look and then stick with one style. But that's just styling and can always be changed in the end.

 

Keep going and keep us updated, you got an awesome and very fun game there, I think :)

Link to comment
Share on other sites

Hi guys :D thanks for the replies :D I appreciate a lot :D

So for what concern the z-fighting I adjust a little making the heightMap ground lowest than before (y=-2.5, instead the extraground is y=-2).

For what concern the fire system, iiceman, I think you refer to this http://www.babylonjs-playground.com/#6FFQW#20  (1); in this case I don't apply any physics to the bullet fired by the aircfraft.

also I modify the circle position (cyrcle.position.y = aricraft.position.y + 6 where 6 is camera.heightOffset = 6 ), and I make the cyrcle bigger;

Then this is the same version, but with the applyImpulse : http://www.babylonjs-playground.com/#6FFQW#21 (2) . Does it look better? If you have any idea on how make it better , I will appreciate a lot :D Any idea about the minimap ?

Realy many thanks again for all these suggestions :D

 

 

Edit : I made also the ships a little bigger : http://www.babylonjs-playground.com/#6FFQW#24

Link to comment
Share on other sites

#24 plays very well I think. Made it to level 3 then I crashed on purpose just to see what happens if I hit the tower ;)

 

I played around with some particle effects when hitting things: http://localhost/babylondev/space/ http://p215008.mittwaldserver.info/space/

 

It's just extra fancy stuff, but might look cool to do something like that when the bullets hit the water? :P

Link to comment
Share on other sites

Hi everybody :D Thanks iiceman for the suggest ! I change a little the scene : I've remove the water because the PG is too big and I can't save, substituted the ships with some purple tunks and  added sprites effect (very simple) when an element is destroyed. Here what I've done : http://www.babylonjs-playground.com/#6FFQW#31 but I'm not able to fix the minimap yet :( I followed the varius tutorial (the code is the same), but nothing.

Also I notice that sometimes, opening the console, I get the error : "t is undefined".

Because there are many things to load, is there a way to start the scene only when all is loaded ?

Many thanks guys.

cheers

Link to comment
Share on other sites

Hi everybody !! I 'm trying to add some more features, and in particular I would add some multi materials to the island; here what I've done (only island): http://www.babylonjs-playground.com/#2JBXHX  . I read the various tutorials (for example : http://blogs.msdn.com/b/eternalcoding/archive/2013/07/10/babylon-js-using-multi-materials.aspx) but when I call the function ground.getTotalVertices();  the result is 0. Any idea on why this happens?

Link to comment
Share on other sites

Hey,

 

you encountered the classical javascript async problem - you are trying to get the vertices before they are actually calculated. Creatd a ground using a height map actually downloads an images, processes the ground object and only then will the vertices be available.

To solve this use the onReady function of the create function - http://www.babylonjs-playground.com/#2JBXHX#2

Now it is all about playing with the numbers to fit the information (you ned the number of indices as well, to show the entire object using multi materials).

Link to comment
Share on other sites

Great :D many thanks RaanaW :D Really you helped me a lot !!!

I'm testing again and again this scene, but not on the playground just locally and I noticed that on Chrome and Firefox there is no problem, but using Explorer the scene crashes a lot (more or less 10 Fps , instead chrome and firefox about 55-60).; also on exporer I get an error like this ''Uncaught TypeError: Cannot read property 'animations' of undefined", instead on firefox I get this error "t is not definied".

I think that the problem is related to this peace of code :

function startAnimationWithDelay(k) {        setTimeout(function () {            scene.beginAnimation(ships[k], 0, speedShips, true);        }, Math.floor(Math.random() * 5000));        k++;        if (k < ships.length) {            startAnimationWithDelay(k);        }    }    //startAnimationWithDelay(0); //using 0 one ship does not move	    startAnimationWithDelay(-1);	

I'm trying to download the scen from the PG to test and find out what is the problem , but I encountered some problems with the get .zip" function : ( Yes today is the day of problems . Any idea on what it could be the causes of this?

Many thanks again guys

Link to comment
Share on other sites

  • 2 weeks later...

Hi guys!

Sorry for my absence, but I have to study other subjects :( But now I'm come back to babylon :D

I try to find a solution for the previous probem and for what concern the error related to the animation, I "resolved" removing the previous peace of code and replace with this line

scene.beginAnimation(ship, 0, (Math.floor(Math.random() * (speedShips - 100 + 1)) + 100), true);

so the ships have different speed and the effect it's similar. But I have not solved the problem related to IE and I don't know how to show you the problem. The same scene works fine on Firefox ,chrome and opera, but on IE it has a very low FPS (more or less 10). Have any idea on how I can show you this problem? I tried to downlod the scene, but I failed. Also I notice that removing the heightmap all works fine even in IE.

Edit:

I make a little progress finding the solution. The peace of code that cause the low FPS on IE is this :

ships.forEach(function (ship) {            var shipLookout = ship.position.clone();            shipLookout.y = 7;            var direction = ground.position.subtract(shipLookout);            var offset = direction.clone().normalize().scale(5);            var rayOrigin = shipLookout.add(offset);            var ray = new BABYLON.Ray(rayOrigin, direction);            var pickResult = scene.pickWithRay(ray);            if (pickResult.hit && pickResult.pickedMesh == ground) {                if (pickResult.distance <= 50) {                                      var animatable = scene.getAnimatableByTarget(ship);                    if (animatable) {                                            animatable.stop();			shootBullet(ship, tower, scene);                    }                } else {                    //do nothing                }            }        });

I tried to find the "problem" (I don know if it's really this the problem) commenting the line one by one...and try to comment these line the scene does not has low FPS:

var pickResult = scene.pickWithRay(ray);            if (pickResult.hit && pickResult.pickedMesh == ground) {                if (pickResult.distance <= 50) {                                      var animatable = scene.getAnimatableByTarget(ship);                    if (animatable) {                                            animatable.stop();			shootBullet(ship, tower, scene);                    }                } else {                    //do nothing                }            }

But in this way the ships don't stop when they reach the island.

Before, removing the heigthMap, I don't have this problem, because the ground don not exist, so the problem is not the heightMap but this peace of code (only on IE).

So, at this point, have any idea on how to fix my problem?

Many thanks guys, and sorry for the amount of questions

 

p.s

I opened another topic.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...