Purgatory Purgers: Level Design

What Should a Level Look Like?

In my last post, I solved a major collaboration issue by figuring out how to export/import individual rooms in GameMaker Studio 2.

Since then, Eric and I have been creating levels to round out the game, and with a little over an hour’s worth of content, I’ve been looking at some of the larger levels to see which parts I can cull so that the game doesn’t get dull/outstay it’s welcome.

Level design is difficult to do well. Purgatory Purgers’ level elements can be broken down into a few different components:

Features

At its heart, Purgatory Purgers is a puzzle-exploration game. Each level is a series of interconnected rooms of varying shapes and sizes and could include:

  • Gambits: Rooms with one or more dangerous enemies
  • Treasure Rooms: Filled with lost souls (the primary objective of the game/scoring system) and free lives
  • Puzzles: Moveable blocks, bridges, etc.
  • Secrets: Hidden rooms and passages marked by a small crack in the floor or an odd-looking bush.

These aren’t mutually exclusive and could be combined to form interesting and progressively more challenging areas.

Flow

A good level shouldn’t railroad the player down a specific route; instead, there should be 2-3 branching paths and reward players for exploration with additional lives and/or hidden shortcuts through the level.

Embellishments

To bring the Purgatory Purgers levels to life, I created lots of additional tiles to add flavor and mystery to each set of levels. Locked doors, sewer grates, pools of water, grass, grates, blood spatters, arcane symbols, and even emptiness in the later levels.

Putting It All Together

A good level combines all of the above to form a cohesive package; the level is:

  1. Good looking (i.e., makes good use of the available tileset and avoids excessive repetition)
  2. Intuitive to navigate (it doesn’t require a lot of backtracking)
  3. Sufficiently diverse in enemies, puzzles, and mechanics
  4. Above all, fun to play (read: sufficiently challenging, but not too difficult)

GameMaker Studio 2: Exporting/Importing Rooms

Background

I’ve been looking for a way to allow another user to create rooms for my existing project using templates I’d created with consistent instance, tile, and background layers.

After my experiment with source control ended in disaster, I decided to shelf that for the time being and try a simpler approach:

Procedure

  1. On PC1, I Exported the as-is project as a .yyz file (File > Export Project > YYZ) and then saved the file to a network share.
  2. On PC2, I downloaded the [MyProjectName].yyz file and Imported it (File > Import Project > Path\To\.yyz file).
  3. I updated the project on PC2 by creating a new room, and then I saved the project.
  4. I opened File Explorer on PC2 and browsed to the project’s rooms subfolder (i.e., C:\>Users\[MyUsername]\Documents\GameMakerStudio2\[MyProjectName]\rooms).
  5. I located the corresponding folder to the new room I’d created, then copied the room2.yy file back to the network share.
  6. Back on PC1, I created a subfolder in my project with an identical folder name and then copied the room2.yy file to that location.
  7. I opened GameMaker Studio 2, right-clicked in the Asset Browser, and selected “Add Existing“. After navigating to the room subfolder from the previous step, I selected the .yy file and clicked “Open.” Nothing happened!

At this point, the rooms list didn’t update with the new asset, nor did I receive an error.

The Missing Step

After opening the game’s project file (.yyp) in a text editor, I could see a list of resources, including rooms, along with their relative paths:

"resources": [
{"id":{"name":"room1","path":"rooms/room1/room1.yy",},},
],

What I did not see was an entry for the new room I created, so I simply appended the list with the new room:

"resources": [
{"id":{"name":"room1","path":"rooms/room1/room1.yy",},},
{"id":{"name":"room2","path":"rooms/room2/room2.yy",},},
],

Towards the bottom of the list is the room order, which I also appended:

 "RoomOrderNodes": [
{"roomId":{"name":"room1","path":"rooms/room1/room1.yy",},},
{"roomId":{"name":"room2","path":"rooms/room2/room2.yy",},},

After saving and closing the text editor, I fired GMS2 back up, opened the project, and after an agonizing minute or so of loading, the project opened without error!

To my delight, there sat the imported room in the asset browser. I double-clicked it, and there it was:

Alternatives Considered

Someone on the official forums had suggested having Eric submit asset packs – I have no idea what that means exactly, but he seemed to suggest this was less than ideal.

Eric’s original levels were created in Tiled, and then I’d manually recreate them in GMS2, which was inefficient and very time-consuming; however, I’d heard that there were tools that could convert a Tiled map to a GMS2 .yy room resource file but couldn’t get it to work properly with my project. This is because our maps utilize multiple tile layers sandwiched between an instance layer (where the objects live) and the background layer. Most of these tools assume you are working for a single tile layer to another single tile layer, and none of the address how to get the room.yy file back into your project.

Caveats and Disclaimers

  • In order for this to work, all of the resources used in the room (i.e., objects, sprites, tilesets, etc.) must be present and unchanged in both the source and destination projects
  • GMS2 is known to not play nice with Cloud-synced project folders, so make neither system

Purgatory Purgers: Git Thee to a Repository!

Doing Things the “Right” Way

I’ve worked alongside development teams for most of my professional career, and they all used source control. So, if I wanted to do things the “right” way, I also needed to use source control [with GameMaker Studio 2]. But alas, the map is not the territory, and you really screw things up if you don’t know what you’re doing. I didn’t know what I was doing.

Initial Setup

Although GMS2 offers [limited] native support for source control, it seemed simpler (and easier) to install GitHub Desktop and point it to the project folder.

Using this method, I was able to upload an entire project to GitHub, then install GitHub Desktop on another PC and clone (download a local copy of) the entire repository (i.e., the project folder) onto the second PC.

Once I got it working to my satisfaction on my end, I went ahead and walked Eric through it over Discord/screen share.

Where It All Went Wrong

Eric volunteered to clean up the tile layers of several maps – little mistakes where the incorrect tile was used for a given room that needed to be updated. Eric and I both thought that he’d pushed these changes to the repository, but the mistakes were still present.

Initially, I’d assumed these were regression problems that Eric introduced, but after looking at the same levels on my second PC, I realized these problems were present in older versions of the project, meaning Eric’s updates didn’t get pushed.

By then, I’d already fixed these problems on my end and pushed the updates to the repository. When Eric introduced his changes on top of mine, the levels were suddenly missing.

Recovery

After quite a lot of troubleshooting, I eventually decided to make a backup copy of the broken project, export the backup I had on my second PC, and then manually redo the changes I’d made over the last 24-48 hours.

This worked, and I was able to get back on track despite losing a day of productivity.

Lessons Learned

In troubleshooting, I discovered:

  1. Eric’s project folder was being synced with OneDrive, which I later learned could cause problems with GMS2 Projects.
  2. We were using different versions of the GMS2 IDE, which is also a bad thing.
  3. You have to be very careful when merging changes, as this can cause problems for individual resource (.yy) and project (.yyp) files.

At this point, I’m going to abandon source control for the time being in favor of something I know (traditional backup), but I may revisit it later…

Purgatory Purgers

Here We Go Again!

Back in May, my life was starting to slow down enough to spend some time on game development again. Shortly after, I reached out to my old friend Eric to reconnect.

After a few weeks and several emails back and forth, we decided to start again, this time on a new project.

Game Mechanics

Eric suggested Chip’s Challenge (specifically, the Windows 3.1 version) in brainstorming ideas, which incorporates a few key elements:

  • Collecting McGuffins (computer chips)
  • Pushing things (similar to Sokoban)
  • Avoiding enemies

While Chip’s Challenge is more complex than that, we decided to focus on those 3 design ideas and start there. Eric proposed the idea of the player controlling an angel and a demon trapped in limbo. The two would have to work together to solve puzzles to advance to the next level.

The McGuffin would be souls, which would be set free from limbo to either ascend to heaven if collected by the angel or descend to hell if collected by the demon. Collecting all of the souls would allow the player to exit the stage and move on to the next level.

We incorporated a Sokoban-like push mechanic and decided to give this ability to the demon. Blocks would be used to obstruct enemy movement/line-of-sight and also to solve key/lock puzzles.

But we also needed something for the angel to do, so we decided to include water tiles that only the angel could traverse, using the same key/button that the push mechanic utilized.

After getting these features working, I had the idea to introduce bridges that the angel could lower, allowing the demon (and, by extension, blocks) to traverse areas that would normally be cut off by water.

Next Steps

With most of the core mechanics working, there’s a lot to do insofar as creating assets (art, music, etc.), levels, and the like. Eric is primarily responsible for level design, so I leave it to him to work on cranking those out while I work on polish.

Beaster’s Dungeon Revisited: Part III

When I last left off, I managed to get the trap placement mechanic working as designed. Of the core mechanics I needed to get working, the last one remaining was enemy platform pathfinding…

Platform Pathfinding Challenges

As previously stated, the game’s object is to ward off hoards of enemies trying to navigate their way to your treasure vault by placing traps and barriers in their way.

The player can navigate the environment by moving left, right, jumping, and falling.  I wanted to give the enemy a similar capability:

In this scenario, an enemy character can walk left or right and can clear obstacles up to two squares (32x32px tiles) high and three across. Each scenario is numbered and represents the following:

  1. All possible ‘jump’/walk movements from a platform (1-3 across, 2 up)
  2. Walk left or right 1 square
  3. Drop down left or right
  4. Jump up left or right 1 square
  5. Jump up left or right 2 squares
  6. Jump up left or right 2 squares, illustrating that the platform might be floating (i.e. allows free movement beneath it)
  7. Jump across left or right 1 square and up 2 squares
  8. Jump across 2 squares (same height)
  9. Jump across 2 squares and up 1 square
  10. Jump across 2 squares and up 2 squares
  11. Dropdown 1 square left or right from any height to a platform below (this is implied in 3, but I wanted to illustrate it explicitly)
  12. Drop down to a platform of any height, 1 square left or right across
  13. Drop down to a platform of any height, 2 squares left or right across

While I found a couple of examples of this working/implemented in GML using a modified version of the A* Search Algorithm, I could never get them to work within my project. I discussed the problem with my friend Jason, who created a working prototype for me that met all of the design specifications. But not fully understanding how the code worked, I failed to integrate it.

Now that I have the time to troubleshoot it, I’m reluctant to do as I fear that I don’t understand it well enough to support it. Instead, it might be better to build something simpler…

Possible Solutions

Thinking through the problem, there are many other ways I could have solved this. Wrecking Crew for the NES comes to mind:

Enemies (and the player) in Wrecking Crew use ladders to navigate up and down platform levels. Why couldn’t I implement a similar feature?

Ladders

For example, instead of trying to make the enemy AI smart enough to navigate obstacles with a preset of constraints/scenarios, I could have them wander left and right across vertical planes, moving up or down when they reach a ladder, depending on whether the vault was above or below them.

Alternately, rather than placing ladders in fixed places, perhaps some enemy types could create erect them?

Stairs

Another option would be to use teleportation in the form of background staircases:

In this example, the enemies could access specific floors using “staircase” objects that would move them from point A to B and B to C, and vice versa.

Either scenario would necessitate creating two extra animation frames for each enemy sprite. Not a deal breaker, but something to consider…

Beaster’s Dungeon Revisited: Part II

Continued from Part I...

With Eric gone, I eventually re-coded everything, but never could work out how to implement the trap mechanic, so I shelved it and there it sat…until now…

###

I was talking with a friend who was admiring some CGA-16 color palette pixel art, which lead me to showing him the artwork I’d done for Beaster’s Dungeon. He asked if I had any intention of picking the project back up, to which I replied that I might, albeit with a reduced scope. I explained the difficulties I encountered with the trap mechanic, specifically, getting the cursor to snap to a grid.

This lead to a discussion of where I got stuck, and in order to illustrate this, I fired up GMS and started creating a prototype to illustrate the problem. I reached out to my friend Jason (who did the programming for ‘Milk Smugglers’) for suggestions, and he linked a forum post containing the floor/ceiling functions.

In that post was another mysterious function called, move_snap. Here’s what I did for the prototype:

o_cursor Object

///step event

//set coordinates of the cursor to the mouse's x,y position:
x = mouse_x;
y = mouse_y;

//snap the object to nearest grid coordinate 
move_snap (16,16);

Why is this important? Because it allows for precise placement of objects in a map comprised of 16×16 pixel tiles (or any predefined ‘snap’). Around this, additional rules and checks could be incorporated to ensure traps could only be placed where they were meant to be!

At long last, I was finally able to implement the trap mechanic! The only thing left to complete the prototype was enemy path finding… This turned out to be far more complicated than any of the other mechanics combined.

Stay tuned for Part III!

Beaster’s Dungeon Revisited: Part I

Naively Ambitious

Beaster’s Dungeon was to be a 2D platformer where the player would try to stop oncoming hoards of enemies from reaching your treasure vault by collecting resources to build and place elaborate traps.

It was conceived by my friend Eric and myself in late November of 2016. We sketched out a rough outline and slowly refined it into a proper (read: laughably inadequate) design document by early December.

Progress was slow as Eric and I both had very steep learning curves to overcome. I (arguably) had the easier job of creating the artwork and animation, and had plenty of references to lean on for inspiration. Eric, on the other hand, had the dubious honor of trying to cobble together code from various YouTube tutorials and the results were about what you’d expect.

We were getting nowhere fast, and even what [naively] seemed to me to be the simplest features were a puzzle of Gordian complexity for which I decided to apply the Alexandrian solution: cut it all loose and start anew.

Somehow, I stumbled across John Janetka’s Game Programming Course, and by the third lesson, knew enough about GML to solve many of the programming problems Eric was stuck on. Encouraged by a possible way forward, I suggested to Eric that we complete the coursework together. For Eric, this would serve to build the foundational knowledge and concepts he needed to master in order to get predictable, repeatable results. For me, well partly as a show of solidarity and encouragement, but mostly so that I could help troubleshoot when he got stuck.

Eric [reluctantly] agreed and we set off – what follows are details I haven’t really shared before, but I will try to present them objectively in the hope that someone, somewhere will learn from them.

Sullenly Inevitable

Over the next few weeks, I dove head first into the well of knowledge, occasionally coming back up to share what I’d learned on this blog. Eric was less enthusiastic about this, seeing it as a chore, but went through the motions – at least for a while.

To me, each lesson represented one step closer to accomplishing my goals. To Eric, each assignment was a step backward, taking us further and further away from a completed project.

Toward the end of January, I was eager to test what I’d learned by making a simple game from start to finish – that game was Porker: The Quest for Tastiness, more on that below. Eric on the other hand was thoroughly demoralized, having completely given on up on the GPC, and would soon after withdraw himself from the project altogether. What went wrong?

Rowing in the Same Direction

“Much like a relationship, I don’t think a game development team works if the designers aren’t on an equal ability and similar mindset”
– ‘3kliks’ Philip Dyer

From the beginning, I recognized that if I wanted to develop games, I would need to develop my skill set which, as I often lamented, was lacking. But I worked on it and improved, little by little.

As an individual hobbyist, you can work at your own pace, are accountable to no one but yourself and your project(s) can drag on for months or even years on end. You can pick up where you left off, start over or let it collect dust in the dark recesses of a forgotten folder.

In a team of unpaid amateurs, some are genuinely passionate and are prepared to commit time, money and resources to realize their shared dream. Others are only along for the ride, hoping to be carried across the finish line. Somewhere in the middle are those who start strong, but lose steam quickly and eventually drop out.

This could be due to:

  • Change in personal circumstances
  • Distractions
  • Lack of commitment
  • Loss of interest
  • Discouragement
  • Unrealistic expectations
  • Disagreements and disputes…

In part 7 of his YouTube series called “The Game Making Journey,” Philip Dyer (AKA 3kliksphilip) begins by stating that, “Game design has a reputation for being a boring and lonely activity (probably), but it doesn’t have to be this way! Making them with other people is an exciting bonding experience that almost always ends in disaster. Much like a relationship, I don’t think a game development team works if the designers aren’t on an equal ability and similar mindset.

For Eric and I, there was a disconnect. When I committed to working on the project,  I threw everything I had into it. Between working sessions, I read everything I could get my hands on related to the subject from game design theory to level design concepts to lessons learned from other indie game developers, and tried to incorporate this into my thinking.

Eric wasn’t really interested in what the outside world did or thought, and to my knowledge, never actively sought information or did research. Perhaps he was afraid his ideas would be polluted by outside influences and lose their originality, or perhaps he was afraid that doing so would somehow detract from the magic of it.

A Kind of Magic

To him, creating videos games was a kind of magic – you simply needed to learn the incantation, wave your arms about and the computer would either reward you with your desired outcome or punish you for your insolence by refusing to work, or worse yet, play a trick on you and give you something you didn’t expect.

One dream, one soul, one prize, one goal
One golden glance of what should be
It’s a kind of magic” – Queen, It’s a Kind of Magic

Having spent the last 20 years of my life (and career) working with computers, I knew this couldn’t be further from the truth.  If something didn’t work right, it was my fault for not understanding the syntax or behavior – garbage in, garbage out! The computer had no will of its own, and had no choice but to interpret the commands I gave it in the order they were received, and the order of things mattered.

Larger problems are broken up into smaller problems, and smaller problems can be solved, provided they’re well-defined – no room for ambiguity here!

Never Say Never!

By February 1, 2017, I’d completed the GPC. I wasted no time and dove into re-coding Beaster’s Dungeon. By this point, Eric had stepped down from coding and wanted to try his hand at game design. I created a Game Design Document (GDD) template for him and set him to work while I tried to build a prototype.

By the end of the first week, basic movement was finished, and I was struggling with the trap placement mechanic. I had no idea how build this, and had to take a step back.

Despite all of the effort I put forward insofar as music, graphics and now code, I still wasn’t a “Game Developer” because I had not yet produced “a Game.” This bothered me a lot.

I was discussing this with my friend, Jim, and while talking about GMS, I pulled it up in Google Hangouts and started showing him things. He was drunk, and we were having a great time – he’d shout out silly ideas to me while I coded the game. The artwork was mostly modified from open-source images found here and there. Still, it had that late 90’s flash game charm and worked well enough – it didn’t have to be a great game, but I did have to finish it, and after two days of work, the result was, “Porker: The Quest for Tastiness”, which we released under Jim’s website, porkcircus.com.

###

I never did get back to Beaster’s Dungeon – forever confounded by that damned trap mechanic – until yesterday!

To be continued…

Get on with it!!!

Conflicting Priorities

I spent most of last week preparing for a face-to-face interview, pouring over the job description and reviewing every detail so as to be prepared for whatever the interviewer might bring up – this meant putting just about everything else on hold and using every waking moment to study.

The interviewers seemed pleased with me, and I was disappointed to learn that the job descriptions were erroneous; most of what were listed as, “required skills” weren’t required at all! What a waste…

Earlier this week, I received a call back from the recruiter explaining that they elected to go with someone else. In short, a week wasted and nothing to show for it but a heaping helping of disappointment…

###

After about a day of laying about and feeling sorry for myself, I decided that what I really needed was to focus on something productive… the game I’d set aside to study up for the interview was sitting there, 90% done, waiting for me to cross the last mile…

“If you know where you’re going, you can get there very fast.” – Grandmaster Henrik Danielsen

The most time consuming part of making any game is getting a clear picture of what you want to do. This is true for every component, whether it’s creating artwork, making sound effects, writing music or programming.

Of these, artwork is probably the most difficult (for me) and time consuming…  Often times, I may not have a clear mental picture of what I want to do, and haven’t developed a good system for working through ambiguity yet – but once I do break through, things move very quickly!

I’ve accomplished more in two days than I have in the last 2 months, and the end is in sight! All that’s left is just putting in the time I need to spend to get through the last few pieces, a few days more to test, then on to distribution!

With luck, I’ll have a successful YouTube marketing campaign and will sell enough copies to support myself until I finish Beaster’s Dungeon.

Development Progress Update, Week 4

Busy != Productivity…*

This has been a busy, though not an especially fruitful week in terms of development progress. I got side tracked trying to learn a couple of new techniques I’d need (shaders and surfaces) and I’m continuing to troubleshoot code signing certificate issues…

For the prior, I just stumbled on the fix this afternoon while trying to make a pause function – more on that on a separate post when I have the time/motivation to write it.

On the later, much of what I have encountered keeps coming back to the certificate signing request (.CSR) and private key export (.PFX/.PVK). I’ve been using OpenSSL, which my provider doesn’t seem to support, instead preferring that I use Window’s certificate snap-in.

This would be fine if I were on a domain, but I’m not…Ergo, there’s no certificate enrollment policy as there is no domain controller or active directory service. I had a spare PC sitting around (my wife’s old gaming desktop which had since been replaced by a much nicer gaming laptop), so I decided to plug it in and see if it still ran.

When I did this, I was greeted with a long series of short beeps (power failure) followed by repeated attempts to start itself only to immediately shutdown again. After digging around in the garage, I found a craptastic 500W PSU to replace the relatively nice 700W OCZ Stealth Steam modular PSU that was in it…

This allowed it to boot, and a cursory look around the machine seemed to indicate that it was good working condition otherwise.

Next Steps

Once I get the “server” up and running, setup all the required services and so forth, I should be able to sort out the SSL issue… I feel as though I’m spending way too much time on this, but without it, I’m not only out $140 on something I can’t use, but I’m also unable to distribute “trustworthy” applications.

 

*The prefix “!” means NOT (i.e. ‘!=’ is NOT Equal to)

Development Progress Update, Week 3

Summary

Game prototype is 67% complete!

I finally received verification on my code-signing certificate. While I was able to successfully sign an .exe file using the cert, I’m still getting a SmartScreen warning when running the file.

Further research suggests that I might need an Extended Verification (EV) code signing certificate (which isn’t available from my Certificate Authority (CA)), and/or publish the application on the Windows App Store.

I’ve received assurances from my CA that the certificate I purchased from them should work fine, and that the problem was with my Certificate Signing Request (CSR). Having rekeyed the request at least twice already, I feel sure that I’ve done everything correctly.

The only anomaly at this point is that Publisher is being displayed as the entire Subject string (i.e. state, city, country, organization etc.) rather than just the common name, “V-Toad Games.”

This is a big enough issue to warrant my full attention as a SmartScreen warning could deter potential players from running my games.