Friday, 26 October 2012

Light Mapping in HTML5

It took best part of two weeks but we now have light mapping in Freedom-Engine 3D and AGK, and can be seen running right now.

Simply visit and select the 3D - FPS Example, press PLAY and then run around the 3D scene. There is no collision in the Freedom-Engine version at the moment, and we plan to add optimisation on the media and the file structure for faster loading and smaller media files.

We're still in BETA, and both commands and engine are still work in progress, but you should be able to use this version to import your own OBJ and texture files, and start creating some interesting 3D scenes.  One very cool aspect of this version is that you can create vertex and pixel shaders right in the editor. Simply click to create a new source code file and then rename it with .VS for vertex shader and .PS for pixel shader. These files will then be used as media files when you use something like LoadShader ( 1, "vertex.vs", "" ) to load the shaders in.

Here is the source code that created the example above:

rem 3D Lightmapping
rem Artwork by Mark Blosser

rem Init app

rem Loading status
CreateText(1,"Loading Metro Theatre Scene")
CreateText(2,"Artwork by Mark Blosser")

rem Load world
gosub _load_world

rem Setup camera
plrx#=1850 : plrz#=-3650 : plra#=0 : eyeheight#=553

rem Start loop
DeleteText(1) : DeleteText(2)

rem Main loop
 rem Move camera
 if GetRawKeyState(38)=1 then MoveCameraLocalZ(1,4.0)
 if GetRawKeyState(40)=1 then MoveCameraLocalZ(1,-4.0)
 if GetRawKeyState(37)=1 then RotateCameraLocalY(1,-4.0)
 if GetRawKeyState(39)=1 then RotateCameraLocalY(1,4.0)
 rem Framerate prompt
 fps=ScreenFPS() : Print(fps)
 rem Update screen

 rem Shaders
 shaderindex=1 : LoadShader(shaderindex,"vertex.vs","")
 rem Load lightmaps
 dim lm[10]
 rem Load all OBJ making up world (created in FPS Creator)
 for obj=1 to objmax
  if obj>=1 and obj<=7
  if lm$="-" then lm$="0"
  rem Progress status
  perc#=obj : perc#=perc#/objmax : perc=perc#*100
  SetTextString(1,"Metro Theatre - "+str(perc)+"%") : Sync()

 next obj

I'm pretty buzzed about this version as it allows decent looking scenes to be created and played in a native HTML5 browser, no plug-ins need apply! In the near future we plan to get everything else in such as point and directional lighting for the built-in shaders plus more control over how your models are loaded in and how they are formatted for advanced shader features.

The next few steps is to make sure you can deploy these new 3D apps flawlessly, so you can share what you have created while you work on the latest version.

Wednesday, 17 October 2012

HTML5 and WebGL

I won't be having a blog next Monday as I am not in the office, so I have decided to post now to report on a cool tool that just saved me a heap of work. It is called WebGL Inspector and is a Chromium Extension for HTML5 developers using WebGL.

The link is :

Without this valuable way to step through every single event the WebGL performed during a single rendered frame, I would probably have never noticed the absence of two small state changes in the 150 state changes that represented by very simple 3D scene.

For those keeping up with Freedom-Engine progress ( this was the tool that helped me solve the 'missing 3D on a Mac' issue, as it turns out when the uniforms (like global constants) for the shader are collected, they are collected in a different order on the PC as they are on the Mac. In addition, it also highlighted a bug where I was only collecting the first of the shader uniforms meaning subsequent uniforms where being ignored. 

I often say that when you understand the question thoroughly, the answer presents itself.  Within every question lies the answer!

Monday, 15 October 2012

Transparent Computing


I would like to share with you an article I wrote to highlight the strong link between Transparent Computing, HTML5 and the work we are doing at TGC with AGK and Freedom-Engine.  As a treat for reading the article, you will find a link half way down the page which runs one of my Freedom-Engine apps I deployed about a week ago.

I did not need my own server, or pay broadband costs, or learn any fancy web languages either. I just knocked out a few simple lines of code, pressed the Deploy button in Freedom-Engine and I had an instant link I could share. It does not get any easier than this.


This blog would not be complete without something a little more light-hearted and a little less tech:

This is me, Virginia and Alistair (author of the Hands On Series) balancing precariously on the edge of a hill riding the new Segway X2 machines. Here is a video clip of the start and end of my one hour on two wheels.

I must confess they are the most unlikely method of propulsion but having rode on one, you suddenly realise they are extremely smart, super fast and the X2 model is all-terrain too which is immense fun!


My work sheet for this week is pretty packed with plenty of Freedom-Engine in addition to some side project work too, so keep your eye on the blog tab at for more news on what's happening in the team.

Thursday, 11 October 2012

Freedom-Engine Round-Up

I can't believe it's been a whole month since we launched Freedom-Engine at IDF 2012 and I've only now been able to clear my plate of the back-log of everything I brought back with me and ideas we had on the plane out there and back again.

We had plenty of things to do in anticipation of the Freedom-Engine Beta launch and in doing so we neglected to post updates to what was happening on the AGK side.  Fortunately this has now been addressed and we are now at Beta 2 of the AGK V108 which introduces over 180 new commands and we're looking at adding a few more before we release the update officially.

Blogs Blogs Everywhere

I will also be blogging almost daily on the Freedom-Engine blog tab but will also include any relevant AGK news in there as the technologies are so intertwined it would not make sense to do otherwise. I currently have a few logistical issues to deal with about where I should be posting my feeds. I now have this blog, the Freedom-Engine forum and the FE blog tab, the AGK forum, new newsletter articles and my own twitter feed.  We also have Facebook and Linked-In feeds which thanks to TweetDeck automates that with my twitter posts. I will probably be looking for a one-size-fits-all system so I can post something once and have it propagate across all my social end points. Phew!

My plate is not too hectic at the moment with only one side project (built using AGK/Freedom-Engine) and the usual drill of answering mail and replying to posts. This means I have a huge chunk of time to do nothing but solidify AGK and Freedom-Engine in three main areas; browser stability, command set completion and platform deployment.

Freedom-Engine Priorities

We're getting good on the browser stability with compiler time slicing to help the slower Firefox JS virtual machine and engine optimisation to hog less resources by default. Deployment is being handled by other team members who are doing a grand job and the first of the platforms over and above HTML5 should be live any day now. The command set completion lands squarely on my shoulders and is the largest of the tasks ahead of me.

The present Freedom-Engine was fleshed out with V107 functionality, with only partial V108 commands integrated which means there is a way to go before we can say we are 100% V108.  The good news is that when we reach that stage, it will become fully compatible with the AGK product and allow the same project code to work on both solutions.

At some point, to show the technology is essentially identical, we will be renaming AGK to something like Freedom-Engine Desktop (or similar) and slowly bring the AGK forum over to the new site.  We feel this is important as the perception is that there are two products, when in fact they are two sides of the same coin.

Ground-Walker or Cloud-Dweller

Some developers will always want to code on the desktop and store their files locally, and other developers see the benefits of moving entirely to the cloud and making their home there. As a team we believe this shift to cloud based solutions has only just begun and in a few short years you will find so many benefits to working on the cloud that developing on a local device will seem extremely restrictive.

In order to stay relevant (and to edge our bets), we are offering solutions for both approaches and by keeping the language, technology and ethos the same, the transition from one to the other will be smooth and natural.

For a current peek at what we have added to Freedom-Engine in the last few months, check out the V108 beta page for more details:

Voodoo Fun

I don't know where it came from but I had the urge to seek out and play an old computer game I used to play back on the VIC-20 called Voodoo Castle. At the time I remember getting really far but never finishing the game. Well I started playing at 11PM last night and was overjoyed to have completed the game by 1AM (admittedly cheating twice to google for clues). Whilst playing, it occurred that I also remembered a better game called The Count. This one was really tough as I recall, and I have promised myself the game as a treat for finishing some more commands next week.  Happy days!

Next Things On Lee's List

I am off to Scotland at the weekend to collect a consignment of tomes from my good friend Alistair Stewart and maybe to try my balance on a SegWay. If I can get a photo, I may post it here next time. I start my 'side project' on the following Monday which will test AGK V108 to it's core, and specifically the new video commands we've added recently. 

As part of and in addition to this work, I will be completing the command set in Freedom-Engine with an emphasis on the 3D commands. I know it's not everyone's cup of tea, and some would argue 3D in the native browser has yet to take hold but it's such an exciting technology that generates such innovation, I am eager to see what AGK and Freedom-Engine users can do with it.  There are other key command sets such as our file system (which will use the limited HTML5 LocalStorage system) and AGK Ultrabook Sensors which I can access from the Win32 side of the platform, and hopefully I can bring the features up in parallel until I have a complete V108 feature set for both AGK and Freedom-Engine users.

In the meantime I will tweet, blog, post and reply where I can, and hopefully keep you as informed as possible on what I and my team are getting up to between the weekends. Be safe and happy coding!

Lee Bamber
The Game Creators

P.S. These blogs remind me of a time I used to write a developer log many moons ago. The trick I failed to learn was to make sure you code more than you blog ;)

Monday, 8 October 2012

Ultimate Losers Blog

Beyond The Challenge

I enjoyed my blogging so much during the Coder Challenge that I have decided to continue posting. Just so my readership know, I totally failed to win the Ultimate Coder challenge. It was a hard fought thing, and in the end all the technology coding in the world does not mean a thing if in doing so I fail to deliver a compelling app experience. Lesson learned (I hope)!

Here's Mud In Your Eye!

I've decided to keep the Ultimate Coder Blog, not in reference to myself, which is clearly no longer the case, but in reference to you guys, who are all ultimate coders in your own right.  If ever I get big in my boots and start talking like some uber-coder, just remind me about Blog Seven and we'll say no more about it ;)

Another Ultrabook Competition

If you're astute coder with some free time, there will always be a competition for you to join. It just so happens the next one that caught my eye also centres around those incredible Ultrabooks:

Fortunately, you don't have to be overly ultimate to enter this one, and there are considerably more prizes up for grabs. I would act soon though as the deadline for the first round ends this month.

The great news is that most of the apps are for 'Desktop Apps' rather than 'Metro-style Windows Store Apps', and the destination of your app is the App Up Store run by Intel and their partners.  This is great because you can use existing tools to quickly produce your apps and get them running great on the Ultrabook!

We have just released the AGK V108 beta which includes all the commands implemented for my Ultrabook app, all empty but documented!  In the next month I will be adding some basic support for some of the Ultrabook sensors through the 'Desktop Mode' (which means Win32 with knobs on) which means your AGK apps can tap into some of the cool features of the Ultrabook.

This should give you a considerable jump on your competitors and allow you to focus on your app content rather than the 'how-to' of the technology. Be aware though that although the deadline for round 1 is the 24th October the sooner you submit your article for consideration, the sooner you will be picked to receive a free Ultrabook to code up your app so get cracking right now!

Freedom Has A Voice

In Freedom-Engine news, we've put extra man hours into the forums from now on to make sure AGK and FE users are catered for who have questions about this new technology. In fact, almost every team member will be trampling through the posts and making comments almost every day, so if you want some good advice on all things cross-platform, look no further:

We've also done some nifty additions to the HTML5 deployment feature so you can post a permanent version of your app on our server to show your friends and end users, even with the free account!

Thanks For Reading

Thanks for reading and I hope to post something else in a week or so.  For those in a competitive mood, good luck and happy coding!