Wednesday, 30 November 2016

Adventopolis #0 - Tales of Procrastination

This is a little procrastiproject, where I make something like an advent calendar but not exactly. Simply, every day I will be forced to make an entry here and write something about the projects that I am currently working and how bad it went. It can be humorous or lazy or whatever happens or serious attempt to get back on track (I have not worked much on code since the last update).

It's an ongoing process trying to fight the procrastination even though I believe it's a natural condition. The unnatural will be to work on vanity creative projects in the evening after work, tired and not motivated enough, not having the reason to do so rather than just relax for the night. Yet again, I realize again that there are some small and larger things I want to do, new frontiers in coding, older and newer ideas never resolved, sitting there and begging me, what could be done, what are the possibilities. When you have the skills but your are not conscientious.

So, just a test, what if I first posted every day till 22th of December (I will be on holidays later on), would that force me to work a little bit more so that every day will not be "I binge watched or done nothing" in excess? Most probably not. When you try to push it, it come back badly. It feels even more dreadful. But just a test..

..or maybe I just want to write something, to feel fulfilled even if I didn't worked on my projects.

So what's going on today? I binged badly on youtube and specifically Dark5. Maybe I'll spend 15 minutes on reviewing some code.

What do I want to work on? I stopped working on the CPC wolfenstein for a long yet I'll plan to come back at some point. As a change, I was working on a new framework for testing effects and doing software rendering stuff, but mostly it's the same boilerplate SDL code but in a way where one can hook his own class with equivalent for other libs, TinyPTC, DirectX or whatever. I just wanted to design something new in a way that the core for a lot of things, from screen buffer to input, is abstract, not having any dependencies upon libraries, but having hooks for someone wanting to connect specifically a lib to it. It's a small thing I want to grow, I am just overthinking it right now, reviewing code I wrote hastely few days ago to see if it's how I like it. I was between the "write some code fast without overthinking it to motivate yourself" to "maybe spend more time to carefully design this and don't bother if you don't finish it soon" (which I will do today, review what I wrote with more pace and make some notes of what I want to change, what I like and whatnot).

But I may change from that soon. I want to work on some parts on the CPC Wolfenstein (since this is already rolling and it's more motivating to add stuff). And then few more stuff I want to at least start with before the end of the year. One is Sam Coupe. I wished to have release something by this year, so maybe I'll roll a 256b-512b intro with some code I have, no big demo yet. Then there was for more than a year my big dream to start something on youtube. One of the ideas were videos explaining demoscene or retro stuff in some detail with good visual animations and not superficially like some gaming channels that I see try to explain graphics. And specialized subjects you don't see, like some crazy trick on CPC or insane optimization ideas used in the demoscene. Another thing I would dream was some videos more on the gaming side, but discussing for example non-linearity in oldschool FPS or other similar subjects in good depth. I am thinking of videos aiding with visual animations, in the way I am understanding algorithms as a visual mathematician.

I might start giving it a try with some code or video production and voicing with some of these (and maybe I am thinking to try something with the oldschool FPS map, trying to compile Zdoom code so that I code it to aid me in a specific visualization on the map, outputting frames and maybe then connecting them in a video). So, maybe I will make my first attempts on this during this advent calendar. But no complete video will be produced, just a test of how this could work.

But my youtube ideas is something that needs tremendous amount of focus and I realized that by the way my current habits are on procrastination (which is not with the negative aspect of it, but the realism that it's quite normal to come back from work and not want to work furiously on these, but only dream of the posibilities if it was possible for me to be a cold robot) there is no way such big project as that to ever take form, even started. Code of small stuff or even slightly bigger is different because you can code a small fraction and keep it in storage for a year, but youtube needs frequently updates (and I plan if I ever start to be less than a video per month but good quality and researched).

So, I'll try to make a small Sam Coupe release at some point, work even 5% of my youtube ideas (start preparing the tools, test the way of production and voicing, make a 10 second snipset and see how it looks and sounds), work some of the days on the CPC Wolfenstein (I have lists of things to do next, so it's easier to not get stuck on thinking what to do and act fast) and maybe review my agnostic software render framework and see if I will work with that too. Also, in two weekends is a new Ludum Dare and I might think of taking or no taking part for the full three days, just to flex my motivational muscles.

You will know how it goes and what moves or not, worst case scenario I procrastinate to even update this advent thing, I sense it's so bad that it feels not worth to continue. Or at least I can finish every day till before my holidays and it reads back like a big joke of procrastination tales.

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.