C2 Wrapper EXE in C#

Discussion and feedback on Construct 2

Post » Thu Sep 15, 2011 1:29 pm

Hi Guy's,

The PoC I did in python ( Previous post ) but it wasn't very practical. My next attempt was to write a C2 wrapper in C# using webkit (via OpenWebkitSharp)that would let your C2 projects look and behave a bit more like exe's.

Essentially it's like having a webbrowser with no distracting controls on it to display your files on the desktop, in a way that makes it look like an ordinary application.



I tried using the inbuilt browser object in C# but it gave an error saying my browser could not render HTML5, I think it's cause I don't have IE 9 yet, so I'll need to do more testing.

To get it going you just need to unpack the zip and edit the settings.ini file (even if you are just testing the copy of Space Blaster included).

I've bundled it all up along with the source code and the HTML5 of Space Blaster as C2WebkitWrapper.zip (40 mb). All my test games worked OK but they arn't as intensive as something like Space Blaster so it was a good test. On my laptop I do get some lag here and their playing Space Blaster, but all in all the controls and sound are good. I've included a copy of space blaster in the package so you can see how it hangs together.

I've also included a Settings.ini configuration file. This let's you customize a few aspects of the Wrapper (I have to think of a better name). Like:

Name - Let's you customize what's written in the title bar.

Url - This is the location of you C2 exported game files, this can be on the local disk or on the internet. Local locations start with file:// instead of http://

Screen size: Adjusts the size of the exe's screen to suit your game.


Thoughts:

There's embedded versions of Mozilla's Gecko which I could try.

Also OpenWebkitSharp can use nightly releases of webkit that would probably run a lot quicker than the default Cairo 0.5. Also there's Awesomium (awesomium.com) that let's you embed chrome but it has a licence and it might get messy.

If I do get the embeded IE working it's not a great solution as you would have to ensure people are running something like IE 9, I'll post the results of that one as it's pretty easy to do.

In my mind the best mix would be something like webkit, C++ and GTK.
You could then compile for windows and Linux.

ShabbyCat2011-09-15 14:34:32
B
15
S
1
G
3
Posts: 47
Reputation: 1,912

Post » Thu Sep 15, 2011 1:46 pm

This is really interesting. Great work! How's the performance?
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Thu Sep 15, 2011 1:56 pm

Hard to say, Space blaster is laggy but a lot of other games I tried were fine. I think there's better versions of webkit I could be using as well, but early indications are promising.ShabbyCat2011-09-15 13:56:31
B
15
S
1
G
3
Posts: 47
Reputation: 1,912

Post » Thu Sep 15, 2011 3:12 pm

Great work! Very interesting stuff. I suppose it will work better if you enable 'fullscreen in browser' then just set the window size to match the game window size - then you shouldn't get any white margins.

Do these embedded browsers have hardware acceleration? I'm not sure if that comes with webkit/gecko, or if it's part of the browser itself. Hardware acceleration is a biggie.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,554

Post » Thu Sep 15, 2011 3:53 pm

I think the speed will vary from each implementation of webkit, the best would be to use c++, the python/GTK version plays Space Blaster with no lag but I couldn't get sound working.

I used Sunspider to do some bench marking as it also does 3d tests.

            Comparison        Webkit C#(OpenWebkitSharp)    Chrome(13)
3d:        2.45x as fast     102.8ms +/- 12.4%          42.0ms +/- 8.1%
cube:       2.54x as fast      32.8ms +/- 34.4%          12.9ms +/- 22.8%     
morph:      2.49x as fast      33.3ms +/- 40.3%          13.4ms +/- 8.4%    
raytrace:   2.34x as fast      36.7ms +/- 39.2%          15.7ms +/- 7.4%     


As you can see Chrome is consistently twice as fast.

But as far as 3d acceleration goes, I'm doing this on a laptop running XP with a 3D card but not sure if it's being used. But for what I have read webkit does do 3D acceleration.ShabbyCat2011-09-15 16:24:05
B
15
S
1
G
3
Posts: 47
Reputation: 1,912

Post » Fri Jan 11, 2013 5:15 am

leozin2013-01-11 06:20:54
B
8
S
2
G
3
Posts: 14
Reputation: 2,637

Post » Fri Jan 11, 2013 6:06 am

@leozin: The thread is from 2011
Yesterday the latest beta release that already provides a promising new solution to wrap to exe node webkit: r115 was released.

Please check the date of the threads in the future please.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Fri Jan 11, 2013 6:22 am

@Kyatric Sorry!
B
8
S
2
G
3
Posts: 14
Reputation: 2,637


Return to Construct 2 General

Who is online

Users browsing this forum: Andres941, tayxd, TheRealDannyyy, Yahoo [Bot] and 13 guests