Tuesday, 1 November 2016

Progress Report (CPC Wolfenstein RPG: raycast errors and naive zoom)

I haven't gotten to write my articles on the mapping and raycasting techniques yet, these need more motivation or time (and I rather spare it for coding the engine) but I decided to give from time to time some progress report on whatever I am working (this might even include other things I am working, irrelevant with CPC or the engine) from time to time, even to motivate me to work on things else I have nothing to say. I am experimenting with various things about motivation and what kills it (or why what you need is full determination, not motivational tricks) something I want to talk in my other blog maybe.

But anyway, I am still happy with the little improvements I do day by day even after my daily work where it's hard to want to spend your time on such project instead of being lazy (with youtube or look Brutal Doom 64 is out, my god it's amazing fun!). I now have some determination to finish this project by the next year, which means fixing all I want to fix and all basic tech for this engine (fix all the raycasting bugs, improve colors/fading, have zooming sprite algorithm with items position projected and clipped ready, make some structs and editor for basic game objects) which I hope it will be this year or early next year and then go on for a game. No fucking around with fiddling and showcasing a tech demo for years anymore, plan for working on a game after finishing the important parts of the tech. I don't promise anything but I just say I am now determined to plan properly and work on this whole thing as a game and not just an engine so that I can release something next year and move on with other great things.

In the screen below, you can see the little branch I did (the SDL simulation of the raycaster engine) so that I can investigate those ugly bugs, usually when a ray passes through the corners of a block (I almost know why this happens, I just need to find a good way to fix it). In the left side there is the accurate raycaster (the one that doesn't run on CPC else it would be much slower) where you can see 2 rays passing through the blocks instead of stopping before. It's always on the corners. On the right side is the optimization idea where I send rays say every 8 steps and if it still hits a similar block I interpolate in between, so that can cut the rays cast by 2,3,4 or almost 8x. The wrong single rays makes it interpolate all over behind the blocks it should stop. It creates weird diagonal popping walls sometimes. I get these mistakes only at specific position and angle of the player.


And here is an ugly picture of the zooming sprite in action. It's in front of the walls and behind the weapons layer. The sprite is some random pixels, I can do better than this when I port the data of a bat sprite I have from sigh. Or finish that mini editor I want to do for drawing sprites/walls/weapons and map, and automatically export C or asm data lists. The routine is now pure bruteforce C. It is optimized to avoid divisions and do it all in 16bit fixed point, but of course it can be much faster when I rewrite it in assembly. I start with a 16*16 sprite (I think my enemies and objects will have sprites of widths or heights of 4/8/16/24/32 or others in between. This is ok since the byte size of the play screen is 64*64) and zoom from far to 4x. At 3x-4x the speed drops dramatically. I calculate 4 VBLs lost. Sprites usually won't zoom fully to screen in the game, enemies will keep a distance and objects will be smaller. Yet, I am already planning an assembly code for this, something I might explain when I finish it and could be 3x or more times faster.


Other than that, the weeks that past, I was fiddling with random code for non-projects. In one instance I was testing various code on my DOS machine. One day I even tried to go from CGA to SuperVGA. I never coded on CGA so I just tried to see how it works, it's quite easy. But I haven't found how to change palette or try something like 160*100 mode. Then as I was reading an article, I noticed it would be easy and compatible to try Svga 8bit resolutions, from 640*400 to 1280*1024. It's the same resolutions the demo Countdown from Realtech were offering. Vesa 1.2, no need to load Univbe or something I guess (not sure if it would load in some old Svga card though). I just tested my Pentium 3 @600mhz monster with a run of the mill plasma. 640*400 did 200fps, 1280*1024 did 35fps iirc.

Then I was binge watching the new Black Mirror series and playing No Man's Sky from time to time. Also watching some of the C64 X demo entries and still I haven't found the time to play the CPC games from the new retro gamedev compo (but I played a bit of Imperial Mahjong and Pinball Dreams).

At some time in the past I also hoped to try some SNES code, I prepared my assembler and compiled the first example, but that is on hold now since ages. And contributing some effects for a friend's DOS demo, a bit on hold too. What I plan to do soon is focus exclusively on the Wolfenstein engine and use my new Trello account to plan/motivate finishing some stuff here and there. When things clear up, it would be more motivating to start working on the main game. Maybe I'll make the proper write ups for the tech at some point, if not at least some progress report.

No comments:

Post a Comment