Allegro.cc - Online Community

Allegro.cc Forums » Off-Topic Ordeals » Allegro HTML5

This thread is locked; no one can reply to it. rss feed Print
 1   2 
Allegro HTML5
Steve++
Member #1,816
January 2002

Has anyone thought of - or even attempted - porting Allegro to html5/javascript? It would be difficult or impossible to achieve a 100% port, but I'm sure it's possible to achieve a fairly high success rate. Porting of games would require some workarounds and sacrifices along the way.

A couple of options come to mind:

  • Create a javascript library.
    Allegro games would then need to be ported to javascript.

  • Use GWT 2.2 or greater.
    The Allegro library would be ported to the subset of Java supported by GWT. Games would then also be ported to Java.

Discuss.

AMCerasoli
Member #11,955
May 2010
avatar

I think that would be just great. Would make allegro even more popular and could be the definitive springboard of Allegro.

But since I have no clue how to do it, I never mentioned.

CursedTyrant
Member #7,080
April 2006
avatar

A while ago I'd say that javascript wasn't advanced enough for that, but, ever since I saw a port of Quake II to HTML 5, I'm not so sure anymore.

I'm voting HTML5, just because Java is such a pain to set up properly as a web applet and relies on third party user-installed plugins, while HTML5 does not.

---------
Signature.
----
[My Website] | [My YouTube Channel]

Tobias Dammers
Member #2,604
August 2002
avatar

because Java is such a pain to set up properly as a web applet and relies on third party user-installed plugins

GWT requires nothing but decent javascript support on the client. The Java part is server-side only; GWT includes a java-to-javascript compiler.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Steve++
Member #1,816
January 2002

You need a decent browser of course. Anything but IE should do.

I'm voting HTML5, just because Java is such a pain to set up properly as a web applet and relies on third party user-installed plugins, while HTML5 does not.

You may have misunderstood the GWT option. GWT compiles a subset of Java to JavaScript. So the result of both options is HTML5 + JavaScript. The are many advantages to this approach, such as using a stricter language than JavaScript (less opportunity to shoot yourself in the foot) and the ability to leverage existing Java development tools such as NetBeans. However, the relative complexity of setting up an environment and project may scare some hobby coders.

EDIT: Beaten ::)

EDIT:

The Java part is server-side only; GWT includes a java-to-javascript compiler.

You don't have to have a server side. GWT makes it fairly easy if you want to.

Dennis
Member #1,090
July 2003
avatar

While we're at it, we should start thinking about creating the Allegro GDL (game development language).

Roadmap to revision 1)
step 1) determine and define a fixed set of hardware requirements (inputs/outputs) for existing/non-existing machines on which the Allegro GDL can be implemented
step 2) determine and define a fixed set of functions the Allegro GDL must support (audio/video/input device abstraction/persistence layer/mathematical routines/memory management/etc.)
step 3) define syntax and semantics of high level Allegro GDL
step 4) make compiler which turns high level Allegro GDL source into tightly packed bytecode (microprogramme ready to run on the Allegro VM)
step 5 to n) implement Allegro VM for each target platform (start with the ones for the platforms already supported by the current Allegro5, which just interprete the bytecode and translate it into native Allegro5 calls for proof of concept)
step n+1) ???
step n+2) PROFIT!!!

Steve++
Member #1,816
January 2002

You're as mad as picollo.

Dennis
Member #1,090
July 2003
avatar

Well, the Allegro VM and the Allegro GDL would have an obvious advantage over porting every allegro game to HTML5:
Instead of porting each allegro app/game separately, you'd only have to port the Allegro VM to HTML5 (and every other vaporware fad platform being in development currently or in the future).

To pull in current applications and games written using the Allegro5 library for C, all you'd have to do is write a translator from C/C++ to Allegro GDL or port each game to Allegro GDL manually (much like you'd need to manually port each game to javascript or java as you stated in your OP).

type568
Member #8,381
March 2007
avatar

Does a port mean that I can actually code in C(with some limits), and get the game running on JS/HTML5? :o

Dennis
Member #1,090
July 2003
avatar

No. It means the whole (or just the parts possible within the limitation of HTML5) library (as in each and every function listed here) would be re-implemented in HTML5 and Javascript to behave exactly (similar for compromise cases where exact replication of behaviour is impossible) like it does when used in a compiled C programme for any of the currently supported target platforms.

You'd then still have to re-implement your game written in C, using the JS/HTML5 port of Allegro5, in JS/HTML5 to use it. In other words: Allegro5(JS/HTML5) would be a whole different project with a similar API but no source compatibility between a game written for that and a game written for the current Allegro5.

type568
Member #8,381
March 2007
avatar

Then it's reinventing the wheel to some degree..
Thanks for explanation.

Billybob
Member #3,136
January 2003

An HTML5 library in the spirit of Allegro makes sense, and would be very nice. A direct port, on the other hand, does not make as much sense. The API really should be adjusted to suit JavaScript's style.

Having said that, as much hope as I had for HTML5, it is still in it's infancy and is very unstable and slow (using WebGL might help with rendering speed).

Another interesting idea would be porting Allegro as-is to Native Client. Then existing Allegro games could be easily recompiled and run in the browser.

bamccaig
Member #7,536
July 2006
avatar

^ This. You can't really port Allegro because you have no low-level access. You have to use the calls available in JavaScript, and attempting to reproduce the Allegro API in JavaScript and HTML5 is probably going to produce something that is incomplete and suboptimal. A better option is to write a completely different library based on JavaScript and the HTML5 API's available. Designing the API based on what is available will give you something much more useful. JavaScript is much higher-level than C and supports a number of very useful features that should be put to use.

type568
Member #8,381
March 2007
avatar

So we need a virtual machine :-/

bamccaig
Member #7,536
July 2006
avatar

I'm pretty sure (read: hoping) that Dennis was just being funny to point out how stupid this is. :P No offense to the OP. :-X

AMCerasoli
Member #11,955
May 2010
avatar

Yes, but tell me that wouldn't be great!

Steve++
Member #1,816
January 2002

Billybob said:

An HTML5 library in the spirit of Allegro makes sense, and would be very nice.

This is pretty much what I meant. Port was probably a poor choice of word. Essentially, the idea is to assist the porting of existing Allegro games to HTML5/JavaScript by providing an abstraction layer resembling Allegro as much as possible.

The notion that HTML5 is a fad that will soon pass is beyond ridiculous. It is simply the next iteration of the HTML standard. It just so happens that it provides an excellent opportunity to easily distribute games using open standards and no browser plugins. The standard may be in its infancy, but there are already some excellent examples.

bamccaig said:

I'm pretty sure (read: hoping) that Dennis was just being trying to be funny to point out how stupid this he is.

Matthew Leverton
Supreme Loser
January 1999
avatar

Steve++ said:

excellent

Now that is beyond ridiculous. 8-)

bamccaig
Member #7,536
July 2006
avatar

Steve++ said:

Essentially, the idea is to assist the porting of existing Allegro games to HTML5/JavaScript by providing an abstraction layer resembling Allegro as much as possible.

Please explain why you believe that "resembling Allegro as much as possible" is a good thing for a JavaScript library based on HTML5. Personally, I think that the smart thing would be to study the existing HTML5 API and design a library off of that instead of trying to mimic Allegro. To assume that Allegro's API is the one true API is just silly, IMHO... Allegro was designed with dependency and language limitations kept in mind. Limitations that might not apply to JavaScript and HTML5. Why reinvent the square wheel?

Billybob
Member #3,136
January 2003

Steve++ said:

The standard may be in its infancy, but there are already some excellent examples.

Actually, I had no problem with the standard. And I hope you didn't take my post to mean I thought HTML5 was a fad (it's not).

The issue right now is incomplete, buggy, incorrect, and slow implementations in various browsers. All that adds up to one point: It's not practical to make a serious browser-based game in HTML5.

Having said that, I totally support an Allegro-like HTML5 library; even now. The great thing is that the problem isn't the standard, it's the implementations. So you could easily write the library now, and just sit on it and wait for the browsers to finally catch up.

bamccaig said:

You can't really port Allegro because you have no low-level access

On that note, porting the OpenGL sections of A5 to WebGL equivalents might not be so bad. It's the rest of the API that's an issue :P

Mark Oates
Member #1,146
March 2001
avatar

I had a similar idea, but it ultimately boiled down to "create a game framework for Javascript". At which point I only flirted with the idea, creating a canvas/object/timing structure.

Billybob said:

I totally support an Allegro-like HTML5 library

I also support the idea. To be honest, I'm surprised I haven't run into a html5 "game" library yet.

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Steve++
Member #1,816
January 2002

bamccaig said:

Please explain why you believe that "resembling Allegro as much as possible" is a good thing for a JavaScript library based on HTML5. Personally, I think that the smart thing would be to study the existing HTML5 API and design a library off of that instead of trying to mimic Allegro. To assume that Allegro's API is the one true API is just silly, IMHO... Allegro was designed with dependency and language limitations kept in mind. Limitations that might not apply to JavaScript and HTML5. Why reinvent the square wheel?

Happy to explain. The purpose is to assist porting existing Allegro games to the browser, not necessarily creating new games.

Dennis
Member #1,090
July 2003
avatar

Quote:
bamccaig said:

I'm pretty sure (read: hoping) that Dennis was just being trying to be funny to point out how stupid this he is.

Relax man, relax. There is absolutely no need to get personally insulting in response to not getting an elaborate joke (with a grain or two of truth in it) and failing to see how it is a constructive contribution to the discussion (and that's what I assumed you wanted to start when you wrote "Discuss." in your OP).

Besides, I am not the one who said anything was stupid nor was I trying to point it out to be just that.

I am mocking the whole "write once, run anywhere" myth, making fun of the fact how the common solution to portability problems always seems to be to shift the problem to another layer (new VM).

With HTML5/JS and all the "run everything inside the browser" fad, the browser becomes just that, another VM (with a quite underdeveloped standard language for programming it (JS/HTML5) and sluggish performance due to all the extra layers and awesome "new" features like "local storage" wow... now we're allowed to write and read files for use by our programmes!!! omg wtf, what's next?! frozen pizza?! Sorry, I was taken away for a moment.

What's ridiculous is how it's already going into the other direction already again with technologies like Silverlight for example, marketing "can run standalone outside of browser" as an awesome new feature.

Surely, a game programming library for JS/HTML5 would be nice and useful, but for me, a huge piece of the Allegro spirit was always it's high portability. So to make that right once and for all time, an own language and an own portable VM (and eventually own chips) would be the only logical way to go.

This would ensure that existing (written in Allegro GDL then) Allegro games could be more easily ported to new platforms, long after JS/HTML5 are old/gray/outdated and obsolete, because you'd just port the VM to the new platform and get each game port for free.

bamccaig said:

Personally, I think that the smart thing would be to study the existing HTML5 API and design a library off of that instead of trying to mimic Allegro. To assume that Allegro's API is the one true API is just silly, IMHO... Allegro was designed with dependency and language limitations kept in mind. Limitations that might not apply to JavaScript and HTML5. Why reinvent the square wheel?

I could not agree more (I should see go see a doctor. Doctor: "What's the problem?" Me: "I agreed with bamccaig." Doctor: "wtf?").

And another question is, if HTML5 is not already high level and straightforward enough to just use it directly without another layer on top of it?

If I were to port one of my existing games/apps(using Allegro) to the browser, I'd probably rather do a rewrite and use everything available on the browser platform than trying to force the old structure into the new one.

It would be like porting a C64 basic programme to C but refusing to accept the existence of functions and return values and keep using gotos and using a global variable to store the jump back label to mimic gosubs (I have actually seen someone write Pascal code like that... it works of course and shows the programmer knows something about how computers work on a low level but it wasn't the best way to use the new technology available to him).

Neil Walker
Member #210
April 2000
avatar

Steve++ said:

The Allegro library would be ported to the subset of Java supported by GWT. Games would then also be ported to Java.

I know nothing, but is GWT another part of the failed google gears? On the subject of java, a full java port would be nice then you could do something like minecraft and have a java/standalone version. Then again, you can do that with the .NET port...

Neil.
MAME Cabinet Blog / AXL LIBRARY (a games framework) / AXL Documentation and Tutorial

wii:0356-1384-6687-2022, kart:3308-4806-6002. XBOX:chucklepie

Steve++
Member #1,816
January 2002

Dennis said:

Relax man, relax.

Couldn't help it. It was a setup and, in the tradition of a.cc, I had to fix it. No personal insult intended.

I know nothing, but is GWT another part of the failed google gears?

Not at all. GWT at its heart is a Java to JavaScript compiler, producing cross-browser JavaScript. It is a bit more than that, though. Take a look for yourself. It has been around for a while and is considered reasonably mature now. The latest version introduces HTML5 canvas, audio and video support.

 1   2 


Go to: