Salomonsson.se
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.

Jan 10 2020

AsciiBrain2

Today, by chance, I stumbled upon the free tileset section on Itch.io (https://itch.io/game-assets/free/tag-pixel-art), and I instantly fell in love with so many of them! I’m usually not a big fan of using random peoples stuff, but I think this made me change my mind!

I downloaded a few and started playing around with one of them, making ireggular semi-topdown floor tiles. I could easily integrate them since this is not a console at all, but a regular window I draw bitmap fonts into. Easy peasy!

But the very reason I started with this in ascii was to NOT having to bother with graphics… so even though it looks realy nice, it will have to wait for another project.

Jan 07 2020

Pew pew pew. Part 4

Some more progress, this little VR prototype is going in the right direction indeed!

I needed a way to distinguish the different enemy types, so I just pasted different Trump faces on the cube. Consider it placeholder graphics (even if it is kind of funny) =D

Jan 03 2020

Pew pew pepw. Part3

The controls did not “feel” right. Has been working on improving them for a couple of evenings now. Great improvement even if there are still some work to be done.

Dec 28 2019

AsciiBrain 1

Bought myself a new hobby gamedev laptop. It’s really small, and really neat. And kind of weak… So I needed a project that it could handle.

After trying haxe it was clear that compiling haxeflixel was painfully slow. If I did it directly in c++ instead it worked like a charm.

So c++ project it is! Using SDL and the base from my Ludum Dare code base. Got a dude moving and placing blocks. Good first progress =)

Dec 09 2019

Pew pew pew. Part 2

Replaced the player ship with free model from asset store since the cube looked too horrible, even for me. Replaced player bullets with laser beams.

In this gif it’s hard to distinguish bullets from enemies…

Nov 26 2019

Space shooter prototype in VR, part 1

Got an Oculus Quest a few months back. Love the device, but I’m not overly enthusiastic about the games you can buy. Not to mention that they are very expensive!

So I started writing a small game of my own. A little space shooter/bullet hell with fast, arcade-like gameplay inspired by games like Geometry Wars.

This is the very first progress. Only an hour into the project… good progress for such rapid prototyping. Lots left to do (obviously).

Nov 24 2019

Drawing an enemy animation...

Wanted to do a test to see how fast I could draw an animation for a game, to see if it ever would be worth producing. The answer is an astounding NO. This super simple animation took an entire evening.

Still funny enough to post though. Would you play a game with this kind of graphics?