Orkn's Pulp Prototypes

Over the last couple of days I revisited my tile-based pulp platformer prototype to shape it into a little "arcade cabinet" for inclusion in another soon-to-be-revealed project I was approached about.

My goal was to:

  • Make a proper level
  • Crop the screen to an arcade cabinet feeling aspect ratio
  • Implement coins to collect with a saved high score
  • Implement a timer with a saved high score
  • Give the game some polish with little things like a title screen
  • Refactor all of it to be self-contained and as easy as possible to drop into a larger pulp project!

Here is what it looks like right now:

tile_hill_pits_and_spikes

tile_hill_springs_and_saws

Implementing coins

The code is simple, but it's a lot of effort!

Coins are an item tile with this basic script:

on collect do
	
end

on pickup do
	thill_coins++
	tell event.room to
		call "pickupCoin{event.x}x{event.y}y"
	end
	swap "white"
end

collect is overriden to do nothing because of the non-standard player movement. Instead every frame I call the pickup event on the player's location.

The implementation of screen scroll (by having overlapping rooms with inset edge exits stitching them together) means that the "same" coin will be placed in multiple rooms. When the player picks up a coin in the level it not only needs to be swapped out of the current room, but any other room in which it is visible. For this reason every coin has its own variable to track whether it has been collected, and when picking up a coin the room script has a matching event to set the correct coin variable:

on pickupCoin2x10y do
	thill_coin_1 = 1
end

There is an event like this for every coin that can be picked up in that room.

When entering a room the coin variable needs to be checked to see whether each coin visible in the room should be swapped in or out. Swapping in as well as out means the level can easily be reset without restarting the entire game:

on enter do
	if thill_coin_1==0 then
		thill_tile = "thill coin"
	else
		thill_tile = "white"
	end
        tell 2,10 to
		swap thill_tile
	end
end

That's it for the concept - but multiply up for every coin (each appearing in multiple rooms) and it's a lot of code and a lot of copy/paste while changing the numbers!

Making it portable

I refactored extensively to try and make it as easy as possible to just drop in to another project:

  • "Portable" means "small". The game uses 11 rooms (10 for the level and 1 for the title screen). In addition to the default black/white world tiles the game only uses 10 player tiles, 11 sprite tiles, and 4 item tiles (cut down from the original prototype).

  • Every variable starts with thill_ so there shouldn't be any conflicts despite pulp having only global variables.

  • All of the rooms and tiles similarly start with thill so they will be grouped together in the pulp editor's alphabetically sorted lists

  • All of the code is self-contained within tile and room scripts, primarily a tile hill code tile (that doubles up as the coin HUD icon, just to save on tiles!). The player and game scripts have the minimum hooks to relay the required pulp events to the Tile Hill code. Essentially to start Tile Hill from within another pulp game someone just needs to call the one boot event to start the game and ensure those events are relayed for the duration (probably just with a flag that is set when the game is running).

  • Pressing "B" while playing will return the player to the title screen. Pressing "B" on the title screen will call a quit event which is intended to quit the player out of Tile Hill and back to the containing pulp game. This requires a little bit of tidying of config changes and resetting the screen crop.

Hopefully that's mildly interesting!

3 Likes