Saturday, 19 January 2013

Saturday and Sunday

A Productive Weekend

I played some more Dishonoured, only to discover what I thought was a 'kill the bad guy' last level was NOT the last level, and the story stretches before my hero for new adventures. Played a little further (to 5AM) and called it quits as I wanted to be up on Saturday before 4PM so I could see the snow!

A Pie Filled Weekend

As my Raspberry Pi case and power supply arrived the previous week, I made it a point to try them out, and wow are they cool. Amazing what a bit of plexi and power cord can do for ones general outlook. I assembled the case around my 'naked' raspberry pi, plugged in the very sensible power supply and it sprang into life!



Of course I had to add an HDMI cable and display, mouse and keyboard, but I was in the desktop within 20 seconds and playing games and coding Scratch. I had hoped to get AGK onto the device on day, but the device is pretty underpowered compared to the devices I generally deal with, and it might be as well to focus elsewhere for the time being.  I do feel the device could do with a cool kick-ass B.A.S.I.C language built into the distribution so kids can discover the fun to be had with a basic device and a basic language. Maybe one day, if no one does this in the next few years.  I am sure we could boil AGK right down to run most commands on the device as it has everything we would need such as OpenGL, usual file and memory systems, network, e.t.c. It's still a great device and I get a kick every time I plug it in!

A Reloaded Weekend

My reference to productivity was not in respect to my Pi assembly, but my work on the very first pure Reloaded prototype. Drum role!  That's right, I've decided to start Reloaded coding today, the 20th January, ten full days before I had planned to start.  I could not resist.



My first challenge and prototype was the 'real-time light-mapping while editing at full speed'. Rather that wait for the 'build step' to make all your lovely light maps, what if the editor was constantly building them in the background (using threads) and then showing you it's progress within the editor as you create your level. Cool huh!  Well it was just a theory until I wrote some code to do it.  I say was, cos' I did it.

I thought I would need to write a whole new set of DarkLights commands to conduct real-time lighting of meshes, but as it turns out, the lighting scene can be reset and launched again pretty quickly.  I will still need commands to overwrite existing light-maps, and a few more concurrency tricks, but generally it went very well.  The proto took six hours or so, and on my machine achieves frame rates of 5000 fps with light mapping in the background taking it down to 4500 fps :)

I also took the opportunity to experiment and refine the area lighting approach to lighting a scene. Instead of dropping a single light in the scene, you add about 20 lights in close proximity, and they create much more realistic shadows and lighting on the surrounding scene. I have done a before and after comparison so you can see what FPSC Classic does and what Reloaded is going to do. I will let you decide which is which:



The prototype itself is also pretty cool. You can move the 'placement' object around the scene, and when it moves, the light mapper is triggered to work out a new set of shadows and lighting for all affected surfaces. If you keep the object moving too much, the system removes the old shadow of the object until you have made up your mind. Depending on the workload, the new shadow takes anything from less than a second to several seconds to be created (in the background) and then the mesh is 'double buffer swapped' instantly into view. In the meantime, because all this is done on a background thread, your main editing experience thumps along at thousands of frames per second for smooth experiences for the end user.

Finally, I added a mode to jump directly into my light mapped scene so I could see it from different angles which was very cool.  In the final reloaded, you will (should) be able to jump directly into the level and wonder about (and do some more editing) while the light mapper continues to work out which surfaces it has not yet updated and get on with the job of lighting.  Removing this 'light map waiting' is perhaps the largest bottle neck for FPSC classic users and should produce a great level editing experience.


YouTube Video Link: 

To further entertain you, here is my first blog video of 2013, which shows the finished prototype and the various modes I added to test my ideas. I am pretty happy with the balance of quality and performance in this one, and further work inside DarkLIGHTS module (a DBP plugin) will see this integrate nicely into Reloaded.

Prototype P002 will probably focus on the other big bottleneck from FPSC classic which was the occlusion system. The original version had a huge memory hungry system of constructing the entire level in a grid system, then working out what you could see through portals carved into this 4D grid database. It had the habit of eating massive chunks of memory and not giving it back so my thought is to throw it all away and think of the problem a fresh. I have had a few years to think about it so should come up with some solutions that work for us.  More on this in a future blog.

Signing Off

There you go, another big one, and on a Saturday, which I said I would not do! Ah well, now you know something of the mind of Lee. Can't even follow my own rules, even the ones where the paint is still wet!  It's 6:05AM now, technically Sunday, and I had planned to treat myself with some food and a Top Gear, but it pushes me dangerously into Sunday daylight. What to do, what to do. At least it's not a work night :)

10 comments:

  1. Cool! New light-mapping is very effective.
    I guess the lower one is from Reloaded, right?

    By the way, any plans to make segments a bit taller and less wider?
    It looks like a player is sort of a giant. I've got this feeling since original FPSC.

    ReplyDelete
  2. Lower once is reloaded yes. For the 'massive player' syndrome, it might be easier to allow the player height to be adjusted when editing the game. Segment assets will remain the same as I have plans for them :)

    ReplyDelete
  3. Thanks for quick response.
    It would be nice if height of the player could be customizable.

    ReplyDelete
  4. I remember reading about the games you have been playing it appeared that they just plopped in one light source. I might have misunderstood if that was what they were doing (or at least what it looked like to you). From this I was afraid you were going to make it more difficult to place more than one light source. So, I was very glad to see that it would be better to put in more light sources within a scene. I do that now with Classic. Of course, what is wonderful and as you say, "cool" -- that's my favorite word to use -- that with LM in the background things will be much faster. Indeed they will be. As you have to build the level with classic before you can see what the LM is and then once again do more tweaking of the objects or lights. Yes, this is soooooo cool.

    ReplyDelete
  5. I think we all secretly know what we want FPSC to morph into, I just have to make sure to listen carefully to those insightful inner whispers and use my hodge-podge of skills to figure out what can be done in the time we've got.

    ReplyDelete
  6. I just read your "Signing Off." I was wondering what was this "Top Gear" show you kept talking about. Here in the states we have what is called Netflix. They have available a lot of British television shows so I looked to see if they had Top Gear. Sure enough they did. I think over 100 episodes? It is a very interesting show and even though I'm not that much into cars I think I could get hooked. Although I'm still the mystery buff. Poirot, Miss Marple and more current ones such as Midsomer Murders, A Touch of Frost, Foyles War, and so on. Oh a couple of Irish ones as well. Taggart and I think Vera is Irish.

    ReplyDelete
  7. I am a mystery buff too (way more than cars), but I've seen them all ten times and know who did 'em ;)

    ReplyDelete
  8. This is the advantage of having dementia. :) I go through Frost and then go through Midsomer, then by the time I get back to Frost, I can't remember anything and watch them again. This is true. It may seem sad to some but I take life as it gives me and will always see the advantages. :LOL: Other's may see the humour in it as well which I do. I'm only on my second time around with them both and am starting the third time. I do remember parts now but still don't know who did it. That's what I like about the British mysteries; they have a lot more interesting twists. ;)

    ReplyDelete
  9. R-pi's do come with python which as pretty simple to use. Would love to see AGK on the pi, I agree 3D stuff may be more difficult, but it's quite capable of decent 2D stuff.

    Love the multi-point light system, although it.may be beneficial have have the option to set lights as either. Crisp shadows can look awesome too.

    ReplyDelete
  10. I agree the area / point light should be controllable in the editor so you can achieve the effect you want. I just want to automate it so you don't have to add twenty lights in close formation just to create the area lighting effect (imagine changing the colour slightly - ouch).

    ReplyDelete