Sunday, June 12, 2016

Game feel and level progression

Particles, screenshake and level progression are in!
Before I added any more features to the game, I wanted to make sure the the basic brick breaking feels good. After watching few talks about the game "juiciness" and the art of screenshake, and reading about the "game feel" in general, I have decided to give those things a try...
...and I am really pleased with the results! The game is much more satisfying to play when the block breaking has a bit of a "weight" behind it. I was surprised how much of a difference a few lines of code can make. Also, that I managed to implement those things without much trouble. Sure, I looked up similar code in other games to get a hang of the particles and I was given a basic screenshake mechanic by @emu from the Pico-8 Slack, but making it work inside my game still felt like a triumph. As of now, I see the basic gameplay as complete. There might be some small tweaks done to it  in the future, but right now it's time to move to other things.


LEVEL PROGRESSION:

One of the main features of the game are randomized levels. I have opted to go this route for few reasons: Pico-8 sprite map limitations means I can only make so many levels, lack of knowledge about level design (and not wanting to make an exact clone of something like arkanoid) would lead to levels that are just boring to play,  and my fascination with randomization in games of all kind. A drawback of making the levels random is having some levels that are pretty easy to beat, so I needed more levels to keep the game from being disappointingly short.  So far I implemented the backbone of the level progression system, rest of it will come out of the algorithm that is responsible for generating each level. Anyway, here's the code:

level = 1
currentlevel = 0

function start_level()
 if currentlevel < level 
 and #bugs < 20+level then
  create_bug()
 else currentlevel=level 
 end  
end

function end_level()
 if #bugs==0 then
  ballxdir=0
  ballydir=0
  ballx=(padx+padx+padw)/2-2 --centers the ball on the paddle for serve
  bally=pady-6
  newball=1
  if btnp(4) then
   level+=1
  end 
 end   
end

I am using two variables to check if the levels has changed, and two functions that are placed inside the _update() function (so they are checked every tick). On the beginning of the game the current level is 0. After the start_level function has generated the level, it simply makes the current level, equal to the level the program has just generated.
When the player clears a level (there are no entries in the bugs table, that holds the bricks/enemies), I make the ball go back to the serving position and change the level variable to the next one. Then the start_level picks up again and does its thing. Done.

Unlike the previous approach of generating the level before the game starts, running it frame by frame as a game starts makes the bricks appear one by one. I haven't planned for that, but it is a cool effect, that is probably easier for Pico-8 to run, so it's a win-win. It just needs some animation of the bricks appearing to make it great. Oh, and sounds...but the sounds will come much later. Next step is to add some enemy variety and implement them into the level generator.

No comments:

Post a Comment