DellaFree Posted August 9, 2015 Share Posted August 9, 2015 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 .So,having said that, what do you think about that? Please be honest and feel free to give any suggestions or criticisms I will appreciate a lot.Also feel free to modify , add , cancel what you want to make it better 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 iiceman, NasimiAsl, GameMonetize and 5 others 8 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted August 10, 2015 Share Posted August 10, 2015 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. DellaFree 1 Quote Link to comment Share on other sites More sharing options...
iiceman Posted August 10, 2015 Share Posted August 10, 2015 Great job! Looks really cool and is fun to play. 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 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 DellaFree 1 Quote Link to comment Share on other sites More sharing options...
DellaFree Posted August 10, 2015 Author Share Posted August 10, 2015 Hi guys thanks for the replies I appreciate a lot 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 Any idea about the minimap ?Realy many thanks again for all these suggestions Edit : I made also the ships a little bigger : http://www.babylonjs-playground.com/#6FFQW#24 iiceman 1 Quote Link to comment Share on other sites More sharing options...
RaananW Posted August 10, 2015 Share Posted August 10, 2015 Level 1 complete!Oh, I don't really get the minimap - is it supposed to show the placement of the enemies? I see only sky... Quote Link to comment Share on other sites More sharing options...
DellaFree Posted August 10, 2015 Author Share Posted August 10, 2015 Yes, it should show the enemies and all the map (island, tower, dude ) . Yes it seem to be turn upside down XD Quote Link to comment Share on other sites More sharing options...
iiceman Posted August 10, 2015 Share Posted August 10, 2015 #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? Quote Link to comment Share on other sites More sharing options...
DellaFree Posted August 10, 2015 Author Share Posted August 10, 2015 Yes it could be interesting, but I can't open your link Edit:Great it works Wow it' simply amazing Quote Link to comment Share on other sites More sharing options...
iiceman Posted August 10, 2015 Share Posted August 10, 2015 Of course you can't, stupid me copied the link from my local server (had both tabs open). I fixed the link DellaFree 1 Quote Link to comment Share on other sites More sharing options...
DellaFree Posted August 11, 2015 Author Share Posted August 11, 2015 Hi everybody 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 iiceman and jerome 2 Quote Link to comment Share on other sites More sharing options...
Temechon Posted August 12, 2015 Share Posted August 12, 2015 Here is a way to fix the minimap using layerMask : http://www.babylonjs-playground.com/#6FFQW#32I think you have to create red sphere above each tanks, and each sphere will be only visible by the minimap by having a layerMask = 2. DellaFree, jerome and iiceman 3 Quote Link to comment Share on other sites More sharing options...
DellaFree Posted August 12, 2015 Author Share Posted August 12, 2015 Hi Thanks Temechon !! This is the updated version : http://www.babylonjs-playground.com/#6FFQW#35 . Now I understand where I was wrong Again any thanks Quote Link to comment Share on other sites More sharing options...
DellaFree Posted August 13, 2015 Author Share Posted August 13, 2015 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? Quote Link to comment Share on other sites More sharing options...
RaananW Posted August 13, 2015 Share Posted August 13, 2015 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#2Now 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). Quote Link to comment Share on other sites More sharing options...
DellaFree Posted August 14, 2015 Author Share Posted August 14, 2015 Great many thanks RaanaW 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 Quote Link to comment Share on other sites More sharing options...
DellaFree Posted August 14, 2015 Author Share Posted August 14, 2015 I also noticed that removing the height map, all works fine in Explorer. But when I add it again, Chrome and Firefox not problem (55-60 FPS), instead Explorer has about 10 FPS It's the same scene. It's really strange. I'm forgetting something? Quote Link to comment Share on other sites More sharing options...
DellaFree Posted August 24, 2015 Author Share Posted August 24, 2015 Hi guys!Sorry for my absence, but I have to study other subjects But now I'm come back to babylon 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 linescene.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.sI opened another topic. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.