UDGJ - Sword Boss

#1

Day 1 - Project setup and basic game framework

The game I’m doing is going to be a mix between Knife Hit, Sword Shot and maybe some RPG elements. Day 1 was mainly about setting up the project (GitHub repo), find some graphics to use and decide which extensions/libraries that could be helpful.

Graphics
I decided to go for retro pixel art graphics. I want this for several reasons:

  1. I love the style and feel
  2. There’s a lot of free/cheap graphics out there
  3. I will be able to draw something reasonable on my own if I can’t find all the graphics I need

I decided to use 1-bit graphics (monochrome) mainly because it looks damn nice in Sword Shot (or well, Sword Shot uses more colors, but it sticks mainly to monochrome). I knew that itch.io has a few packs of 1-bit art, and I put them into a collection here. I bought the large 1700 asset pack and another smaller pack to make sure I have everything I need, and I got PixaTool included (could be useful for future games).

Libraries
I decided on the following set of libraries to use:

  • Defold-Orthographic - I needed a camera solution that allows me to easily follow the player character as well as set a fixed zoom.
  • Defold-Input - For user input, tracking key states and reconfiguring keys (if I have time to add that as an option at the end)
  • Monarch - Screen manager
  • Lumiere - Render script wrapper that allows me to add posteffects. Not sure that I need it for this game though…

Game design and setup
I set up a game collection with a tilemap for the background and I created a player collection to house the visuals of the player as well as the player logic. There’s also a boss collection with factories to create the stuff that should circle the boss character. I’m thinking two types of things: 1) Shields that blocks player attacks and 2) Enemies that can damage the player. The Shields can’t be destroyed (or maybe later with weapons upgrades) but the Enemies can.

Next step
Start making the boss configurable.

10 Likes

#2

Day 2 - Boss configuration
I want a wide variety of bosses and they should be easy to configure. Things that I want to be able to configure per boss:

  • Number of shields and enemies circling them. Shields and enemies should be set up into concentric rings around the boss. I need to be able to define:
    • Distance from the boss
    • Distance between the shields/enemies within each ring
  • Movement pattern
    • Rotation speed and easing function
    • Movement in towards or out from the boss

For day 2 I added two game object properties (go.property) to be able to configure the number of shields and enemies. I use factories to create them and distribute them evenly spread out within each ring. I keep track of the initial angle and distance per game object. Distance from the boss is currently hardcoded.

I use another go.property() (number) per group of shields/enemies that I animate using go.animate() from 0 to 360 with a hardcoded easing function. In every update() (yes!) I read the value and calculate the new position for each object. It’s basically just this:

go.property("rotation", 0)

function init(self)
	self.objects = ... create objects
	go.animate("#", "rotation", go.PLAYBACK_LOOP_FORWARD, 360, go.EASING_INOUTQUAD, 3)
end

function update(self, dt)
	for id,object in pairs(self.objects)
		local angle = object.initial_angle + math.rad(self.rotation)
		local distance = object.initial_distance
		local pos = go.get_position(id)
		pos.x = distance * math.cos(angle)
		pos.y = distance * math.sin(angle)
		go.set_position(pos, id)
	end
end

Result after day 2:

Next step
Create movement/attack patterns.

5 Likes

#3

Day 3 - Boss movement patterns
I want it to be really easy to code interesting patterns for the shields and enemies circling the boss. It should be possible to easily create sequences such as:

  • Rotate 360 degrees clockwise (using a configurable easing and duration)
  • Move 50 pixels out from the boss
  • Rotate 360 degrees counter clockwise
  • Move back towards the boss 50 pixels

I want to be able to define this as a sequence just as it is described above. The steps should look sequential in the code even though each step in reality is asynchronous and happens over a number of seconds. Enter coroutines!

Lua coroutines will allow us to do this quite easily. We should run our boss behaviour in a function run by a coroutine. We can run the code in the function for a while, then pause execution (yield) and at a later time (next frame) resume execution again.

Each step in the sequence is a loop that runs until a condition is met (rotation and/or movement is done). The loop is run through once per frame and for each iteration we read animation properties and position the objects.

Example of the high level logic of configuring a wave/ring of objects:

	boss.create_wave("#enemyfactory", 6, 90, 0, function(wave)
		boss.animate_wave(wave, { rotate = rotate(-360) }, 2)
		boss.animate_wave(wave, { move = move(90) }, 1)
		boss.animate_wave(wave, { rotate = rotate(-360) }, 2)
		boss.animate_wave(wave, { move = move(-90) }, 1)
	end)

6 enemies at 90 pixel distance from boss alternating between rotating counter clockwise 360 degrees in and moving out 90 pixels and back in 90 pixels.

Next steps

  • Make the boss killable
  • Add player hp and/or weapon count
  • Close the game loop so that you can defeat or fail at a boss
10 Likes

#4

Day 4 - Game loop
I set out to close the game loop by tracking health and being able to die or defeat a boss. I got the health bars in place, but not much more. I also added a pushback effect when you get hit.

Also added a splash/intro screen:

Tomorrow I need to be able to kill a boss and switch to the next one. I haven’t designed any bosses yet so I need to spend some time on that as well.

9 Likes

#5

Note: Put this in a closed forum group. Moved to #dev-diary.

5 Likes

#6

Day 5
Made very little progress today. I decided that bosses should be able to spawn enemies and/or bullets on a timer and not only have a predefined number of enemies circling it.

I was also able to close the game loop so that you can actually kill a boss and progress to the next one. It’s a very abrupt transition now. I need to add a death animation/effect and some kind of win message/screen/popup in between to give you pause.

6 Likes

#7

Day 6
No progress! Official panic mode is now on. And I don’t have much time today either… argh!

6 Likes

#8

Day 7
I stumbled on the finish line and didn’t have time to actually put some effort into creating some interesting boss encounters. The game was submitted in time though.

4 Likes