tlarkworthy's Forum Posts

  • Firebase v0.5

    contribute github

    download plugin only

    run LIVE multi-user demo

    Real time database-as-a-service integration. Have a real-time database without owning a server!

    So far, you can:

    • Set String, Numbers, Objects (as JSONs)
    • Register for updates of String, Numbers, Objects
    • Create (concurrency safe) lists of objects
    • Register for list updates

    Authenticate users securely using:

    • email/password
    • Facebook logins

    Use the webgui (firebase) to:

    -View/edit data

    -set read/write access

    -add consistency rules to be verified by firebase (stop cheating)

    A capx is included in the repo for testing. All communication is encrypted and compressed. Tested on static HTML export, preview and minification. It will NEVER work with Cocoon, but Firebase does provide APIs for native iOS, and Android, so you can possibly get to your data in a complicated post process operation if you want native.

    The project is hosted on github so if you need a feature and can add it yourself, add it yourself and send me a pull request! I have tried to comment my code to make it fairly obvious what the design is.

    Tom

  • That's not true. Havok and suchlike decouple their physics from the frame rate and still achieve determinism via a time accumulator (which I linked, but here it is again gafferongames.com/game-physics/fix-your-timestep/).

    Basically you only step the physics a fixed amount k, after after dt > k wallclock time has passed. You keep track of the remainder k-dt and use it in future calculations to decide whether to perform a physics step or not.

    In summery, you decouple the physics stepping from the rendering thread entirely.

    This means several frame renders may occur in series before actually updating positions. To stop jerkiness, you integrate the time remainder with the velocity and last updated positions. i.e. you linearise the motion model and project into the future when demanded by the rendering thread.

    This decoupling physics from framerate is a common pattern in game development. But its not obvious unless you have seen it before, see also gamedev.stackexchange.com/questions/1589/fixed-time-step-vs-variable-time-step

    In construct 2 a event tick is tied to frame rate. So to decouple physics we have to decide whether to step or not. So we would need functionality to globally enable or disable physics evaluated every tick. Or choose to manually tick the physics ourselves in the event sheet.

  • you stars. I found a stepping mode in physics which does it!

    scirra.com/manual/98/physics

    EDIT: hmmm that doesn't quite cut it due to my other timers going off every XXX seconds and interacting with the physics.

    I once implemented a time accumulator for a physics engine to properly decouple these things (gafferongames.com/game-physics/fix-your-timestep/)

    I wonder if its possible to get that kind of approach into construct 2

    EDIT 2:

    yeah running my behaviours off of "every tick" with physics stepping on fixed made it deterministic. However my frame rate suffers. I believe, that if you were able to switch physics on and off rapidly and not process interactive behaviours every tick, you could play catchup with the frame rate like a time accumulator. There is no global on and off for physics though so I don't think it is feasible at this point.

  • I think there is enough material for any motivated individual to build a new plugin version. You have done plenty :p

  • My game that has no random elements, behaves differently every time I run it. I use the Box2D stuff so I wonder if that's the source and if anyone knows the fix?

  • HALLELUJAH!!!!!

    4 and a half hours later I have it working!

    The only holdup with SaveLoadStatus is that is does not like transferring data between layouts. The internal SDK loadInstanceFromJSON check the layer, and kills the instance if it can't find the correct layer to put the instance in. This is unfortunately is always the case when you load instance data from a different layout than you use the data :s

    Anyway I altered rexrainbow's SetStatus to overwrite the JSON data when loading, so the instance will be recreated *except* the layer info.

        Acts.prototype.SetStatus = function (obj_type, status)
         {     
            if (!obj_type)
                return; 
            status =  JSON.parse(status); 
              console.log("loading...", status);
             //if (obj_type.sid != status["sid"]) //removed, protection against instanciating in different layers
            var insts = obj_type.getCurrentSol().getObjects();
            var i, cnt=insts.length;
            for (i=0; i<cnt; i++){
                   status["w"]["l"] = insts[i].layer.sid //force loaded object into layer of containing instance
                this._set_status(insts[i], status);   
              }
         };   
    

    (It looked like in the code you knew this Rex but it did not work for my use case.)

  • Thanks rexrainbow,

    I think that plugin will work for me.

    Note to future people: InstanceBank's JSON data won't work between exported websites and the development versions due to

    scirra.com/forum/help-me-fix-instancebank-across-exports_topic78823.html

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Yeah, I thought that might be the case. So 3rd party plugin InstanceBank is nice as its an easy way to serialise a lot of data, but its to and from JSON data methods relies on reflection to find definitions.

    I would consider this reverse engineering protection similar in spirit to minification. Thus, I would like to be able to turn it off. Anyway, don't complicate your code base on my behalf. I will bite the bullet and write a proper serialisation mechanism for my project. The JSON serialization was a bit inefficient anyway.

    Thanks

  • I am trying to debug an issue in the InstanceBank plugin:

    scirra.com/forum/plugin-instance-bank_topic62131.html

    This one is hard as I don't know my way round the SDK, basically there is a line which crashes depending on the deployment

    var objtype = runtime.types[save_obj["type"]];

    which when I run the project directly from construct 2 the save_obj["type"] contains "c_laser" (a names type from my project). And the type is looked up from the runtime no problem.

    However, when I run it from a served HTML 5 webpage, the line crashes because runtime.types does not contain "c_laser", it not contains things encode "t1" ... "t50".

    So I assume the type names have been compressed or something, but I did not minify when exporting the project (though I would like to in the future).

    Is the inconsistency in the runtime.types dictionary to be expected??

    Is there a different way of looking up runtime types by name?

    I would like to be able to develop big object graphs in the development site and still be able to read them afer exporting them to a different runtime. Is that a crazy idea?

    Thanks

    Tom

  • Found another bug that the saved instance map doesn't get wiped after a loadBankFromJSON.

    Its a fairly simple fix.

    I people want the bug fixes I would consider putting it on github

  • Clean bank does not clear saved instance map which can cause some weird bugs down the line. I suggest changing JS "CleanBank" to:-

    InstBankKlassProto.CleanBank = function()
         {
            hash_clean(this._bank); 
            hash_clean(this._saveduid2inst_map); //NEW LINE
         }; 
    
  • Great work! I think there is a bug with the picked by saved UID.

    After load all instances, picking by saved UID causes a duplication.

    The javascript code I think is wrong is

    InstBankKlassProto.LoadAllInstancesEpilogue = function()
    {
            this._z_sorting.Sorting();
            hash_clean(this._saveduid2inst_map);
    }; 
    

    The map of UIDs->saved instances is wiped after loading. I don't think this is the correct behaviour for using the pick by saved UID functionality after a load all instances.

    Anyway, to fix I just commented out the hash_clean line. Works for my program although obviously I might not understand the intended full semantics of the plugin.

    PS the duplication occurs because invalid pick params to pick by saved ID lazily creates an instance if none exists. I wonder if this is a bit dangerous, better to alert an error?

  • Yes I am an idiot.

    serving the webpage on HTTP does make it all work. (it did work on FF though without)

    Many thanks

  • NOTE: this is a copy and paste of a closed bug report I posted yesterday. It was closed because "I did not post valid URL". I am unable to post valid URLs due to the forum rules of new members. Hence I replaced the HTTP_COLON_SLASH_SLASH_dropbox.com part of the URL with something that went through...

    Link to .capx file (required!):

    HTTPS_DROPBOX_DOMAIN/s/rb5lmsgdjeirexu/darwin_galaxy.capx

    Steps to reproduce:

    1. export to HTML5 website (HTTPS_DROPBOX_DOMAIN/sh/2pan66j29s0smgp/6MABET_jrO)

    2. open index.html with browser

    Observed result:

    javascript console outputs

    "Uncaught SecurityError: An attempt was made to break through the security policy of the user agent. "

    and the screen is black

    Expected result:

    loads a screen with a few sprite in it

    Browsers affected:

    Chrome: yes

    Firefox: no

    Internet Explorer: not tested

    Operating system & service pack:

    Chrome problem repeated on

    1. Ubuntu 12.04 (32-bit), chrome version 29.0.1547.76,

    2. Nexus 4 30.0.1599.82

    works on windows chrome though

    Construct 2 version:

    R146 32-bit

  • Link to .capx file (required!):

    HTTPS_DROPBOX_DOMAIN/s/rb5lmsgdjeirexu/darwin_galaxy.capx

    Steps to reproduce:

    1. export to HTML5 website (HTTPS_DROPBOX_DOMAIN/sh/2pan66j29s0smgp/6MABET_jrO)

    2. open index.html with browser

    Observed result:

    javascript console outputs

    "Uncaught SecurityError: An attempt was made to break through the security policy of the user agent. "

    and the screen is black

    Expected result:

    loads a screen with a few sprite in it

    Browsers affected:

    Chrome: yes

    Firefox: no

    Internet Explorer: not tested

    Operating system & service pack:

    Chrome problem repeated on

    1. Ubuntu 12.04 (32-bit), chrome version 29.0.1547.76,

    2. Nexus 4 30.0.1599.82

    works on windows chrome though

    Construct 2 version:

    R146 32-bit