You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

2.5 KiB

title: Pretty Colours date: 17-07-2020

I've been able to put some more hours into this project now that I'm on holidays from uni, so my 2D cave background graphic now comes with colours.

Most of this work was tieing together the colour code that I wrote a couple of weeks ago1. It lets me pick a random RGB colour, convert it to hsl and then rotate however many degrees around the colour wheel. I also added some luminance variation. It probably bears a bit more experimentation but I'm pleased with how it turned out already.

I also rewrote the prototype level generator with the goal that it would be possible to stream levels piece-by-piece so that they are effectively infinite but I put that on the backburner in favour of just jumping to a new level after a certain distance. Partly because it was much faster to get working, and also because it allows me to change the colour pallete more frequently.

The levels are still generated using a level seed, which determines the terrain and colour pallete. However now it must be of finite length and has to be loaded entirely into memory. The world generation is nothing fancy. Just a random walk.

As you can probably see the player-character (purple square) is quite lacking, I unfortunately have no idea what to do about that. Admittedly, one of the nice things about c is technical difficulties usually mean my productivity is always far more limiting than my very limited creativity.

I still need to get the grappling hook working again, write code to free all the level memory when neccessary, and re-write the world object manager. It is currently impossible to remove objects from the world once they are added. Performance is also becoming a problem. The background is drawn entirely with SDLDrawLine, and does a lot of calculations on the cpu every frame in order to interpolate walls. My algorithms are generally inefficient but hey, dont optimise prematurely right? Physics tick time is getting to the point where the simulation starts breaking. Maybe its time.

I am also yet to add any audio. I think I'll do that first.


  1. The hard part of this was converting HSL to RBG but it turns out that Wikipedia really is fantastic for explaining these sorts of algorithms (and providing free pseudocode). I went overboard and implemented conversion between any of RBG HSL and HSV. I was so excited that I then rewrote lolcat using my library.