jerome Posted July 5, 2016 Author Share Posted July 5, 2016 Well it's not the cleanest code ever, but it runs and it runs fast (60 fps with Chrome even on my 10 yo laptop) ... So I'm proud to introduce you to my first full playable demo PG : http://www.babylonjs-playground.com/#1UYHW4 The code is commented if you want to hack it or tweak it. FIRE = SHIFT or Left mouse button The rules are quite complex but I'm sure you'll understand them : Destroy the baddies (unless YOU are the baddy, I don't know) and keep in life ! If the baddies aren't visible, search them around, they are never far from you. Have fun meteoritool, Nabroski, julien-moreau and 1 other 4 Quote Link to comment Share on other sites More sharing options...
jerome Posted July 5, 2016 Author Share Posted July 5, 2016 Just some extra info for the most curious of you : This is a low-cost demo, this means there are very few assets. Actually, the stars, the enemy laser crosses, the laser impact on the enemies, the enemy explosion and the laser lights in the distance are all in single SPS using a single quad particle with a single texture (different sizes, colors, behavior). The cannon lasers are also one SPS with a simple triangular shape for particle model. Each enemy is a ... SPS (surprising, isn't it), what has just digested a T-fighter-like model. This model is simply computed from 3 cylinders and sphere merged together. The cockpit is a merged mesh designed from two tubes and a curved ribbon. The shield indicator is an updatable ribbon. And the sight is a simple texture plane. The camera is fixed, looks towards the Z axis, everything is animated according to the current pointer position. Quote Link to comment Share on other sites More sharing options...
Milton Posted July 5, 2016 Share Posted July 5, 2016 Not sure what is happening here, but if I go fullscreen, my pointer is locked to the top-right position... Quote Link to comment Share on other sites More sharing options...
jerome Posted July 5, 2016 Author Share Posted July 5, 2016 works fullscreen for me here, on different screens what is your screen resolution btw ? Quote Link to comment Share on other sites More sharing options...
Milton Posted July 5, 2016 Share Posted July 5, 2016 1366x768 on Ubuntu 15.10. Chrome/FF pointer locked. Windows: Chrome/FF/Opera pointer locked. IE11 works great Problem seems to be that the mouse is disabled in fullscreen. Quote Link to comment Share on other sites More sharing options...
jerome Posted July 5, 2016 Author Share Posted July 5, 2016 could you please try this same version off the PG here : http://jerome.bousquie.fr/BJS/Starfighter/ and report me if the problem still occurs ? I need to know if it's related to the PG, to the browser in full-screen mode, or something else ... because nothing in the code deals with this at all Quote Link to comment Share on other sites More sharing options...
Milton Posted July 5, 2016 Share Posted July 5, 2016 This one works fine! So a PG problem... Quote Link to comment Share on other sites More sharing options...
jerome Posted July 5, 2016 Author Share Posted July 5, 2016 ok, thank you The PG is here in learning/hacking purposes... and to share this tribute with any interested other BJS lover [EDIT] I just checked, it seems the better way with the PG is to play in EDITOR-less mode only Quote Link to comment Share on other sites More sharing options...
dbawel Posted July 5, 2016 Share Posted July 5, 2016 Odd - The scene does play much better in "editorless" mode - however, even then if I switch to fullscreen, pointer locks up on the right side of the screen unable to move. Otherwise, it's a great game, and I hope you adapt it to the GearVR or Vive or both - or perhaps give me permission to do so? Fun to play. DB NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
Milton Posted July 5, 2016 Share Posted July 5, 2016 I find the turrets decidedly phallic iiceman 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted July 6, 2016 Author Share Posted July 6, 2016 @dbawel sure, you can get the code and improve it for your own ideas. Just share it with us when you achieve to do something nice about the pointer locked in some corner, it really seems to be related to the PG behavior, because it doesn't happen when the game is run off the PG @Milton well, you find the turrets like ... what it comes to your mind Game note : the enemy hits you when its laser hits the center of the cockpit glass, well in the center of the screen Game and code note : I tried to put all the game setting variables at the begining of the code so that people that don't want to read all the code lines can fix them to other better values to their own needs from the line 6 to 25 You can, for instance, increase the game difficulty by reducing the maxShield value (your ship resistance) or increasing the number of enemies, or their speed, or their laser speed, or their shield, or their fire frequency. Just set different, but to far, values than the current ones. If you set radically different values, you'll notice that the game still runs but quickly becomes unplayable. I discovered that "playability" is an art of refinement of a a given working program example : this version could be an expert level http://www.babylonjs-playground.com/#1UYHW4#1 ace level : http://www.babylonjs-playground.com/#1UYHW4#2 jedi level : http://www.babylonjs-playground.com/#1UYHW4#3 (try to score just 300, so only 3 enemies ) Code note2 : I choosed to set and type early every variable for two reasons : to help the js compiler to optimize the code and to help the coder to understand what kind of value he's dealing with. Therefore, if you have a look at the code, you'll see that every numeric value has either a dot (ex : 0.0) or a pipe (ex : 0|0) : this is the JS way to explicitely declare either a float, either a signed integer. You'll also notice that the code is not fully object oriented. Plenty of variables are used with a large scope... Well, although it may be not as clean or readable as better embedded code, it's still legal and efficient javascript in terms of syntax, compilation and execution javascript. So sometimes I use objects, sometimes simply arrays. I just usually do the most straight forward possible to what I intend (all this could be refactored). I just keep the constraints to not allocate anything once the render loop has started and to never modify an object once it is created, neither a variable type once it is set. dbawel and NasimiAsl 2 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted July 6, 2016 Share Posted July 6, 2016 very impressive Dear @jerome wonderful i get 0 score in #3 jerome 1 Quote Link to comment Share on other sites More sharing options...
jerome Posted July 6, 2016 Author Share Posted July 6, 2016 thank you and you're definetly not a jedi, so am I neither NasimiAsl 1 Quote Link to comment Share on other sites More sharing options...
iiceman Posted July 6, 2016 Share Posted July 6, 2016 Super cool! Good job! Really fun to play and great performance! jerome 1 Quote Link to comment Share on other sites More sharing options...
Vousk-prod. Posted July 7, 2016 Share Posted July 7, 2016 Excellent piece of game, immediatly reminds me a particular level of an old star wars game on the NES jerome 1 Quote Link to comment Share on other sites More sharing options...
Nabroski Posted July 13, 2016 Share Posted July 13, 2016 some shaders for the Cockpit, changed 3 numbers, personal taste http://www.babylonjs-playground.com/#1MTLJW#0 Quote Link to comment Share on other sites More sharing options...
jerome Posted July 13, 2016 Author Share Posted July 13, 2016 Waaaoowww really cool (the shield indicator doesn't get red, but it doesn't matter) Glad to see a first person trying to hack this PG thank you ! Nabroski 1 Quote Link to comment Share on other sites More sharing options...
Nabroski Posted July 13, 2016 Share Posted July 13, 2016 Hello yes, something, i got to work on, didn't notice, also i get too good at this game by the time, - shield indicator is unnecessary...the power is within me Quote Link to comment Share on other sites More sharing options...
jerome Posted July 13, 2016 Author Share Posted July 13, 2016 Real Jedis don't need any shield, but only the Force Nabroski and Dal 2 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.