Wrapper Expirement

0 favourites
  • Unsatisfied with the graphics performance of web browsers on my machine I wanted to see what kind of performance I would get making my own wrapper. The idea was to run an exported html5 game with the V8 JavaScript engine and then only implement the parts of the browser that the game needs to run.

    Here's an example of the results so far. A python/javascript hybrid that can run an exported C2 game. ...well actually a small subset of C2 games.

    Packaged example:

    https://dl.dropboxusercontent.com/u/542 ... withpy.zip

    Wip wrapper script:

    https://dl.dropboxusercontent.com/u/542 ... nwithpy.py

    You could try dropping in another exported game but it may not work, because a lot is not implemented. Basically it has enough to draw objects and handle mouse events so far. The performance is better than I expected considering I don't think I've done it in the fastest way possible and it's running in python.

    The goal is to get rendering, input and sound working, as well as some AJAX for file access. I probably won't be implementing everything else such as video, networking or form controls. This probably won't ever be a complete browser engine, just enough of it to run games.

  • To be honest, according to my benchmark performance, it's complete bottleneck after all.

  • If I understand your description correctly, are you trying to create a browser engine specifically for games?

    Whatever the case, I'm sure that it'll be something special by the time you've completed it.

    I will have to give it a test after I get home from work.

  • Joannesalfa

    If you mean graphics, then I too find that as a bottleneck on my pc with html5.


    Yeah, that's basically what it is and it's ending up much simpler to get going than I originally supposed.

  • Can Python use webgl even?

  • Really cool project rojohound!

    Anyway, here's some errors I got:

    8 bit issue (seems to happen with spritesheets, but not single images. 24bit png works fine):

    *** EXCEPTION ***

    Failed to load image "images/enemyspawner-sheet0.png". Reason: PNG not supported

    : 8-bit only

    File "<string>", line 261, in <module>

    Press any key to continue . . .

    Also, anything with keyboard commands won't run. Maybe you could allow such projects to boot, even if the controls don't work yet?

    EDIT: curious about newts question. Does your framework support effects?

  • That does sound really cool R0J0hound!

    Is there any possibility that this could eventually be used instead of something like NW.js?

  • Joannesalfa

    If you mean graphics, then I too find that as a bottleneck on my pc with html5.

    No, it's not about the graphics, in that case if you keep playing, keep spawing sprites until 50, you will notice the bottleneck is starting, you don't want to see it keeps freezing in every seconds. Maybe it needs garbage collection or something else.

  • newt

    I just am implementing 2d right now, but in the future I think could do webgl by wrapping all needed webgl calls to opengl or something. The limiting factor would be differences in the shading language.


    The png issue is a limit of the graphics library I'm using, right now I'm working around it by converting all the png files to be 32 bit after I export.

    Keyboard support is not implemented yet, just most of mouse and enough of the canvas to draw stuff. Soon though.


    Most certainly. As you can see with the example it does work, although work could be done to package it up in a nicer way.


    It's probably the overhead of running through python and lack of optimization with the renderer. Once I get things working I'll have a good outline of all the stuff that needs to run, and I could convert the bottle necked parts to C to avoid python. Also the GC could be an issue, I haven't investigated if I need to manually call it yet.

  • Well it certainly is quite the experiment.

    Good luck.

  • This time next year we will all be using ROJOwrapper It's all beyond me but I look forward to seeing how far you get with it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I just had a chance to test the example you posted and I am quite impressed so far. Good luck with the progress!

  • Here's an update demoing the ghost shooter tutorial, just without any text:

    https://dl.dropboxusercontent.com/u/542 ... ithpy2.zip

    This is what is tested as working:

    * Blend modes

    * Transparency

    * "Force own texture" and some of the Canvas and Paster objects

    *Sprites, Particles, Tiledbg and SpriteFonts

    * Mouse and keyboard input

    This is what is disabled, but won't prevent the game from loading:

    * The text object. It's actually partially implemented but was crashing so it's disabled.

    This is what is known to make a game not load:

    * The built-in physics behavior. It needs asm.js which isn't implemented.

    * Not all png images will load, they need to be at least 8-bit. :/

    * Any form controls.

    * Sound. It will probably not load if there are any sounds in the project.

    * AJAX only has enough implemented to load data.js, the object probably isn't usable.

  • Pretty crash-y for me, but it runs well while it runs, and it's awesome to see a real game going in there. I ought to dig out my old netbook and see what happens if I run it on there; rojo-wrapper supports windows XP right? <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    EDIT: have you tried anything crazy on it yet, like thousands of sprites, or a bunch of physics objects?

    EDIT EDIT: I couldn't get this to run, but maybe you can: https://www.dropbox.com/s/8blp1b2nrnnvt ... .capx?dl=0

  • The crashiness seems to be related to the Python wrapper for the graphics library from what I can tell, or I may have created an issue somewhere since it's been crashing a bit more for me lately.

    It might work on xp, if it doesn't I probably just need to tweak how the exe was made a little.

    I've tried capx with lots of objects and it seems to drop framerate. When the count is low it performs better than the browser, but with a lot the browser seems to hold out longer. Probably it's something I can improve. The bottleneck is going to be with renderer not js execution speed since it uses the same engine as chrome.

    Ghost shooter was just a convienient example. It can handle much more elaborate projects than that. I'll look into getting yours working tomorrow.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)