Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: RickJ on Mon 15/03/2010 21:46:47

Title: [Discussion] Feasibility of AGS native web runtime
Post by: RickJ on Mon 15/03/2010 21:46:47
I have been researching current web technologies such as java script, ruby/rails, python, ajax, html5, etc for an upcoming project (day job).  It has occurred to me that capabilities such as html5's canvas, java script's interval timer and asynchronous request, and a little help from the server via  PHP, Python, Ruby or C that it ought to be possible to implement some sort of runtime game engine that could run in a browser.

As a mater of intellectual curiosity I would be interested in discussing this possibility and it's pro's and con's with those of you who are more familiar with the specific tech involved.  We can use AGS as a common basis for the discussion since we are all very familiar with it and it's capabilities.   

Let's limit ourselves to the technical issues.  This far removed from being a practical suggestion for AGS and talking about practical, logistical, political, and other aspects would be uninteresting and counter-productive at this point.



I have a superficial knowledge and a naive point of view at best but here is what I think I know about all this:

HTML5
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: SpacePaw on Mon 15/03/2010 22:13:32
I would keep everything but saves on the server side and just process mouse clicks. But to re-make the engine in those technologies would require much much much coding. Or even mucher! Or even the muchest!

EDIT:
and seriously...It's much better to just run the game on the server and send the rendered frames to the user just like microsoft and others are planning to do lately.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Dualnames on Mon 15/03/2010 22:36:01
RickJ, I'm glad you're actually putting this into discussion. First, I think, without wanting to kill anyone's dream, that it would require someone to actually port/transform AGS. But if we think very simple, I think in a very short period of time, it can be done.

Also just noticed the part of your post, that includes what I've said, so I'm going to draw a line and actually get on with details.
Literally:


HTML 5
Seems very useful, if indeed it ends up equally or even more flexible than Allegro. I think it can also provide more abilities and functions to AGS.

JS
This is actual the core of your ideas, and to no wonder. JavaScript pretty much dominates the whole internet nowadays, on the sector of flash based applications.

BED
I don't think it's a bad thing to have savegames on the client side. I'm not sure however how parts of the code that run from the server side, would actually help out performance. On a room change it's like okay to load the individual room script. It should be noted that module scripts and global script should run on the client side, otherwise it would seriously mean a waste in performance.



Also, I'm not very familiar, so I'm actually wondering on two other things: D3D capabilities and performance with the equivalent Drawing Surface and Dynamic Sprite functions on JS and HTML 5.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: SSH on Mon 15/03/2010 23:32:53
Check out http://code.google.com/p/js-gam/

There was another javascript proof of concept called "Nature Boy" with a doom sprite walking around a desktop but I can't find it again...
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Wyz on Mon 15/03/2010 23:39:44
That's an exciting idea! :D
Well, very well put outlines there. AGS has no native network support, and hence it does not need to communicate to a server. Running something like this entirely client-side would be a great performance improvement actually. Todays JavaScript interpreters are quite good, and can do pretty amazing things even on low-end computers; It could work, absolutely. I'm not familiar with HTML 5, but I do know it's still in development. It will take some time before all browsers support it and all of it's features.

About save games: it is perfectly possible to generate a downloadable game state XML file, but I would offer the possibility to store it server-side too. Not because it would mean people have to login or something, but mostly because not all users will understand what a XML file is, and how it relates to the game. Server side will be more convenient for a lot of folks I expect. That will be the only thing that needs to communicate with the site after the game content has been downloaded, well that's not so bad. You could also generate high-scores and achievements in that fashion. But I would still allow the possibility to store it in a XML file, for the more experienced users that like to play it completely offline.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: RickJ on Mon 15/03/2010 23:43:54
Quote
... But to re-make the engine in those technologies would require much much much coding. Or even mucher! Or even the muchest!
It's given that a lot of work goes into making a runtime game engine (and even more in the IDE part of it) and that some languages are easier to work with than others.   The JS language has a syntax similar to C/C++ and Java and seems to be much more forgiving in many respects than either of the other two.  So I am curious as to why it would be so much more work in JS?  

Quote
and seriously...It's much better to just run the game on the server and send the rendered frames to the user just like microsoft and others are planning to do lately.
Again I curious, in what way would it be better?  The obvious down side is that it would not scale as well and consume much more server resources.  Performance would be held hostage by server/ISP/Internets response.  If I understand correctly a rendered screen would be downloaded every 40ms or so which would require much greater bandwidth.

Quote
I don't think it's a bad thing to have savegames on the client side. I'm not sure however how parts of the code that run from the server side, would actually help out performance.
It's preferred to keep save games on the client side.  The problem is that browsers will not allow JS to do file I/O on the client side.   So on a room change any room variables that need to be persisted will have to be sent to the server and stored in a session file.    If the player re-enters that room then the data will be sent back to the client.  If the player does a save game then the server will write the session data to a file and the client will perform a download operation.


Quote
On a room change it's like okay to load the individual room script. It should be noted that module scripts and global script should run on the client side, otherwise it would seriously mean a waste in performance.
Right, that's what I intended to say in the first post.  Sorry if it was confusing.

Quote
Also, I'm not very familiar, so I'm actually wondering on two other things: D3D capabilities and performance with the equivalent Drawing Surface and Dynamic Sprite functions on JS and HTML 5.
I believe the HTML canvas element is 2D only.   I don't think there is anything in HTML or the Canvas element that gives access to lower level drivers or optimizations.   So I guess it would be up to the specific browser to take advantage of things like D3D.  I don't know any more than you and am mostly guessing.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: SSH on Tue 16/03/2010 03:39:05
The advantage of having some game logic on the server side is that it can be used as copy protection and prevent cheating by reverse engineering. The disadvantage is that you need a working connection to play. Maybe a way in which the connection was only used rarely (savegames, changing chapters, changing rooms) might be best?
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Clarvalon on Tue 16/03/2010 05:59:25
In theory it's a great idea - HTML5 should, at some undetermined time in the future (it has been a slow process) gain support  from all the main browsers, including smartphones etc.  That near-universal support would be a fantastic way of easily distributing games to the broadest spectrum of people.

In practice, I can't help but feel that writing an engine of that size and complexity in Javascript would be an absolute nightmare.  It's hard enough in a proper language.  Even with the original source code, it would take an incredible amount of dedication and perseverance on behalf of the coder.

A lot of people are hoping that HTML5 will render RIA plugins (Flash, Java, Silverlight, Unity etc) obsolete, and I can understand the reasons for wanting reliance on proprietary technology removed.  But to be honest, I just can't see HTML5 & Javascript replacing the functionality and level of quality these plugins provide anytime soon.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: RickJ on Tue 16/03/2010 07:48:59
Firefox 3.5 supports OGG video in HTML video element.  You can see a short demo at the link below (if you have firefox of course).   It's my understanding is that it's a problem of politics rather than implementation.   It's also my understanding that Firefox and Safari are going ahead with implementation even though proprietary vendors don't want to agree.   

http://en-us.www.mozilla.com/en-US/firefox/3.5.8/firstrun/
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: RickJ on Tue 06/04/2010 23:33:08
As follow-up to this discussion I found this video lecture about the capabilities of HTML 5.  It answers some of the questions that came up in this thread.  So for anyone interested please feel free to enjoy:

http://developer.yahoo.com/yui/theater/video.php?v=neuberg-html5
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: InsertCoin25 on Thu 12/08/2010 02:26:06
This might not fit into your discussion but you could give this a look if you are looking to put your games in a browser. Works well :)

http://www.osakit.com/

InsertCoin25
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Dualnames on Thu 12/08/2010 02:47:04
Quote from: InsertCoin25 on Thu 12/08/2010 02:26:06
This might not fit into your discussion but you could give this a look if you are looking to put your games in a browser. Works well :)

http://www.osakit.com/

InsertCoin25

Seems totally interesting as a matter of fact I'm checking this out. Thanks a lot for that link!! :D
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Denzil Quixode on Thu 12/08/2010 11:18:06
(I know this is an old quote but anyway)
QuoteGame Script - JS has a very similar syntax and capabilities as AGS script with a few differences that would appear to be easily translatable from one language to another.

The main problem would be transforming "blocking"/"synchronous" functions to "non-blocking"/"asynchronous" ones. For example, the AGS script:

function myfunc()
{
 player.Say("Hi there!");
 npc.Say("Hello!");
 Wait(40);
 player.Say("Well... goodbye.");
}


...now, the player.Say() call may take several seconds to complete. But that isn't allowed in Javascript - if code takes too long to complete, the whole browser/tab can hang, or it will pop up a message saying something is taking too long to complete. So you would need to find a way to transform "blocking" to "nonblocking". In Javascript you can pass around functions like variables, so you can pass a function that says what to do once an action has been completed:

function myfunc()
{
 player.Say("Hi there!",
    function() {
      npc.Say("Hello!",
        function() {
          Wait(40,
            function() {
              player.Say("Well... goodbye.");
            });
        });
    });
}


Ugly! And also, what do you do if myfunc() wants to return a value...? And how do you deal with while() { } loops...?  ;D

Not an impossible problem to overcome, probably, but a pretty big hurdle.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Monsieur OUXX on Thu 12/08/2010 14:39:34
Like others I agree that it's very (too much) ambitious to start a new engine from scratch.

I'd recommend to put more work into converters, like the limited one that exists for XAGE. It'd be cool if a game could be easily exported by its maker, to be played in other, stable engines targetting other platforms.

For instance:
- a web browser (using, for example, the engine shown earlier in this thread),
- Flash (with Lassie),
- XBox (using XAGE),
- etc.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: subspark on Tue 17/08/2010 23:40:37
RickJ On HTML5:
QuoteI don't know the full extent of it's capabilities or how they would compare with what Allegro offers.

Hey Rick, I'v done some research into HTML5 (I've been developing in it lately) and tracked this down:
http://code.google.com/p/quake2-gwt-port/ (http://code.google.com/p/quake2-gwt-port/)

HTML5 is VERY powerful indeed. I have very little doubt it could be used as a SCUMM interpreter or a platform for our AGS games.

Cheers,
Sparky.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Dualnames on Wed 18/08/2010 06:27:02
Quote from: Dualnames on Thu 12/08/2010 02:47:04
Quote from: InsertCoin25 on Thu 12/08/2010 02:26:06
This might not fit into your discussion but you could give this a look if you are looking to put your games in a browser. Works well :)

http://www.osakit.com/

InsertCoin25
Seems totally interesting as a matter of fact I'm checking this out. Thanks a lot for that link!! :D

I tried a lot to make this work, but the program always ended up crashing on me, and I had to re-type everything again and again.
If anyone managed to make this work, or does in the future, show us and tell us how. ;)

Quote from: subspark
HTML5 is VERY powerful indeed. I have very little doubt it could be used as a SCUMM interpreter or a platform for our AGS games.

HTML 5 is powerful but like mOUXX said. If we're gonna take lots and lots of trouble to export a game into some other platform, it's not ideal. Not to be the asshole,but we all rather script our own engine than bother to do the same amount of work to covert our AGS game to another platform.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Shane 'ProgZmax' Stevens on Wed 18/08/2010 19:47:03
It would actually be better if CJ handed off the source to someone to build an interpreter in something like Flash since it's so widely used.  I'd actually be all behind this and would love a crack at such a project since I've been itching to make the move to web-based games in actionscript but just haven't had enough of an excuse.  It would be lovely to be able to host ags games directly through web apps so people could either play them virtually on my site or download them to play locally.  Now, I probably wouldn't use it for large games, but for short games it's a great way to get people playing your stuff without much hassle.  A quick trip to kongregate.com should convince anyone of this...I've wasted so many hours at that site!
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Calin Leafshade on Wed 18/08/2010 19:49:53
I'm with progz on this one.

I'm afraid when it comes to short games the browser is where it's at and where it will stay.

Although maybe HTML5 would be a better renderer.. i hate flash.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: subspark on Thu 19/08/2010 02:59:37
I must agree with Calin. Flash is sliding down the www gurgler.

Cheers,
Sparky.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Denzil Quixode on Thu 19/08/2010 10:05:27
I've been working on a prototype of a port of the AGS demo game in Flash. (Sorry HTML5 fans.) It's not based on any official AGS code, so it won't be compatible with existing compiled game formats and would need a special editor plugin to export a game (which I haven't made, this is a hardcoded demo specific to the game). There's only one room and the inventory GUI doesn't work so far:

http://octospherics.com/toolbox/Loader.swf
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Calin Leafshade on Thu 19/08/2010 10:21:02
flash has the very serious problem of not being able to catch right clicks.. i guess you could emulate it with ctrl-click or something.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Denzil Quixode on Thu 19/08/2010 10:44:30
Yeah, that is a problem that would need to be overcome on a game-by-game basis. Flash also won't let you reposition the mouse or restrict it to a section of the screen, although thankfully those AGS features are rarely used. (Also, personally I stop normal HTML/JS pages from overriding the right-click context menu behaviour too, with the advanced JS settings in Firefox, because of crappy sites that abused it to pop up "DON'T STEAL FROM ME!!!", so for me HTML5 would have the same problem...)

One cool thing that Flash can do: since version 10, it is capable of dynamic audio generation. What that means is that Flash programs can support music formats that weren't built in, like .MOD:

http://www.photonstorm.com/flod (pure-Flash .MOD player)

I've also seen a work-in-progress one for .XM which was already close to completion. Because of these I'm sure a .MIDI one would be possible too, although I haven't found one yet.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Wyz on Thu 19/08/2010 13:15:40
The right click issue is a pain :( but the rest looks splendid!
I'd be very interested in a web-browser port, either Flash or combination of html5 or JavaScript, as long as it works ;D I think HTML5 also has a lot of potential, but is yet to mature, so maybe in the future. JavaScript would be a lot of work I guess.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: subspark on Fri 20/08/2010 01:34:06
Hey that looks pretty cool Denzil!

On a semi-related note, I wonder if anyone's working with porting to Silverlight?

Sparky.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Calin Leafshade on Fri 20/08/2010 09:34:43
XAGE is silverlight compatible.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Clarvalon on Sat 21/08/2010 03:02:51
Quote from: Calin Leafshade on Fri 20/08/2010 09:34:43
XAGE is silverlight compatible.

As of a few minutes ago, XAGE now runs natively on Linux too:

(http://i360.photobucket.com/albums/oo42/clarvalon/XNA%20-%20PnC%20Engine/XAGEUbuntu2.png) (http://i360.photobucket.com/albums/oo42/clarvalon/XNA%20-%20PnC%20Engine/XAGEUbuntu2.png)

Coming Soon:  AGS games, playable on a microwave (http://www.handlewithlinux.com/linux-washing-cooking) near you.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Dualnames on Sat 21/08/2010 03:10:27
That reminds me i should send you the stablest of versions of HHGTG. But I always forget it. ;)
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: subspark on Sun 22/08/2010 06:38:46
Nice work peoples!! Wow we're really starting to branch AGS out now aren't we!

QuoteXAGE is silverlight compatible.
Thats right I forgot.

Coolies.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: xenogia on Sun 22/08/2010 07:22:17
Quote from: clarvalon on Sat 21/08/2010 03:02:51
Quote from: Calin Leafshade on Fri 20/08/2010 09:34:43
XAGE is silverlight compatible.

As of a few minutes ago, XAGE now runs natively on Linux too:

(http://i360.photobucket.com/albums/oo42/clarvalon/XNA%20-%20PnC%20Engine/XAGEUbuntu2.png) (http://i360.photobucket.com/albums/oo42/clarvalon/XNA%20-%20PnC%20Engine/XAGEUbuntu2.png)

Coming Soon:  AGS games, playable on a microwave (http://www.handlewithlinux.com/linux-washing-cooking) near you.

How far you into completing the engine? I would love to use this.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Clarvalon on Sun 22/08/2010 09:22:49
Bearing in mind that I stated XAGE was 70% complete back in 2008, it's fair to say that providing workable estimates is not my forté.  I have a bad habit of adding new functionality and new platforms rather than focusing on polish and regular releases (my SpecialLadyFriend rather sardonically accused me of planning to add support for unicorns).  Plus I have young, growing family and other burdens commitments so I'm a bit like Vince Twelve but without the chronic insomnia.

Life story aside, the engine is stilll undergoing some large changes in terms of handling interface.  I'm using Ben's ! to help me iron out a few issues before returning to Time Gentlemen, Please.  XAGE will be a lot closer to v1.0 after I'm done with those.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Joseph DiPerla on Tue 24/08/2010 18:56:44
So Clar, from what I understand, XAGE is its own Game engine, yet you can convert AGS Games to XAGE and play it on several systems?
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Clarvalon on Tue 24/08/2010 19:41:33
Yep, that's right.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: Denzil Quixode on Thu 28/10/2010 12:38:58
I've started my own JavaScript library (MIT License) for bitmap mask-based path finding which might be a useful component to anyone interested in doing a point and click adventure game, or game engine, in JavaScript/HTML5.

Here is a simple demo (should work in recent versions of Firefox, Chrome, Opera):

http://mbpf.googlecode.com/svn/trunk/js/test/mbpf-html5-test-simple.html (http://mbpf.googlecode.com/svn/trunk/js/test/mbpf-html5-test-simple.html)
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: subspark on Thu 28/10/2010 21:54:37
Hey! Neato pathfinding.  :)

Sparky.
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: limbo on Sat 30/10/2010 21:55:13
Incidently, have you talked to the people behind sarien.net? They have somehow brought the old Sierra games, like Space Quest, Police Quest and King's Quest to the web. These games are not built in AGS, of course, but the functionality requested is almost the same. Unfortunately the games are still buggy, I haven't been able to access the inventory, for example, but it's there. As far as I can tell (http://sarien.net/about), there is still a lot of manual work to do to convert a game, but maybe they have some ideas about what not to do.

One neat thing is game save, which is solved by asking the user to bookmark the saved page, the url of which has a special hash added to it when requesting a save, like "http://sarien.net/spacequest2#fDExNCw1MiwwLDAsMHwwLDUsMSw... "

Another thing is the multiplayer functionality, however limited to online chat with the other players in the room at the time.

Not a lot has been covered concerning that project over here, but a search for "sarien" on the forums givs this hit: http://www.adventuregamestudio.co.uk/yabb/index.php?topic=37556.0
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: benco on Tue 18/01/2011 13:11:35
Quote from: subspark on Tue 17/08/2010 23:40:37
RickJ On HTML5:
HTML5 is VERY powerful indeed. I have very little doubt it could be used as a SCUMM interpreter or a platform for our AGS games.

Actually, there is already someone working on a SCUMM interpreter in JS (mostly based on the ScummVM code), proving it's feasible - I tested it and basically, it works :)

https://github.com/mutle/jsscummvm
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: RickJ on Sun 31/07/2011 21:54:42
Just found a new open source mobile development framework but haven't had a chance to check it out yet.  It looks promising and may be relevant to this thread.  Thought I'd share.

http://www.phonegap.com/
Title: Re: [Discussion] Feasibility of AGS native web runtime
Post by: subspark on Thu 04/08/2011 00:40:49
Also for those interested in flash, right-click was intercepted via AS3 a fair few years back.
Go splat your rat over here:
http://www.uza.lt/rightclick/ (http://www.uza.lt/rightclick/)