Popular Content

Showing content with the highest reputation on 08/04/16 in Posts

  1. 4 points

    Coming from Unity, a few questions

    Hiya @trecool, welcome to the BabylonJS forum! I'm no expert, but I'll give my honest opinions. 1. Actually, ThreeJS does animations almost as well as BabylonJS. Here is a Professor Stemkoski animation demo. Just use your cursor keys. 2. You are correct, the scene is rendered over and over. BUT... the scene is not built/assembled over and over. Besides rendering a scene constantly, many programmers "wedge-into" the renderloop and use it as an engine to do work. Take a look at our playground demo for lights http://playground.babylonjs.com/?6. Look at lines 56-67. scene.beforeRender is one way to say "run this code just before EACH rendering happens". Math sine and cosine values are applied to the X and Z axes of lights, causing them to do dynamic orbiting. It's as if we hooked a belt or driveshaft to the fast-running render loop, and use that drivebelt to power scene machinery. The main thing to remember... don't load-down the render loop with slow-running code. beforeRender code should run fast and get done quick, or else your overall scene render speed will suffer. Update is done here, too... but automatically. Mesh have a Boolean flag on them... update-able or not. I THINK... the more mesh that you can set updatable to FALSE, the faster the overall scene will run... but I might be full of crap. 3. It's not quite drag'n'drop with BabylonJS, but it's not terrible, either. For example, a door mesh needs to be positioned into the door frame... and that can be done within BJS, or within the modeling software (if you use a modeler). Sometimes, its pivot point needs a move. That, also, can be done with one line of code in BJS or in the modeler. Animations... a little more difficult, but still not bad. In fact, we have a createAndStartAnimation() that requires only one line of code. Generally, set a start frame, set a stop frame, tell it which property you want to animate (door.rotation.y), and tell it how fast to do it. Not bad at all. There's a few things that BJS has, that 3JS doesn't. One... a great working online "playground" with playground search. Two... much better backward-compatibility. Three... a very active and helpful forum, with a great "team" spirit. Many times, I have seen LARGE NUMBERS of forum helpers... go to work on a user's issue. Just read-around in the forum a bit... you'll see it, too. The people here... pride themselves in the speed of helping, and in being thorough. You don't see grumpy helpers here, even when a helper is answering the same question that has been asked a hundred times. That is one of MY volunteer tasks around this place. I watch-for repeatedly-asked questions and problems, and try to adjust our documentation to eliminate that. Others do that, too. Although I don't know much about the "give a crap"-factor for other webGL frameworks... the BJS forum give-a-crap factor is WAY WAY high. Forum helpers here... sometimes go far beyond the call of duty, and teach-about/help-with issues NOT about BabylonJS, too. And... we're example-crazy, here. We LOVE to see and hear-about what users are doing with BJS. This helps core programmers and documentation writers "contour" the system to accommodate everyone. Speaking of accommodation, the chief author, and other BJS-core programmers around here... REALLY listen to feature requests, and always try to accommodate the request, when viable. Not only that, but they add it FAST. I have made requests for changes... and gotten the change added in under 5 minutes. Really. It's rare that features can be added that quickly, but if they CAN be, it's done. In other words... great people with a high give-a-crap factor. You're never alone... when you drive BJS. You have friends, and some of them are geniuses and idea-folk. But the playground, and its searcher, and its ZIP feature.... those are the real "meat" of BJS. There are probably 25,000 playground demos in the playground database - test scenes and experiments covering every webGL subject known to man, + 3 more. This is a really nice learning environment with good friends in all directions, and a real fast framework. Even if you DO switch frameworks, later... much of what you learned here, will transfer. Yes, this is a SLIGHTLY smaller family than 3JS land... and we like it that way. Also, BJS doesn't necessarily provide a pile of rarely-used helper objects, but BJS makes it easy for you to build your own helper objects... contoured to YOUR project. The helpers are better when you build them yourself. They fit your needs, better. It just takes a little time, a little terminology learning, a little documentation site familiarization, and some great playground demo code... and in no time, you'll be fartin' thru BJS silk. err... I mean... you will feel REAL comfortable here in BJS land. Ask anyone here. They all know... after a very short learning curve... the sun comes out, the ride gets smooth, and the smiles are everywhere. So, just plant your butt into this nice BJS grass, and relax into our world. You'll never regret it.
  2. 2 points
    The difference of the two examples is that the first examples uses states and the second one does not use states. If you only have one state it does not really matter wich example you chose, but when you add multiple states you will need the first example. You can then create multiple states (for example one for the menu and two levels). This makes it also very easy to break up the code into multiple files, so that you have a seperate file for every state.
  3. 1 point

    Munera.io: Get big, dont die.

    Hi, We are Tex and Chris, we are the team of munera.io, an already live beta multiplayer PvP death-match in a 2d dark arena/dungeon. The name “Munera” evokes the fighting games of Ancient Rome Empire, including the most memorable Gladiators contests. video: https://www.youtube.com/embed/NcD95sz72TA In munera.io you can get killing sprees, double kills, triple kills, multi-kills. You can flee/heal and then prepare your counter attack. You can team up and defeat powerful players, you can use classes to your advantage; for example, one tanking with a knight while a ranged friend nukes other players. Possibilities are endless, currently we have 3 human classes available (Mage, Knight, and Archer) but soon lower races of orcs, goblins and ogres might join the scene. Beta is live since 10th of July, since then we have received several feedback and some recommendations have already been implemented such as: controls improvements, multiple hits, healing speed variation according to power, balance general config and a super awesome second skill.
  4. 1 point
    Yeeeh, You are right! Man thanks a lot, nice to see helpfull person who know a lot of phaser My project is still creating, i have done a lot but i am still learning java script, fine to know about anyone can help. Thanks!
  5. 1 point
    Try it like this createItems: function() { //create items this.items = this.game.add.group(); this.items.enableBody = true; var result = this.findObjectsByType('item', this.map, 'objectsLayer'); result.forEach(function(element){ this.createFromTiledObject(element, this.items); }, this); this.items.setAll('body.immovable', true); this.items.setAll('body.moves', false); }, You were first changing the body then creating them. This was the order is correct as you create them from tiles then changed their body attributes. You also seem to not use var item; So it might be safe to delete that also, unless you have more code in that function, and I added var in front of result as that seems to be a local variable.
  6. 1 point
    http://phaser.io/docs/2.6.1/Phaser.Physics.Arcade.Body.html#moves You also need to use: this.items.setAll('body.moves', false);
  7. 1 point
    createItems: function() { //create items this.items = this.game.add.group(); this.items.enableBody = true; //this.items.body.immovable = true; this.items.setAll('body.immovable', true); var item; result = this.findObjectsByType('item', this.map, 'objectsLayer'); result.forEach(function(element){ this.createFromTiledObject(element, this.items); }, this); }, Since it's a group you need to use setAll to change the values of all members of the group.
  8. 1 point
    It's good in the update function but you are using arcade.overlap and you need to change that to arcade.collide http://phaser.io/examples/v2/arcade-physics/sprite-vs-sprite
  9. 1 point
    this.game.physics.arcade.collide(this.player, this.items, this.funkcjaitem, null, this); Use collide instead of overlap.
  10. 1 point
    You probably solved this by now, but the cameras which need a target are implemented in Blender using constraints. Right click camera to select. Shift right click target. press ctrl-t & select 'track to constraint'. Camera show immediately point to the origin of the target.
  11. 1 point
    @NasimiAsl i'm not sure, one way to "fix" it you could set the meshes isVisible = false; and when it's fully loaded set it to true.. atleast it won't show up without textures and if it's made out of several meshes it won't show up in bits as they get loaded. and perhaps looking into pre-loading the textures could work.. load textures as babylon.js textures before you start loading the meshes and then set the textures as the meshes gets loaded.. dono.. does sound like a lot of work though but thats the two ideas i've got, hope you figure it out
  12. 1 point

    Text-Based Game in Phaser?

    Whoo boy! That could be weird and fun. I'd steer you towards Twine, first. It lets you create text adventures in HTML/CSS/JS. If you know those technologies you can customize the hell out of your Twine game for interesting results once you're done using the editor. Then I'd steer you towards Inform 7 cuz SWEET JESUS it's the best example of a programming platform I know of. Time travel, test cases, great docs. Seriously nice. If you've done HTML/CSS/JS programming for the "normal" web before that will serve you very well in making a text game in Phaser. You probably don't want to rely on the HTML canvas for doing text-heavy work. Text processing in CSS3 is way more performant and will provide nice text stuff like word wrap, RTL (if you translate your game), accessibility for other input devices, etc. If I were you I'd absolutely position a div or two on top of the canvas and rely on the canvas for pictures, particle effects, and atmospherics. You could also use Phaser to play sounds for you, etc. But the text and input stuff I'd leave to plain HTML with fancy styling. XML is fine for browsers. You can query the XML structure just like you can HTML once it's loaded (which Phaser's loader can help you with), since they're both offshoots of Standard Generalized Markup Language. You don't have to translate your XML into JSON just yet, I don't think. As to how to program them... I don't know what kind of text adventure you're thinking of making. If it's the Zork kind (e.g. "get sword", "attack orc", "go north", "inventory"), then you end up with a parser for what the user types and some state of the world. Parsing what users type is a big topic, but, basically, you define a vocabulary of verbs. A very simple parser could be "<verb> <noun>" with nothing else, nothing fancy like Inform. First thing you do is make sure the sentence is parseable (more on that below). Then you find out if you understand the verb. Then you find out if you understand the noun based on the player state. Chances are every meaningful object in your game will have an ID; now would be a good time to translate the noun into that ID for your other code to reference. Each verb could be a function in your game that modifies the state. You could synonymize so "take", "get", "grab", "pick" all with some grabTheThing function. Then args to the function could be the nouns, like "sword" or "coins" or whatever -- except not as strings, but as IDs. The function could then operate on that ID to do whatever it is. Anytime you write something out to the "console", you stick it in the div. The browser will handle scrolling for you. The player's input could be the onsubmit event of a form. Meanwhile, Phaser's update is always running -- so you could do real-time events like timers and things that affect the game. You should check out the documentation for old MUSH and MOO engines. You could (and should!) do something a lot simpler and get pretty far. And don't forget to let us playtest!
  13. 1 point

    Text2D Canvas I cant get it to work

    cleanup http://www.babylonjs-playground.com/#1N9RJY#33
  14. 1 point

    TweenLite with TypeScript?

  15. 1 point
    Ok @Wingnut using your playground I was able to get panning to work Step 1 of 1000000 done. Thanks so much for the help (im sure i will be back with more issues soon)
  16. 1 point
    haha yeah, a metaphor of course. though some real world table flipping is not out of the question at this point.
  17. 1 point

    Munera.io: Get big, dont die.

    Quite fun, but lonely. I played for around 10 minutes but only ever saw one other player who only stayed 10 seconds. This could potentially be really fun with more traffic and maybe level ups of skills and equipment. I like the rogue-style lighting too.
  18. 1 point

    WebGL slower than canvas [FIX]

    It should be generally understood that debugging tools will reduce the performance of your projects, whatever language, platform or framework you're using. The debug tools in Phaser are a case in point - they aren't optimised and don't attempt any clever batching or draw call saving, they just render all of the debug output onto the frame each frame afresh, which in the case of WebGL is particularly inoptimal, though far less so with canvas's 'blitting'. Saying all that, it is worth knowing if you're puzzling over such large performance disparities - I'm surprised this isn't common knowledge though.
  19. 1 point

    Munera.io: Get big, dont die.

    Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/. firebase.js:277 WebSocket connection to 'wss://project-2468059558167680354.firebaseio.com/.ws?v=5' failed: Error during WebSocket handshake: 'Upgrade' header is missingrd.open @ firebase.js:277 firebase.js:277 WebSocket connection to 'wss://s-usc1c-nss-113.firebaseio.com/.ws?v=5&s=y028GxTF3kJsIRJQ9URu7nnPibYHXzyd&ns=project-2468059558167680354' failed: Error during WebSocket handshake: 'Upgrade' header is missingrd.open @ firebase.js:277
  20. 1 point
    I understand, I export the skinned meshes right.
  21. 1 point
    var ox = 0; var oy = 0; var oz = 0; var pi2 = Math.PI * 2; var step = pi2 / 60; // we want 60 points for (var i = 0; i < pi2; i += step ) { var x = radius * Math.sin(i) + ox; var z = radius * Math.cos(i) + oz; var y = oy; path.push( new BABYLON.Vector3(x, y, z) ); } path.push(path[0]);
  22. 1 point

    Creating my own module.

    What errors are you getting in the console? Here is a guess - you are trying to call the star function before it is loaded. Try putting this stuff /*...babylon stuff*/ //star instances var star1 = new Star(new BABYLON.Vector3(500, 500, 1000)); var star2 = new Star(new BABYLON.Vector3(0, -100, 200)); var star3 = new Star(new BABYLON.Vector3(-600, 200, 1200)); /* ... more babylon stuff ...*/ Into a function called by window.onload. Something like <script> Window.onload = main; function main() { /*...babylon stuff*/ //star instances var star1 = new Star(new BABYLON.Vector3(500, 500, 1000)); var star2 = new Star(new BABYLON.Vector3(0, -100, 200)); var star3 = new Star(new BABYLON.Vector3(-600, 200, 1200)); /* ... more babylon stuff ...*/ } </script> Having a problem editing above code window.onload shouls NOT start with a capital.
  23. 1 point

    Load Material friom JSON

    @RaananW Awesome! Thanks! This is exactly what I was looking for and it works great!
  24. 1 point
    Visual Studio provides a nice environment for developing cross-platform apps. To do so you need to first install the Apache Cordova plug-in. Once that's installed you can develop and debug your Babylon.js app using the Ripple Emulator which uses the latest Google Chrome). The problem occurs when you want to deploy to an actual device, like an Android tablet or phone. If you're running anything less than Android Lollipop (< V5.0), your Babylon.js app won't work because it runs in a webview and older webviews to do not support WebGL. The solution is to add CrossWalk to your Visual Studio project. In Visual Studio 15.0, the path is: Project > config.xml > Plugins > Core > Crosswalk Webview Engine (click the add button). This didn't appear to work until I did a Rebuild All. After that, it deployed just fine. FYI
  25. 1 point

    Editing height map terrain

    Well done! I have a stupid browser context menu that is in the way with right click, but the mining is still working. Cool!!!
  26. 1 point

    OCR with Javascript, Phaser

    Hi All, I have made a simple OCR engine with Javascript. I used Phaser Framework for drawing canvas. You need to draw at once. When you mouseup, the algorithm begins to recognize the number that you draw. The algorithm is for only numbers. Other characters can be added. The resolution is configured for mobile devices (360x640). For best results, you should change the browser's resolution into mobile resolution. There is github repository for OCR project: https://github.com/mg52/OCR I hope you will like this..
  27. 1 point

    Canvas2D sprite not showing up

    affirmative and now without CTRL-F5
  28. 1 point

    The Best Phaser Template

    Not sure you're asking for feedback but... * You need to mention global dependencies you need, node is a given as you're expecting an npm install but grunt-cli is not, either add it as a project dependency (best solution so you don't nuke the target system with global deps, not sure you can with grunt though) or state that you need it. Ditto for cloning the repo and killing the existing git history, I dont want all that for a new project, I want it nice and clean. * No idea where your prod build is, I see an uglification but in your post you mention a concatenation, that does not currently exist. * Keeping your deploy/target around (i.e. persisting between builds) is a serious bad idea, like, terrible. At the very least you should nuke that folder with every deploy, so you start from clean and you have your automated build scripts build everything. The only criticism here is that a clean install is timely, but, how often do you deploy? Shouldn't be too regularly (by not regularly I mean, you don't deploy a live build on every code change/save, if you get your CI/CD right then a deploy nightly is a good goal) so time is not a factor, although reliability and consistency are. If you build into a dev folder (you don't here) then time becomes a factor and you can probably accept some sacrifice to consistency, but certainly not for a deployable version. * If you're worried about the latest version of Phaser don't include it in your repo, either ask people specifically to include whatever version they want (i.e. latest), include a script to grab the dependency (akin to npm install), you may also want to manually trigger that script on npm install, perhaps even checking to see if a newer version is available. The url's all exist so the script is fairly trivial. * In your current setup you don't need to wait for the window load event, you've stuffed all your deps into the head so they'll all be there by the time it hits your script, just out of interest, why include that directly into the html? sure, it saves a further request but just seems odd to separate it from the rest of your JS. * You mention solving scoping issues, again, I dont see it, looks like fairly standard Phaser architecture (which is good). How does your project scaffold help with scoping issues? I also see a load of variables being declared in Game, whats the thinking there? * What's the banner doing in there, you don't use it anywhere? I love seeing people create tooling, but, bad tooling is a real put-off, particularly when people using that tooling have invested some of their effort & time into using it. I don't think you're far away from creating a good start for people to use, just gotta tighten up the edges (calling it the Best Template in your post header is bold, and, sadly, totally unfounded, it certainly isnt the best...yet).
  29. 1 point
    Making a real, competitive multiplayer engine is a real, REAL challenge. I know that because I've been working on one of my own for the past months. It's super hard and requires a good understanding of programming. If you didn't read those articles, you have to (absolutely) : http://buildnewgames.com/real-time-multiplayer/ http://www.gabrielgambetta.com/fpm4.html https://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking They depict the real ways of doing a multiplayer engine. Once you're at ease with the notions, come back for more questions!
  30. 1 point
    @Deltakosh thanks for the answer. Sounds like a great project, although I don't have a clue how to develop such an exporter for c4d. I will have a deeper look to the FBX-exporter (never used it before).
  31. 1 point
    @RaananW okay, I see. So the next update has some things on board that I already like a lot ;-)
  32. 1 point

    [WIP] Goblins & Grottos

    Goblins & Grottos is a new collaboration between Psychic Software (from Ireland) and Goblin Portal (from Sweden). We're calling Goblins & Grottos an "inverted RPG". You play as the goblin, trying to escape a series of dungeon levels while a team of callous adventurers lays waste to everything around them. The idea is to turn normal RPGs on their heads, and see everything from the eyes of the poor helpless cannonfodder for once. The game is now available on Steam (Early Access): http://store.steampowered.com/app/389190 G&G is written using HTML5/Javascript packaged into a desktop executable using nodewebkit and with pixijs for pretty efficient WebGL rendering. Nodewebkit gives access to things such as local file reading/writing, which isn't normally possible from a browser. I'm using the matterjs javascript physics engine to move stuff around, but other than that there's no actual game engine to be seen. I have found this suits me well for the 2D games I have been making lately - I can construct my own architecture rather than having to learn someone else's; and the lightweight nature of Javascript suits me. Goblin Portal have created a clean pixel style for the game, and Psychic Software are coding the code. Which is just as well, because they can't draw very well. It's working out well under control of a 2D physics engine: we have spent a lot of time getting the core animations and interactions with the environment as good as possible; the goblin runs, jumps and climbs walls, swings from chains as he attempts to escape the numbskull adventurers .. who in turn have no respect for the goblin, seeing him only as a quick kill for 10xp which brings them along the road to their next level and unlocking their next skill. The near-term plan for Goblins & Grottos is to make a playable one-level demo, and to engage with players while expanding this into a complete multi-level adventure, starting with the goblin's parents being hacked down by a merciless bunch of greedy adventurers, and ending with an unexpected and heart-wrenching moral dilemma. Or something. We're also planning on releasing the map editor as a core part of the game, and on making an on-line repository for player-made levels. There's plenty of creative freedom in the map editor I have been creating, including customising the skills and chat text of the adventurers.
  33. 1 point
    Babylon.js give you a scaled value to autmatically fit your animations/values: scene.getAnimationRatio()So in your case you can scale your jump value by this value. scene.getAnimationRatio() will be greater when FPS is low to compensate
  34. 1 point

    Tree Fu Tom: Magic Dash

    It is nice to see it online Finally I can pick up girls talking to them that I made a game for BBC, hehe