Thursday, 6 October 2016

My CPC wolfenstein engine (history and progress)

I look back in my old emails and backup folders and repos, one of my biggest projects, beyond regular demos, to build a 3d maze wolfenstein engine for CPC. I was aware it's possible since coders in C64 and Spectrum have done this before and it doesn't involve anything other than fast software rendering and hard math (and a lot of sweat and tears).

Till this day I don't think it's complete, it's far ahead from the goal of perfect optimizing, part of it is still in C instead of assembly and there are few left muls and divs here and there to avoid. Meanwhile new ideas of cool things to do with this engine are coming through, only thing needed is the grand motivation to focus and work on it and hopefully a game.

Yesterday I released the first official playable preview of the engine, in four (six) flavours, you can find a download link here. You will need of course a real CPC or the Winape32 emulator and there are all the versions inside to try (64k, 128k, wolf/rpg, gx4000 cart).




So, some series of blogposts could be a good opportunity to remember the past and write my thoughts about the future, possibly motivating me to experiment more, improve things and occasionally post some progress here in the future.


  • 15th December 2010
    • It seems from my backup files, during that day I started working on some new projects and it's not just the first iteration of the wolfenstein engine (which was just the fast wall rendering algorithm without the raycasting yet) but also an unfinished 3d engine project (just rotating and projecting few 3d dots and later on rendering as points or lines). Fun fact, these were started in the old PhrozenC compiler (much much slower and more bulky in code size than the great SDCC I am currently using).
  • 29th December 2010
    • I release the first youtube preview of the engine. This is running at 25fps but that's because the math (distance of columns from camera) are precalculated data in memory for few frames. It's really the raycasting that it's costly and that's the only video where the engine looks pretty smooth but it's just wall rendering and zero math calculations. It looks nice as a teaser but the reality is a lie.
  • 10th January 2011
    • port to SDCC
  • 23th February 2011
    • First backup called Wolfenstration, so this could mean the start of my demo Wolfenstrad using the engine (Wolfenstration was ment too big for the logo designed by Voxfreax, so my brother much later said "Hey, why don't you just call it Wolfenstrad?")
  • 5th April 2011
    • Just as a parallel history (of the 3d engine I was designing for the purpose of doing flat 3d polygons, still pending) that's the day I started trying to write a triangle/polygon rasterizer. It's really a n-gon rasterizer, more suitable for flat color polygons (gouraud or texture won't interpolate evenly for each scanline unless you go triangles) of any number of edges. Used in 2d on my part in 30 years megademo. Still need to work in a future project to finally produce juicy flat and even gouraud cubes (my dream!).
  • 27th October 2011
    • It seems that during this day I started working on the RPG version of the engine, just moving one block per time and 90 degree rotations. The engine was much much slower and buggy even for that then (less than 5fps and would reset to AMSDOS at certain angles).
  • 18th March 2012
    • Wolfenstrad is released at Forever 2012 party. Finally a good use of the engine in a demo. There are many funny and interesting things about this. The real engine is still not playable (very very slow and crashing). In most of the scenes you are in a center rotating around but not moving. It's using a clever precalculating for this where 360 degrees of rays are calculating the distances before each part and you just scroll through these (but they have to be projected or fishbowl corrected to not look static). The walk through part is just precalced distance data I managed to fit. You can still realtime rotate through these scenes, so an adventure game where you fade in/out in new rooms and observe but not move would still be possible with this version. Interesting are also the effects on wall, most of them are pretty fast, based on column offset mapping tricks, an element of the engine which will be really really useful even on the game I prepare, both for fast special effects where you just change offsets of column lookup instead of changing the textures. Also suitable for fitting more textures ready for display in the limited memory and a special way to express them, so that you can have a pure wall and then a wall with a torch and then a wall with a lock without storing three times the texture. I really want to explain this feature in a future blogpost and what you can do with it, it's pretty cool!
  • 23th October 2015
    • Some weeks before this date there was a CPC gamedev competition and I thought I could maybe take part or just boost my motivation to work on this engine. I never finished the game I was planning (which I concluded it will be the rpg version now, it's an easier mode to avoid some tech problems in this engine and more interesting as a game than a pure FPS). But this compo forced me to relocate memory pages so that I have a port of the engine running on 64k CPCs. I even made a GX4000 cart version and released the first playable preview on youtube. That was the time that I used some optimization techniques to make this from unplayable to playable and fixed the problems creating crashes and some of the visual bugs but not all.
  • 9th October 2016
    • The decision was taken to upload the first playable preview so that CPCists can finally feel how the engine plays, walk near the walls (find the ugly glitches :), discover that the dream can be real (and there are still a lot to optimize and fix, this could be more smooth and nice). Such a preview was actually already shown privately at Reset demoparty although not the new RPG versions with knife weapon and ugly fading walls (the last experiments before I abandoned the project again). This is a decision I am fine with and it might release me a bit from the feeling of having worked with this sporadically for five -six years now and not having people see it in the real CPCs with their eyes. Meanwhile while doing so, looking the code again, trying to recompile, I started being inspired, thinking of some ways to fix some more bugs, how to experiment easily and fix the fade colors, try some new rendering stuff and gameplay elements I haven't thought before. I hope I will truly be motivated to work frequently with it (I have made a Trello account to organized plans and ideas for this and other projects to keep the ball rolling now) and post some blogpost or screenshot here and there.

So, truly a lot of things have happened in my life, mostly getting my master's degree, finding a new job and relocating to UK. The first version and demo was coded in Greece while I was unemployed and now remembered after I settled down here in UK. It's a long time, nice to remember how long it takes (although I wasn't working every day regularly on this, there were long pauses and comebacks).




No comments:

Post a Comment