• Content Count

  • Joined

  • Last visited

  • Days Won


Reputation Activity

  1. Like
    Nepoxx reacted to codevinsky in generator-phaser-official: Yeoman Generator for Phaser projects   
    I'll work on learning typescript this week, and then incorporating it into the generator.
  2. Like
    Nepoxx got a reaction from Dread Knight in [Ask] Error Get phaser.Map   
    If you don't plan on using the map to debug, you can prevent this behavior by removing the following comment from the minifed source:
    Actually, you should remove that line from production code as it will prevent a totally unnecessary http get call (not that is it expensive, however).
  3. Like
    Nepoxx got a reaction from Dread Knight in The Phaser 3 Wishlist Thread :)   
    I'll give another +1 for basic networking.
    I'm not quite sure what this engine provides, but it sure sounds sweet:

  4. Like
    Nepoxx reacted to Arcanorum in Have one "body" attract all other "bodies". Basically have the earth with gravity.   
    What I mean by don't use SO like a Q&A site is that people shouldn't just dump their own specific, situational problems there expecting someone to come along and work it out for them. The Q&A aspect of SO is meant to serve as a way to grow a repository of useful knowledge, not just to be someones own personal helpdesk.
  5. Like
    Nepoxx reacted to pixelpathos in Have one "body" attract all other "bodies". Basically have the earth with gravity.   
    Hi WhatsDonIsDon,
    Without knowing the specifics of your game and Phaser, it sounds like the implementation of gravity is correct (a force applied to each body/asteroid in the direction of Earth, perhaps inversely proportional to the square of the distance between asteroid and Earth).
    Perhaps all you need to do is to ensure that the asteroid has some velocity perpendicular to Earth. This should allow the asteroid to orbit in some fashion (I assume this is what you are aiming for). For example, if your Earth is in the centre of the screen, and you have an asteroid directly above at the top of the screen: if the asteroid has some initial sideways motion, you should get some kind of orbit.
    I've implemented gravity in my game, Luminarium, which you might find a useful example (see this thread, or direct link in my signature). Have a look at scene 3 (locked levels are playable in the demo), which introduces an "orbit" command, analogous to your Earth.
    When I first implemented the orbit, I found that the Lumins (aliens) would be "sling-shotted" by the orbit command i.e. they would be pulled closer towards it, and accelerate, but then would escape out the other side of the orbit. To try an guarantee continuous orbit, I implemented slight damping (reduction of the aliens' velocity over time). Also, to reduce the number of calculations required, especially if you're going to create many asteroids, I limited the radius over which the orbit/gravity operates, as indicated by the circle drawn around my orbit.
    Let me know if I can provide any more details!

  6. Like
    Nepoxx reacted to xerver in Infinite game   
    Sure its possible, just need to manage what tilemaps are loaded and that memory yourself. There are no automatic features to do what you want, you just need to track the user and load/unload tilemaps as needed.
    Think of it like a tilemap where each tile is a tilemap, just manage it yourself.
  7. Like
    Nepoxx reacted to gnumaru in Infinite game   
    I found this article which seems interesting:

    The author does an analysis on approaches to implementing voxel engines. Even though it is about 3D worlds, you could just “cut out one of the dimensions” and think 2D =)
  8. Like
    Nepoxx reacted to rich in Phaser 2.1.0 "Cairhien" is Released
    2.1.0 was supposed to be a Phaser release that just updated p2 physics. However it quickly grew into something quite a bit more!
    We took the opportunity to introduce a bunch of new features (ScaleMode RESIZE being a pretty significant one) and hammer the github issues list into submission, until it was a mere shadow of its former self, now composed mostly of feature requests.
    As you should be able to tell from the version number this is an API breaking release. Not significantly, as most changes are confined to P2, but definitely in a few other areas too. As usual the change log details everything, and although we appreciate there is a lot to read through, everything you need to know can be found there.
    The next release will be 2.1.1 in approximately 1 month, so if you find any problems, and are sure they are actual problems, please report them on github and we'll get them fixed!
    To everyone who contributed towards this release: thank you, you're the best.
    Also, one of my favourite new examples (draw on it)

  9. Like
    Nepoxx reacted to ASubtitledDeath in IE9 framework errors on load   
    Hey Guys,
    Thanks for the replys.  I did a few more experiments.  These are the variations of the framework I have tried:
    Phaser.min.js - Error Object doesn't support property or method 'defineProperty', line 3, character 2900
    phaser-no-libs.js - no errors, but I need physics and Pixi
    phaser-arcade-physics.js - Error Object doesn't support property or method 'defineProperty', line 603, character 1
    This is the offending code:
    Object.defineProperty(PIXI.DisplayObject.prototype, 'interactive', { get: function() { return this._interactive; }, set: function(value) { this._interactive = value; // TODO more to be done here.. // need to sort out a re-crawl! if(this.stage)this.stage.dirty = true; }}); HOWEVER!!
    I added this user agent compatibility tag into the head of the doc and it now works!
    <meta http-equiv="x-ua-compatible" content="IE=edge">
    I also retro fitted it to the full framework and that fixed it as well.
  10. Like
    Nepoxx got a reaction from lewster32 in Multiplayer RPG game. It's possible?   
    You'll most likely have to write your own server code. Non-real-time is trivial to do, however. You can communicate from Phaser using simple AJAX to a NodeJS server. That should be more than enough for your needs.
  11. Like
    Nepoxx reacted to rich in Slice Engine.   
  12. Like
    Nepoxx got a reaction from lewster32 in Howto videoanimationcreator.php in phazer ?   
    You're asking for a lot, however here's a small list of good resources for Phaser:

  13. Like
    Nepoxx reacted to rich in 1995 Sega Game Remake, works on mobile too.   
    Right, because no-one else has ever made a game in Phaser that used the mouse 
    If it's meant to be fully keyboard controlled then don't respond to mouse events at all on desktop. Then at least people won't click around and get confused as to why some buttons respond fine and others don't - that's bloody confusing, no matter how you spin it.
  14. Like
    Nepoxx reacted to gnumaru in Alternatives to organize code base into several files (AMD, Browserify and alikes)   

    Indeed, the C compiler preprocessor would do with the files exactly what I do not want to do. I do not want to bundle every .js file into one single big file, that's what the C preprocessor does. But when I made comparisons with C includes, I was talking about execution behavior, the javascript execution behavior compared to the behavior of a compiled C code that got includes.

    For example, if you execute the following lines on your browser:

    /* ********** */
    eval("var a = 123;");
    var b = 987;
    eval("alert(b );");
    /* ********** */

    The first alert call will alert '123' and the second alert call will alert '987'. But if you 'use strict', the "var a" declaration and assignment wont be visible outside the eval, and the first alert will throw a "ReferenceError: a is not defined", and if you omit the var for the variable's 'a' declaration it will throw a "ReferenceError: assignment to undeclared variable a" (because when you 'use strict' you only declare globals explicitly by appending them to the window object).

    But the second alert will behave identically with or without 'use strict', because when you eval some string, it's code runs using the context where the eval call is made. This behavior of eval (although achieved in execution time) is the same of a C include statement (although achieved in compile time).

    If you create two C source files named a.c and b.c:

    /* ********** */
    //code for a.c
    int main(){
        int x = 0;
        #include "b.c"
        i = i+1;
    /* ********** */

    /* ********** */
    //code for b.c
    x = x+1;
    int i = 0;
    /* ********** */

    then compile them:

    $ gcc a.c;

    It will compile successfully because the code of b.c was coppied "as is" in the place where #include "b.c" is called. Thus not only the code in b.c got access to the code defined before the include statement in a.c, as well as the code defined after the include has access to the code defined in b.c. That's exactly the behavior of eval without "use strict", and "half" the behavior of the eval with "use strict".

    About eval being bad, I'm not so sure yet. I know most of the planet repeat Douglas Crockford's mantra "eval is evil" all day long, but it seems eval is more like "something that usually is very badly used by most" than "something that is necessarily bad wherever used". I had yet no in depth arguments about the performance of eval, and personally I guess that it "must be slower but not so perceively slower". About the security, that surely opens doors to malicious code, but the exact functionality I seek can not be achieved otherwise, at least not until ecmascript 6 gets out of the drafts and becomes standard. About the debugging issue, I think that's the worst part, but as already said, there is no other way to achieve what I seek without it.


    When I said javascript couldn't include other javascript files it was because "javascript alone" doesn't have includes. The default, de-facto, way of including javascript files is of course through script tags (it was the default way since the beginning of the language). But the script tag is a functionality that is part of the html markup language, not of the javascript programming language. Javascript itself, in it's language definition standards, does note have (yet) a standards defined way to include/require other javascript files.

    I was already aware of the Function constructor. I really don't know the innards of the javascript engines, but I bet that internally there is no difference between evalling a string and passing a string to a function constructor (jshint says that “The Function constructor is a form of eval”).

    I did run your tests on, and eval gave me a performance only 1.2% slower than the function constructor (on firefox 31). On chrome 36, it gave me a difference of 1.45%, which are both not so bad.

    I'm sure that one big js file bundled through browserify can be much more easily chewed by the javascript engines out there. The question could be about "how much slower" does a code recently acquired through a xmlhttprequest runs in comparison of a code that was always bundled since the beginning? And does this slowdown happens only after the first execution? and what if I cache the code? will it run faster afterwards? or it will always run slower? I don't know the answer, I never studied compilers, interpreters or virtual machines architectures. At least, my results in the jsperf test you gave me where good to me =)

    Anyway, I changed the eval to the “new Function” because I noticed that I wasn't caching the retrieved codes AT ALL. Now I've switched to a slightly better design.


    I have now implemented a limited commonjs style module loading on executejs (without a build step). It does not handles circular dependencies yet, and it expects only full paths (not relative paths).

    What bothers me of browserify is that it compels you to a build step. RequireJS does not have it, you can use your modules as separate files or bundle them together, you decide. But that's not true with browserify, and I prefer the commonjs require style than the amd style.

    I searched for a browser module loader that supports commonjs, but every one of them seem to need a build step. The only one I found was this:

    And it seems to be too big and complicated for something that should not be so complex...
  15. Like
    Nepoxx reacted to lewster32 in Phaser autocomplete in editor   
    Visual Studio's Intellisense works very well for me. Use phaser.js and put this at the top of your own JavaScript file(s) to enable Intellisense:
    /// <reference path="phaser.js" /> The path is relative to the file you're working on, so if you keep all your JS files in the same folder this will work as is.
  16. Like
    Nepoxx got a reaction from callidus in video tutorial on phaser   
    Thanks for the link! (They have a playlist specifically for Phaser:
  17. Like
    Nepoxx reacted to lewster32 in Blocks collapse   
    It seems to me that if all the boxes are the same size, are spawned on an x-axis grid and aren't meant to intersect, then it's likely to be a grid-based game. I could be totally wrong in my assumptions of course! If there's a need to actually have a stack of physics objects like that, then we really need more info about what it is Tubilok is trying to achieve.