Salomonsson.se
Oct 10 2021

Asciibrain, rendering glitch

I needed to refactor my rendering pipeline for improved flexibility (adding a speed improvement in the process). But sometthing went a little wrong resulting in the following images…

This might be one of the coolest bug of my entire career!!

Glitchy
Another glitch
Aug 13 2021

Multiple characters and perf stats

Tiny update this time.

Support for more than one playable character
Print out performance stats in top left corner

TICK is the number of milliseconds for main update loop

BUFF is when we process our graphics buffer and create the SDL commands to draw it

REND is when SDL actually renders to screen (it's so high because of VSYNC)

The first value is actually quite high right now, because I'm very wasteful and calculate shadowcasting and A* every frame even when nothing changes.

Apr 26 2021

Ascii rougelike progress

Haven't written about this in a while, but there is a ton of new stuff going on…

  • Multiple states (start screen, main game) in a classic old fashioned FSM
  • Multiple entities in a turn queue
  • Simple sequence pattern for animations and commands
  • Heatmap generation to calculate moverange
  • A* pathfinding
  • Color pallette adjustments (oh, this needs to be worked on)

(oh, and those red dudes are not ascii… did some experimentation but did not really like it)

…more to come, I promise =D

Apr 17 2021

Runner

Been working a couple of evenings on this little Super Mario Run-clone for my kids to play with. It's obviously quite early in development, but they love it anyway!

Godot has a pretty decent physics system, but as usual I prefer to do the physics myself. Starting to feel pretty good.

Jan 13 2021

Recursive Shadowcasting

Been a while since I worked on this one. But I have some very intriguing ideas, so I wanted to pick this up again. New features since last time:

  • Recursive Shadowcasting
  • Support for custom FG/BG colors
  • Mouse input
  • Text output

More to come…

Dec 27 2020

Teamed up with new artists...

Jumping crab and flying birds

Been talking with my kids for quite some time that it would be fun to make a game together, Now Edda has started actively talking about it, so during the holidays I went ahead and made one.

Funny thing is that Sigrid is the one who made the graphics so far. It's placeholder though, as she wants her graphics for another game (not supposed to be a jumping crab!!!)

Sep 13 2020

Pew pew pew, part 8

Starting to refactor systems. Split out the enemy wave manager into a ship builder class (build and configure enemies based on type), spawn position solver, and a waveManager (that decides WHEN to spawn WHAT ship). Turns out I need to put more effort in the last part, while the two former worked pretty well.

Did a new enemy type as well. A re-make of the shotgun turret from pewpew5 (that never made it into the game).

It is supposed to be a bullet hell after all =D

Sep 08 2020

Pewpewpew, part 7

Finally got some time for this old prototype again!

Added one more enemy (you can glimpse him in the gif), strolling around and planting mines to hinder your movement!

Turns out that having enemy bullets (and mines) be solid color really messed up your sense of depth. And that is super important in this game! So I changed it to simple lit. Sense of depth is improved, but it looks really ugly now! I need an artist to fix this… =(

Jul 16 2020

Swarming

There is a known problem that occurs when you try to have a large number of objects moving towards the same exact point… they will meld together and in the end seem like a single object.

Jerky animation because of low framerate of the gif

In Ripple I avoided this problem by making sure we did not have enough flying/following enemies on screen at the same time. However, I have a case now where I want a ton of theese… a swarm of enemies.

Funny thing is that the math for moving an object towards a point is dead simple. Does some kind of scatter function have to be incredible complex? Or can we do it in an almost as simple way? I had a theory I wanted to try, here's the psuedo code.

   for each enemy in enemies
   if enemy == me: continue
   if distance D is less than minAllowedRadius R
      move me away from enemy in opposite direction by distance D

Result 1

Glitchy

Looks glitchy. Figured out pretty quick that we push by distance D, which means that if minAllowedRadius is 25 and you touch the outer rim of it, distance will be 24, and you will be pushed 24 units instead of 1 unit. And the opposite, if your are 1 unit away you will only be pushed one unit. We obviously need to push it 1 unit in the first example and 24 units in the second.

Result 2

Ladies and gentlemen... a fine swarm indeed!

Whoa! That looks amazing! I did not expect it to be that fluid!!!

Here is the final psuedo code

   foreach enemy in enemies
   velocity = (playerPos - enemy.pos).normalize * speed
   lookAt = velocity.angle() // update lookAngle before calculating scatter

   pushback = new Vector2(0,0)
   var newPos = enemy.pos + velocity
   foreach checkScatter in enemies
      if (checkScatter = enemy) continue
      otherTowardsMe = newPos - checkScatter.pos
      if (otherTowardsMe.squaredMagnitude < minAllowedRadiusSquared)
         // Too close to someone!
         otherTowardsMeMagnitude = otherTowardsMe.magnitude
         // need to adjust amountToPushBack, or we get gif number 2
         amountToPushBack = minAllowedRadius - otherTowardsMeMagnitude
         pushback += otherTowardsMe / otherTowardsMeMagnitue * amountToPushBack

   enemy.pos = newPos + pushback

As you might (or might not) notice is that I use the squaredDistance and squaredMagnitude in the first check, where we see if we are in contact. This is to avoid using squared root in the inner loop (that would be a lot of square root calculations).

However, if we do have a hit we calculate the actual magnitude, so we can adjust the amount of pushback. I store it in a variable as I need it twice.

There might be even more optimized ways to do this, but doing a sqrt for N^(N-1) seemed a bit too expensive.

Oh… and this was also my first attempt at using Godot engine. Is was actually really pleasant! I might actually start using it instead of Unity for experiments and personal prototypes… at least for a while, as a test!

May 10 2020

Adding a light source

Took a first step towards implementing shadowcasting, the ability to show a tile as lit/unlit/hidden.

Very first implementation is just distance based. Next step: recursive shadowcasting! =D

To be totally honest, this setup of the generated dungeon doesn't feel very interesting to explore. But that's not my main concern right now. I'm just trying to get the very basic systems to work before moving on with the gameplay parts.

Feb 29 2020

Pew pew pew, part 6

Started on a strategy for spawning enemies today. I don't want you to die becaues they appear from behind our out of your vision, so focus is ahead! Trying to find a good min/max distance forward and curving outward. Wanted to keep it wider to the sides and narrow it down a bit in height to allow for an easier feel when looking around you.

First try:

So many Trumps

Second try is to distribute the enemies more evenly. Try to find large patches of empty spots and avoid where it is already cramped.

More even distribution, no overlaps

This turned out quite well. I can tell you that it feels a bit intimidating watching all those Trump heads stare at you in VR X-D

I also made a new enemy type:

LASER EYES

And here is a very short video of todays progress. Let me tell you that without too much time put into this one, it is already FUN AS HECK!

Feb 19 2020

Generating a BSP dungeon

All right, in order to start doing something cool I need a to navigate in. RougeBasin to the rescue! They have a really cool tutorial on a BSP dungeon (Binary Space Partitioning, simply put: a node tree where every node has two child nodes). Link here

First step: Create a child node of the entire area. Then randomly split it vertically or horisonatlly (offset the split by a random amount) and add the two inner segments as childnodes. Then repeat for each child node.

Second step: Take all the leaf nodes, shrink them a bit and move them around by some random amount.

Third step: Draw a corridor between every sibling node. Then move up to the parent node and draw a corridor between those siblings. This picture only has corridors on it's outmost leafs.

Fourth step (cheat): Turns out that connecting the parent nodes are a real hassle! In order to keep any kind of speed I did a cheat and drew corridors through the center of each sibling node. As long as I don't offset any room beyond the center coordinate the corridor will pass through a room.

This was fun, but getting step 4 up and running took way too much time. You don't want to lose too much momentum when dealing with hobby projects like these, and this is good enough for me to continue with the next exciting step!

Jan 19 2020

Scrolling camera

Got a scrolling camera to work in tonights short session, showing a part of a bigger underlying map. Next up:

  1. Generate Dungeon
  2. Shadow casting/field of view
Jan 18 2020

Pew pew pew. Part 5

Really quick dev today. Added a fourth shiptype that bursts out a ton of bullets. I have a good initial setup now! Time to start on spawning them in sequence.

Jun 13 2013

Ripple Dot Zero

Lets cut it short! Ripple Dot Zero is my Magnum Opus! For five years me and my childhood friend, Simon StÃ¥lenhag, worked on this in our spare times. It's an action platformer, heavily inspired by our favourite childhood Sega Genesis game titles such as Sonic the hedgehog, Strider, Wonderboy in Monster World…

READ MORE >>