Pas2js with generics rocks (and makes Castle Game Engine for WebGL possible)

Posted on

pas2js-generics
pas2js-webgl1
pas2js-webgl2

pas2js can translate modern Object Pascal to JavaScript, making it possible to run Pascal code in a WWW browser. In the past, pas2js didn’t support generics, which made porting CGE to it troublesome, as we use generics a lot.

This weekend I tested recent pas2js support for generics, in particular with containers from the Generics.Collections unit. I tested 4 examples from my book about modern Pascal. …And the result is that everything just works! đŸ™‚

This means that pas2js supports generics at a level we need for Castle Game Engine, so in general should be able to handle CGE Pascal code. Pas2js also supports WebGL rendering since a long time, since it can just call JavaScript API in a browser.

All this means that we have everything we need to port Castle Game Engine to WebGL! That is, your games could be recompiled to just run in a WWW browser. No installation, no extra steps for the user. Anyone can open your WWW page and the game works, with Pascal code being translated into simple JavaScript that browser can efficiently execute.

I will work on this feature intensively after CGE 7.0 release.

Start the discussion at Castle Game Engine Forum