Wednesday, May 17, 2017

A Study of Spaces in Yooka-Laylee



Steam tells me that at the time of writing this post, I have ~30 hours put into Yooka-Laylee.  I thoroughly enjoyed the game, and I still look to complete it by collecting all of the collectibles.  Playtonic did a fantastic job bringing their original formula into the modern day, with updated graphics and animations and large, sprawling worlds for the player to explore.

However, there seems to be a similar complaint among those who are faithful to the genre - after the first world, there seems to be less of a desire to hunt down each and every item or challenge.  Many seem to feel that the levels become "disconnected", and progression becomes very drawn out.  I too have felt that this game has had a few flaws, and I want to explore exactly what those are and what could have been done to fix them.  The question this puts in my head is this - How do you create a game in this genre, with the aim to create the same feel as it's predecessors, while at the same time meeting the trend of growing the space in which your game takes place?

Why write this?

Yooka-Laylee, and other games that fall under the Free-Range Platforming genre, appeal to gamers who like to explore, discover, and interact within an interesting 3D space.  While the game mechanics are important to the impression the player has over their experience, creating a space that places the player in a state of flow is almost more important.  Everything down to the tactile interaction the player has with the objects placed around them assists in creating a memorable and enjoyable experience.  It is in the expansion of these virtual spaces that we often see a change between generations of gaming, as an increase in memory and processing power allows for bigger and more interactive worlds to explore.  To create a world that in non-linear, but also naturally guides and encourages the player to take specific actions is a challenge indeed, and I hope to get a firm grasp on how 3D level design should be done for my own work in the future.

**Please Read This:  Despite how critical I may sound in the following paragraphs, I have thoroughly enjoyed this game and cannot wait to see what Playtonic does next.  I am by no means an expert on game design, but I'd like to take a step closer to understanding why a game leaves a particular impression on me.  This blog post is simply a practice of taking what I have learned from others and applying it to what I have experienced.  Please feel free to hit me up for some constructive criticism or if you have any counter-arguments to the ideas that I present here.

Overworld and Interest Curves

In his book, The Art of Game Design, Jesse Schell describes the methods in which developers organize the space in which their games take place.  The pattern in which these spaces are organized dictates the flow and direction that the player will travel when progressing through the game.  Free-Range platformers of the 90's took the approach of arranging their levels and stages into a web, like so:



 Each of the yellow circles in the web above would represent a level of the hub world (the floors of Grunty's Castle), while the branching purple circles represent the smaller stages.  The lines separating each of these areas represent some kind of level transition or another (i.e. doors or book portals).  This is a quick sketch of my understanding of the map, so if there are any shortcuts I missed, I'll edit the chart and add them in.

This segmented approach to level design marks an interesting transition between the linear level progression that platformers have seen up to this point, and the interconnected, open-world design that is often favored among many adventure games today.  This branching hub layout, however, aids in creating an alternating interest curve for the player.  After the exhilaration of exploring a brand new world, returning to the hub grant the player a bit of down time before striking out on their next big adventure.

Yooka-Laylee's hub world is Hivory Towers, the corporate lair of Capital B.  The size of the hub world matches that of one stage, each area carrying it's own unique challenges and characteristics.  As opposed to several stages that branch from this hub, however, Playtonic opted to create 5 expandable worlds, giving the player the freedom of choice to either try to progress further into the overworld, or stick around and complete the level they are currently playing.  When this option is presented, it presents a striking peak to the interest curve:  either way, you are going to have something brand new to experience, it's just a matter of deciding where to go and what you spend your pagies on.

*Attempted  representation of my personal first play-through experience.


Hivory Towers, on it's own, serves as the valleys to the interest peaks.  Even though it is considered as the hub and overworld of the game, it is usually treated as more of a sub-space in comparison to the other stages.  There is often less to collect, challenges for pagies are few and far-between, and it is really just a pathway between levels.  Having this familiarity in space in-between worlds that might be largely unexplored, however, offers an important break from the excitement.  When Schell discusses his experience as a juggler in the past, he describes these breaks as a chance for the audience "to relax and get to know you".  Giving the player time to become absorbed into this world could be considered an investment, as they will experience much more excitement for the finale.

This kind of interest curve can even be applied on a smaller scale, within each playable world.  Part of what made the collect-athon so popular among it's followers was the addictive quality of consistently being rewarded for gathering items.  This creates a particular kind of arc in player interest - as they explore a new world, they are picking up these items along the way, until they have come full circle and realize that they missed a few notes somewhere along the way.  Below is a reflection of my own interest curve when I played through Tribalstack Tropics:

*Attempted  representation of my personal first play-through experience.


Context

It may be fate that around the time I started doing my research into 3D Platformers, I finally got around to opening up Swink's Game Feel.  Glossing over the table of contents made me jump ahead to his masterful analysis on Super Mario 64, which was a mistake, as I completely passed over his descriptions of the metrics he uses to compare the "feel" of games.  His discussion on the metric of "Context" is one that felt the most relevant to the previously mentioned criticisms of Y-L.

The word context itself is defined as "the circumstances that form a setting for an event, statement, or idea, and in terms of which it can be fully understood and assessed" (via google).  In this regard, Swink observes context in games as the interaction between physical objects and their placement within a space.  This includes most attributes that are applied to the avatar, including size, speed, and behavior.

Swink uses 3 levels of context to measure the impression that the space leaves on the player:  "High-Level Context", which refers to the impressions of space, speed/motion, and size, "Medium-Level Context", which observes immediate space and object avoidance, and "Low-Level Context", which observes the tactile interactions between object within personal space.  Each of these impressions can make or break the design of a level, especially within a 3D space.

High-Level Context


The impression of space within any level in this genre is one that evolves over time, as you begin to get a better understanding of your position by memorizing particular landmarks.  This is made even easier by the circular shape of each map, that typically has a structure or large geographical feature at it's center - a strong, centered landmark.  This sort of design allows the player to map the area as they explore without spelling out directions for them.  Anyone who has attended a good-sized carnival can relate to this usage of landmarks - "Where was the cotton candy stand?  Over by that Ferris Wheel, right?".

Tribalstack Tropics, fully expanded.

The first world that opens up to the player is Tribalstack Tropics, and it's layout demonstrates how the designer can guide this evolution quite well.  The screenshot below is one of the earliest views that the player has after they spawn into this new and colorful environment.  



After following a short path from the spawn point, you are immediately met with a fork in the road and a highly characteristic horizon.  Directly ahead of you is a temple that marks the center of the map, to your left is a plain old dirt path, and to your right is a wooden bridge.  If your eye is a little more keen, you might be taking a particular interest in the giant, neon pink arcade cabinet that also has a spot in your line of sight...  This early on, you would already be taking mental note of this vantage point, giving you some notion of where to travel next if you happen to find yourself at these crossroads again.  There is no mini-map or objective marker provided in the free-range platformer; the player has to rely on their understanding of the world's layout based upon the placement of these landmarks.


Landmarks are what players remember and what they talk about, for they are what make a space memorable.
- Jesse Schell

This is not a new idea, and it doesn't need to be.  Swink's breakdown of Mario discusses Nintendo's use of context in their level design in great detail.  His analysis on the High-Level Context application in Super Mario 64 compares each stage's layout to "the zones of a theme park" where the "landmark-focused approach" provides a "delightful sense of vastness and exploration".  As I previously mentioned, Banjo-Kazooie also took this approach...




Now, while the most memorable levels from this genre typically followed this design, there were exceptions.  SM64 featured levels like "Big Boo's Haunt", which took place inside a haunted mansion, or "Hazy Maze Cave", which lives up to it's name.  Banjo-Kazooie had Gobi's Valley and Rusty Bucket Bay, both of which had many smaller stages/puzzles that took place indoors, separated from the overall perspective of the stage.  While these may have been considered to be refreshing changes of pace from the typical stage layout, they are often lauded even by the most devoted of fans, as it provides a disconnect from the spatial awareness that the player draws in their mind as they explore the landscape.

This is also the case with Glitterglaze Glacier, as much of the level takes place within caves or the Isymetric Castle.  In this manner, the majority of the world's landmarks and challenges are connected by a series of doors and bridges, rather than being a part of an interconnected loop.  In many ways, this instills the feeling that Glitterglaze Glacier was built on the fly, with a little less deliberation in design than Tribalstack Tropics.



Moodymaze Marsh takes this a step further, removing a central landmark from the world altogether, and limiting the draw distance to challenge the player's navigational skills.  This is, of course, deliberate, as the name of the stage itself suggests a disorienting perspective.  The designer balances this a bit through the use of pipe-tunnels that can be used as a sort of fast-travel to areas you have managed to find in the past.  However, this provides a similar disconnectedness that is present in Glitterglaze Glacier - a sort of incomplete logic in the map layout.  Ultimately, I found myself wanting to spend as little time here as possible, as I became more and more frustrated when trying to keep track of where I've been.



Capital Cashino steps back to the "circular theme park" layout, with a few rooms branching off that feature their own puzzles and challenges.  At the center of this map is a theme-appropriate water fountain featuring a lot of... character.


Returning to this style of map design, paired with the highly characteristic landmarks (by way of artwork, props, architecture, and puzzles/challenges), gave the impression of an arcade, where the playing and completing these games and challenges are more emphasized than the act of exploring.



The final stage before battling Capital B, Galleon Galaxy returns to the bridge-building design that we encountered in Glitterglaze Glacier, but in a manner that suits the overall theme of the stage.  Points of interest on the map are separated by a cosmic ocean, which can be traversed by flight or by teleportation.  As each landmark is large and just kind of floating out in space, it is rather difficult to get lost, but you are still met with an impression of openness and majesty on your first visit.

Similar also to Glitterglaze Glacier, much of the play space in Galleon Galaxy is actually separated from the outside space in which you begin.  Many challenges and puzzles take place inside of one of the many landmarks that populate the map, but they are self-contained.  Having one entrance and one exit for a room with a single challenge allows the player to keep better track of where they have been and what they have accomplished. What is jarring about these rooms, however, is how large and displaced they may seem - a small meteor holds a massive golf course puzzle, a massive moon holds a rather average sized sliding challenge.



This, of course, was not necessarily an issue in previous adventures.  The anthill in Mumbo's mountain was much larger on the inside than outside, as was The Salty Hippo in Treasure Trove Cove.  Even reaching the top of Grunty's Castle, when you think about it, didn't make a whole lot of sense.  However, in one way or another, you made your way through these rooms with some logical sense.  You start at the base of the anthill, and travel upwards, while the interior gets narrower and narrower; the Salty Hippo was partially flooded after being beached, so the player would have to jump atop floating boxes or swim to the floor to gather Blubber's gold.  In Yooka-Laylee, it felt like most of the rooms that branched away from the rest of the level didn't provide any natural guidance.  The Isymetric Castle, while an interesting concept, seemed like it was intended to be it's own world altogether, continuing on and on and making it easy for the player to lose track of where they've been.  The rooms of Galleon Galaxy felted simply like detached rooms that really only kept the theme of the stage, rather than utilizing the spherical shape of the structures in which they were placed or playing with gravity.

It is worth noting that before entering Galleon Galaxy, Yooka and Laylee are taught "Flappy Flight"  which can be used at any time and lasts as long as your energy bar does.  Granting this ability at the end of the game simplifies a lot of the issues I had encountered in the levels previously, and makes it a lot easier to search high and low for those last few missing quills.  The levels, for the most part, were built with this in mind, as they permit a lot of vertical travel space to the player.  It's how I managed to get a lot of the screenshots for this blog post.

 Mid-Level Context


The concept of Mid-Level Context observes the player's immediate surroundings, referring to the objects that can be interacted with.  Swink suggests that when measuring this level of context, the designer needs to examine 5 object traits:
  • The Number of Objects
  • The Size of Objects
  • The Nature of Objects
  • The Layout of Objects
  • The Distance Between Objects
The use of the term "object" can be rather broad when talking about the free-range platformer.  The first things that may come to mind are the collectibles that populate your path, or the number of enemies that will get in your way.  It can, however, even refer to simple static obstacles, like platforms or walls, that require a little added maneuverability to get around.  In a genre that prioritizes movement and navigation above all else, it would be fair to say that the feel of this level of context is extremely important to the impression a world leaves on the player.



Swink relates this level of context to his experience playing World of Warcraft; his traveling experience in WoW is compared to a long drive between cities, where a lack of scenery or change in direction result in "highway hypnosis".  He states, "Across multiple games, we can compare how far apart objects are spaced relative to the speed and motion of the avatar and can examine how this changes game feel". Swink later points out one of the biggest factors that benefited the feel of Super Mario 64 was the manner in which object placement was tuned to Mario's jump heights and trajectories, and how these relationships are presented to the player throughout the game "regardless of what else is going on in the level".  To put it a little more simply, you can get an impression of this level of context based upon the 5 traits in relation to the abilities of the avatar.

With Yooka-Laylee providing such an arsenal of abilities the player can use, utilizing each one in a meaningful way when the player is exploring a level can get very tricky.  A prime example of what this could look like, however, can bee seen in the very simplistic formula presented by Prospect's "Unbox".

From Unbox's press kit.

I've come to look at this game as the Goat Simulator of 3D Platformers - it is simple, with a lot to do, and by no means a perfect game, but I've found a lot of joy in it regardless.  What Unbox did so brilliantly is strip platforming mechanics back down to their basics and exaggerating them.  You have the clumsy action of rolling a box around on the ground, and the ability to "unbox" yourself up to 6 times, which essentially means that the player has 6 extra jumps that you can perform in mid air.  Pair these abilities with the appropriate balance of physics code, and you have a really satisfying avatar that is difficult to master.


What is great about this exaggeration of basic abilities, however, is that it allowed the designers to create massive, sprawling worlds for each level.  At least, they only appear massive in relation to your size as a cardboard box.  The ability to fly through the air using fans or your hexa-jump(?) allows you to cross these worlds in a matter

of seconds.  These added jumps allow the player to make-up for misjudged jumps or falling off the path, accounting for the unfamiliar sensation of trying to roll a box along a path.

Although Swink has stated multiple times in his book that context can only be measured as a soft metric, this put the thought in my head that I could measure object-in-level density by simply traveling across a level in a straight line, using the fastest method of transportation Y-L would currently have, measuring how much change in controller input is required.

This concept is by no means scientific, so take the following with a grain of salt.  However, the results that I saw were of interest to me.  When traveling in a straight line on Tribalstack Tropics, I never found myself holding a steady course for more than 10 seconds when using the roll, a move that I would find myself using often to make my travel time as short as possible (given to the player before entering Level 1).  Utilizing the fastest method available to the player for this measurement is important because, as previously quoted, the spacing of objects and it's effect of game feel is dependent largely on the speed at which the avatar can move.

 
Compare that time of 10 seconds in Tribalstack Tropics to the length of time it took me to traverse the lake in the image above (in Glitterglaze Glacier), which took approximately 45 seconds (accomplished by frequently double jumping out of the water to cover ground a bit faster than by swimming).  There are a few scattered jellyfish lurking beneath the surface, but if you are simply trying to cross the map, they won't give you much trouble.  There is, of course, an icy path of floating platforms that you could use to cross.  But providing only one pathway across a vast void like this one is too linear of a solution.

What should be used to fill these voids?  Typically, the types of objects that populate Yooka-Laylee's game space are collectibles, enemies, or platforms (not really counting the NPCs and their challenges).  The combination of these items strike an interesting balance of "pleasure seeking" and "pain avoidance"; collecting items provides the player with a small reward, usually in the form of fanfare or a point increase, while platforms or enemies can break rhythm and flow, encouraging the player to further master their control and timing of actions the avatar can take.

Tribalstack Tropics offered a near-perfect balance between these two sensations in a space that felt open with a lot of room for maneuverability.   The important thing to note, however, is how the placement of these objects created a space that was neither claustrophobic, nor barren.  Object placement in this manner allows the player to think about the space as a whole and reflect on where they need to go next, while simultaneously focused on the obstacle that lies directly ahead of them.  Going back through the level and trying to find those last few notes doesn't necessarily become much of a chore, as the level of attentiveness required of the player to simply traverse the 3D space is enough to keep them from getting bored, but not too much to be a burden.


Playtonic did break some of the conventions that we saw in the free-range platformer of the 1990's, however.  In the above image, you can see that the placement of quills, the more common collectible item, isn't reserved specifically to platforms or paths that players are expected to take.  They are often found obstacles that might usually be treated as walls rather than platforms; something to simply avoid rather than climb.  This, in a way, breaks the conventional boundary and gives the player freedom to explore every inch of the world no matter the terrain.  We'll look at the effect this has on boundaries with a bit more detail later on.

By using quills to suggest this level of freedom, however, these "common" collectibles become hard to find rather quickly.  With a set number of quills established for every stage (excluding Hivory Towers), they can feel pretty scarce when you're sticking to the path.

Low-Level Context


Low-level context is concerned with the avatar's personal space; the way in which the player can interact with object and collision code.  In his analysis of Super Mario 64, Swink mostly addresses how Mario interacts with the ground under his feet.  Designers used steep inclines to make Mario lose his footing and slide, which is applied both as a way to mark boundaries and as a new way to control his movements.  Once more, the emphasis on this kind of interaction makes sense in a game where movement is key, and the challenges in Yooka-Laylee are designed with this in mind.

Momentum and friction are both simulated in a logical manner (at least, with regards to interactions with common terrain and platforms).  Slopes and inclines get a little weird, however, as what is defined as "slippery" is not based purely on steepness.  Some slopes of similar degree can be walked on, some require rolling, and some require rolling plus a power-up, like honey.  There really isn't much of a way to determine which of these are necessary until you simply attempt the climb.  Slippery slopes in SM64 were based purely on the degree of steepness, which the player could judge after becoming acclimated to the game's physical rules.


The "Reptile Role" is a move considered to be the successor to the "Talon Trot" in Banjo-Kazooie, with a bit more speed and the ability to knock back enemies that come into contact.  Both of these moves are acquired very early in the game, and are often relied on by the average player to traverse through a course quickly.  While Talon Trot was quick, it was also precise in control; the player had the ability to make sharp turns and stop on a dime, while climbing nearly any surface.  Reptile Roll sought to balance this by countering the aforementioned speed boost and knock-back capability with controls that felt a little more slippery and hard to control with precision.  By creating a mode of transport in this manner, Playtonic has ensured versatility in game play, so that no single moveset is favored.

Boundary Play


Swink sees these extreme angles in SM64 as a soft boundary, a "gentle negative reinforcement with a clear, physical relationship".  In other words, it's a not-so-punishing way of saying "turn around".  Boundaries in Y-L are treated quite differently.  In Tribalstack Tropics, they almost don't exist whatsoever.  As I mentioned in the section regarding Low-Level Context, climbing objects that aren't platforms is encouraged (boulders in this case), and the edges of the world are marked with those objects.

While this instills a feeling of openness to the stage, playing with these boundaries can easily result in death-by-void, and even if you are skilled enough to traverse the outermost edges of the map, you'll discover that there isn't really much waiting for you.

Moodymaze Marsh and Galleon Galaxy, on the other hand, employ the old "floor is lava" technique, where rather than falling to your death, the player is given a chance to turn tail and get back to the intended play space.  While this is less harsh of a punishment, the Marsh's lowered draw distance would consistently entice me into thinking that there might be more ahead of me, if I could find a way across this hazardous waste.

The above is, of course, only addressing boundaries on the horizontal axis.  Boundaries below the player either end at your feet, or somewhere below the course, watching for you to fall into the void.  A boundary above you is usually just a ceiling that stops any further ascension.  The ceiling of each stage in Y-L is set pretty high to accommodate the grand scale of structures and landmarks (see previous screenshots), and with the end-game ability of Flappy Flight, these generous barriers offer some interesting perches (again, see previous screenshots).  

The one and only place where vertical travel feels more limited is in Glitterglaze Glacier; the ceiling is noticeably lower, and forbids the player to reach vantage points of interest.  Not only that, but rather than being a solid wall of collision, the ceiling will actually push the avatar back down, a kind of jarring way of saying "No Trespassing".  I couldn't help but get the feeling that this particular ceiling, combined with the variance in low-level context between the avatar and other objects, demonstrated a lack on uniformity between rule sets between stages.


Conclusion


Upon reviewing everything I discussed in the above paragraphs, it feels more like I just spent a lot of time picking apart the things I didn't like about Yooka-Laylee rather than answer the question I posed in the introduction.  Truthfully, many of these details or just that - small details of a bigger picture.  Playtonic sought to revive the 3D Platforming genre by adapting the original formula into modern-day gaming, and they accomplished this by creating captivating worlds that were massive and packed with things to do.  They weren't perfect, as you will no doubt see in reviews on Metacritic, but they were a good starting point.  Tribalstack Tropics specifically will go down as one of the most entertaining virtual spaces I have explored in a long while.

This research was a really fascinating crash course on 3D level design, especially for games where exploration is key.  I aim to use what I learned from Schell and Swink in my future analysis of games and in my own designs as well.  For now, it's time to spend a little less studying design and actually get my hands dirty.

Wednesday, April 19, 2017

"Free-Range" Platforming

Alternatively Titled: "Don't get caught up in terminology like I do."

While I was researching for my previous post, I found myself getting caught up in labels.  It turns out that the name "3D Platformer" can go a long way, and I was constantly finding myself reading too much into games that were not really similar to the type of experience I was searching for.  As an obvious example, Wikipedia gave me Crash Bandicoot when I wanted Donkey Kong 64.

This led me to searching for games that bore the other relevant title of "Collectathon".  However, it turns out that I would face a similar issue.  While games like Banjo-Kazooie and Super Mario 64 wear this label with pride (collecting being the goal of the game), there are others that also bear the title that are not quite in the same vein of gameplay.  Titles like Rayman Legends, while incredible games that highlight collecting as a motivation, are still linear experiences in comparison the the exploratory nature of the N64 Rare games.

I'm hereby proposing a name change for the games that followed the 3D Platforming Collectathon model of Super Mario 64:


"Free-Range Platformers"




The term "free range" refers to a style of husbandry that has livestock (usually associated with chickens) roaming freely in an enclosed area outdoors, rather than being cooped up all day.  I found myself relating to these games in this manner; typically, each game will have a hub world that the players will have to return to after spending some time exploring a stage.  Try to imagine those free-range chickens collecting all of those seeds and insects, only to exchange them for a more prime location in the chicken coop when they return at the end of the day.

Granted, this label may suggest that the player is some kind of a farm animal, but I stand by it.  In fact, I think I'll use this term in my future posts until at least ONE other person picks it up.

P.S. - More in-depth analysis on free-range platformers coming soon.

Saturday, April 15, 2017

The Evolution of the 3D Collect-athon (and Where it Stands Today)

The early reviews of Yooka-Laylee have been pouring in (prior to it's April 11th release date), and the results have been rather polarized.

via gamerankings.com


Many reviews have praised the game as a proper "return to form", being a true spiritual-successor to Banjo-Kazooie.  Others have found the game to be far too dated, stating that the game carried issues back from the N64 era.  I have often considered Banjo-Kazooie to be one of my favorite games of all time; it is the game that got me into games in the first place.  So I had to ask myself: Is there really any room for the original 3D Platformer/Collect-athon style in this day and age?  Could a game like Yooka-Laylee offer more than just a nostalgia trip?


Where it Started


Or, at least, where it became popular.  The 1990 MS-DOS game "Alpha Waves" is credited as being the first 3D Platform game to exist.  But it was the newly-imagined Super Mario of the mid 90's that truly defined the genre...

With the release of the Nintendo 64 in Japan back in 1996, the console's 64-bit processing power, paired with the introduction of 360° control via thumbstick, offered a brand new experience for gamers and developers alike.  While developers had the ability to use the N64's processing power to create new and exciting 3D landscapes,  the addition of precision control within these open environments gave player complete freedom of movement, encouraging exploration and non-linear navigation to get from "Point A" to "Point B".  This innovation in control would be demonstrated by the N64's flagship title: Super Mario 64.


Screenshot courtesy of Wikipedia.

This new and exciting take on the Super Mario franchise was met with outstanding reviews, welcoming the birth of the 3D platformer into the industry.  Publications and websites including IGN, Edge Magazine, EGM, Gamespot, and Famitsu all reviewed SM64 with near-perfect scores.
"Not only does the game obliterate every platformer before it in terms of visual finesse, it plays just as well if not infinitely better than previous 2D incarnations of the Mario franchise... More freedom, more space, more options, better graphics, improved and elaborated control schemes -- it's all there. "
- IGN
"With realms so vast and detailed, and yet so graphically clean and simple, one instinctively wants to go exploring: What's just beyond that rise? Who's peeking at me from behind that wall? How can I get to that far ridge, that seemingly inaccessible platform, that island floating unsupported in the air? ...If Mario 64 is even a rough indication of what's to be expected from Nintendo, or from games in general, then we just might have a revolution of sorts in our very hands."
- Gamespot
While the reviewers of this time talked-up the revolutionary open-world format of SM64's level design as well as it's graphical beauty, they by no means skipped over the new mechanics that were being introduced to gaming: freedom of movement and freedom of camera control.  "A revolution of sorts" in the palms of our hands.


The Mechanics of a 3D Platformer


Mario is pretty well known for his jump.  It was his primary action in the original Donkey Kong arcade cabinet, and it is his primary action in Nintendo's first mobile game, Super Mario Run, that released earlier this year.  It is this jump that founded the platformer genre in the 1980's.  It then comes as no surprise that his acrobatic ability became the focal point for his introduction into the 3D plane; pairing the precision of the thumbstick with a variety of button presses gave Mario a pretty extensive variety of moves.





Look Before you Leap

Placing the player on a 3D plane also brings the viewpoint into question.  Until this point, the typical platform game used a fixed camera angle, as the player only had to move on a 2-dimensional plane. With the importance of precision control in platforming games, the player needed to be able to see exactly where each of their jumps would land.  Naturally, having a 3rd Dimension made this difficult, but the developers of the 90s accounted for it in many ways:  Mario 64 not only pioneered the use of a smart, dynamic camera, but also gave the player some control over their view; using the 4 C-Buttons on the controller moved the camera left and right, as well as allowed the player to zoom in or out for a better look at their surroundings.  While far from perfect, the use of the C-Buttons in this manner would precursor the second analog stick that most controllers use today.



Pulled Punches

Though this style of control was unfamiliar to gamers in 1996, it didn't take too long to master the fluidity of Mario's movements.  It is worth noting, however, that combat has taken a back seat; the 'B' button provides a 3-punch/kick combo that can only be used if Mario is standing still, and there are no fire flowers to provide the player with the trademark Fireball attack.  The basic attack required the player to be facing the right direction, and they had to rely purely on timing. The combat moves that sees far more usage are the ones that encourage the player to keep moving - jumps, ground pounds, and dives are far more commonly used by the experienced player rather then stationary punches.

And continuous motion is part of the point.  While it was understandable at the time to stop and take in these beautiful 3D landscapes and vibrant colors, Nintendo wanted the player to explore these landscapes and see what they had to offer.  It is here that collecting becomes an important aspect of the 3D Platformer.


Collect-athon


Super Mario 64 had the player progress by collecting power stars.  These stars were often rewards for various tasks or challenges; such as racing an NPC or fighting a boss.  Stars were also hidden in the stage, and rewarded when the player collected all 100 coins.  The player is not given a lot of direction when pursuing a challenge star, only a somewhat vague title for the assigned task like "SHOOT TO THE ISLAND IN THE SKY" or "BIG BOB-OMB ON THE SUMMIT".  You would have to jump into the world and explore, putting the puzzle pieces together for yourself.


Not long after the release of SM64, the public saw the release of numerous games that adapted their own variations on this design.  Banjo-Kazooie and Donkey Kong 64 are typically the games that come to mind when the term "collect-athon" is mentioned, as they put item hunting at the center of gameplay.  Typically, these items had a varying amount of rarity attached to them, and each were used to progress the game in one way or another.

Take Banjo-Kazooie as an example:  Jiggys are usually at the top of the list to collect, as they allow you to open up new stages to explore.  These Jiggys can be found on their own or obtained through challenges, but they could also be obtained by finding and collecting the Jinjos that were placed at the far corners of the stage.  Some of those aforementioned challenges might require a transformation from Mumbo, but he would only oblige if you have collected the proper amount of skull tokens.  Even when this is all said and done, in order to further progress through Grunty's castle, a large number music notes would need to be collected.  On paper, this sounds like a lot of unnecessary work.  However, the manner in which these items are placed is what makes the item hunting objective worthwhile.


Notes are often the first item the player would see.  Typically, they are placed in a straight line along a path or route, beckoning the player to continue in a particular direction.  Jinjos are less common.  They can usually be found in isolated parts of the map, like out in the middle of a body of water or at the top of a mountain.  While not quite hidden from view, the Jinjo hunt encourages more exploration than notes, requiring the player to travel and search each part of the map.  The rarest item, the Mumbo Token, is akin to the loose change that falls between the couch cushions.  Banjo has to check every nook and cranny to find these tokens.

For most, there is an addictive quality of collecting each of these tokens.  Every item that you pick up is accompanied by a little fanfare and an increase in score/item count/health, an immediate indicator that you were progressing in one manner or another.  You are being rewarded for exploring an interesting, new, fantastical space.  Bonus points.

The take away?  Collectibles that serve the purpose of progression for the player were used as a means of exploration by the developer.  This revolutionary technological shift opened up a whole new world of creativity for game designers, and they wanted to make sure that the player had the opportunity to see every last bit of it.

There is, of course, the possibility of taking collecting a step too far.  This was the lament of many critics and gamers alike when Donkey Kong 64 was released.  Similar to Power Stars and Jiggys, the most important treasure to the DK Crew was the Golden Banana, which allowed the player to progress and open up more worlds.  But there's a bit more to the game than that...
...there's plenty more to collect: regular bananas, fairies (which you must take pictures of with a camera), banana medals, super-secret Rareware coins, blueprint pieces (found by defeating certain enemies), crowns (to unlock multiplayer games) and boss keys (to unlock new areas on the island). Now, factor in that each of the five characters must find some of these items individually: Devoted gamers will see this as added replay value, while others will see it as a royal pain in the Donkey derriere. - Gamespot

It is important to note, however, that no matter how many collectibles were available in each stage, not everything needed to be collected for the player to progress.  In fact, the percentage of what was needed to progress through a games hub world starts low and gets higher, encouraging the player to go back and look for the things they may have missed as they approach the end game.  

For example, in order to fight "Bowser in the Dark World" and get the key to move up to the second floor of Peach's Castle, Mario would have to collect a minimum of 8 stars, when there are 28 available within the first few stages (~%30).  Compare this to the final fight with Rainbow Bowser, when 70 stars are required of the 118 available (including castle secret stars).  Now, the player needs to have at least %60 of the stars collected before "finishing" the game.


Evolution


1996-2000

The late 90's saw it's fair share of games that followed the 3D Collect-athon formula.  After Super Mario 64 and Banjo Kazooie, we had classics like Donkey Kong 64, Spyro the Dragon, Glover, and Gex: Enter the Gecko.  Each of these games took the 3D platform model and added their own personal touches to it, expanding the variety of the genre more and more.

Oddly enough,  the more complexity a new game added to the genre, the less it felt like a platform game.  Some games made a point to continuously add moves or power ups as the player progressed, offering up new puzzles and challenges in newer levels.  A few hours of Banjo-Kazooie felt more like spending a day at the Fair or at Chuck E Cheese - maps tended to be circular in nature, with a different challenges placed frequently along the path that required the mastery of some skill or move that you learned not long ago.  You could relate this to, say, walking past BB gun shooting ranges or ring toss games as you try to win a stuffed animal for your date.  That's not to say that platforming disappeared completely - the player still had to seek out and navigate to these challenges themselves.  


 Screenshots of Mumbo's Mountain and Treasure Trove Cove.
Courtesy of Banjo's Backpack.

Donkey Kong 64, on the other hand, took the focus even further from platforming into expanding the capabilities of the player, through the introduction of the "DK Crew".  As previously mentioned, the level of collecting in this game was much higher than that of the genre's predecessors, but it also played heavy on the concept of replay-ability;  more often than not, there were just certain puzzles or challenges that you did not have the capability to solve quite yet, and you would need to return some time in the future if you wanted to get that particular Gold Banana.


What we are witnessing during this time period is actually a slow shift away from the platforming aspect of the collect-athon and a turn to the "Adventure" genre, where the focus shifts a little further away from exploration and more on puzzle-solving and character interaction.  Using Math Manent's Nintendo 64 Anthology, we can actually visualize this shift by the manner in which each of these games are listed by their genre:

  • Super Mario 64    - 3D Platformer/Adventure
  • Glover                  - 3D Platformer/Adventure
  • Banjo Kazooie     - Adventure/Platformer
  • Donkey Kong 64 - Adventure/Platformer
In many ways, the light-hearted and colorful mood that would typically accompany a game in this genre reflected this shift.  There was not a lot of depth to their stories, no complex relationships to manage.  The only interactions you really had between characters were sarcastic dialogue or pun-heavy dad jokes.  The focus at this time was still on game play, and its why they are remembered so fondly.


2000-2003

The year 2000 saw the release of the Playstation 2 (followed closely by the XBox and GameCube), and with it, another significant shift in processing power for the game industry.  The system could handle a much higher polygon count, offering more detailed graphics and animations, and it could handle massive, sprawling worlds compared to the consoles of the previous generation.

One of the earliest titles for this system is still widely regarded today: Jak and Daxter.  Naughty Dog introduced a brand new dynamic duo and a brand new colorful world to explore, sticking close to the format of 3D Platform/Adventure games from previous years.  All of Jak's moves were usable from the beginning: double jumps, high jumps, rolling jumps, spin kicking and dash punches, just to name a few.  The only way in which game play could change is if the player absorbed "Eco", which provided Jak with a speed boost or the ability to use fireballs for a short while.

Jak and Daxter utilized a similar collecting model to Banjo-Kazzoie; precursor orbs were very common, and were often used as a means of suggesting to the player what paths they could take.  Scout Flies equated to Jinjos, as they were hidden about each level.  When they were found, the player is rewarded with a power cell.  Power Cells, as you can probably guess, are the Golden Banana/Jiggy/Power Star of the previous generation; you can only progress when you have gathered enough of these.  And as before, only a certain percentage of these needed to be collected to proceed.

Even though these designs feel familiar, Naughty Dog took full advantage of the new technology at hand to "modernize" the 3D platformer.  Jak and Daxter is listed in the Guinness World Records as the first game to create a "seamless 3D world in a console video game", and it's effects on players were very clear.  While the world of Jak and Daxter was still divided between levels and a hub, the fluidity in which the player could traverse between the two made the flow of exploration all the more natural.


During this time, we see the fantastic return of old characters, as well as the introduction of new ones, all of which use the new graphical processing power at hand to extraordinary lengths.  We have already met Jak and Daxter (2001), but not long after we find Mario in his new adventure, Super Mario Sunshine (2002), and we get to meet newcomers Ratchet and Clank (2002) and Sly Cooper (2002).

Each of these followed a simpler collect-athon pattern, balancing the rewards between progression and "powering-up" the character:

  • Ratchet and Clank offered up a variety of weapons and gadgets that can be purchased by collecting bolts, placing more focus on action and shooting in the platformer genre.
  • Sly Cooper introduced stealth into platforming, offering an amusing way to interact with the environment.  Sly could collect notes that were hidden within each course that would offer upgrades once they were all collected, including new moves and abilities that are not necessary to progress, but can improve the way the player navigates the course.
  • Super Mario Sunshine once more had Mario collecting stars (or Sprites, in this case).  However, this time there was a bit more story offered, and Mario is teamed up with FLUDD, an upgrade-able, robotic backpack that shoots water.

 Images courtesy of Wikipedia.

While all of these games offered new takes on platforming, they too sought to utilize the new generation's hardware to it's furthest extent.  The update in graphics and animation gave the characters more life, and the extensive writing and voice acting gave them personalities.  Stories had much more significance, and trended towards being more mature in nature.


2003-Today

In the wake of Grand Theft Auto III's release in 2001, open-world sandbox games were on the rise.  There are some who considered Jak II's release in 2003 to signify the death of the 3D Platfomer Collect-athon, as it turned away from the trends of the last generation toward a future with even bigger worlds, more complex storylines, and the freedom to do just about anything.  There was the occasional Precursor Orb to gather, which would unlock bonus features from the developers, but it certainly wasn't an objective for every player.

As our technological capabilities grow, so does this virtual playing field.  The AAA developers of today are looking to create as grand of an experience as possible, with the likes of The Elder Scrolls and Fallout franchises offering the capability to live a second life within the vast world they've hand-crafted.  No Man's Sky advertised a whole universe to explore, with 18.6 quintillion planets to explore.  These games offered beautiful scenery and a large map for their stories to take place, but no real push to go out and explore, save for the objective marker on your mini-map.

However, it turns out that the collect-athon of the 90's doesn't die quite so easily.

Nintendo has been a company that sticks close to their IPs, is still putting out fantastic Mario games.  Super Mario Galaxy and Super Mario Galaxy 2, while a bit more linear in nature than their predecessors, offer a fresh twist to platforming.  And while AAA games have been following their  trends, the growing population of indie developers are bringing a whole new perspective to the table.  Games like Snake Pass look to put a new spin on player control.  FreezeME added a new mechanic of freezing platforms and objects in their place for the player to use in their challenges.  The cult hit Psychonauts brought brilliant, charming writing and original concepts to the table, as Raz navigates the minds of those around him.

Coming later this year, we also have the much anticipated release of A Hat in Timea 3D platformer that looks to stick close to the original model of Super Mario 64, pairing the exploration of a vast, colorful world with a fun and quirky attitude.

And, this week, we had the "Rare-vival" itself: Yooka-Laylee.



This kickstarter project was created by the team originally behind Banjo-Kazooie and Donkey Kong 64, who aimed to modernize the classic 3D Platforming formula.  Being more BK than DK, the game set aside story for mechanics, creating a whole new set of moves for the player to learn with the goal of finding and collecting Pagies.  However, instead of having 9 or 10 varying levels for the player to explore, they chose to develop 5 massive, expandable worlds that could take hours to complete - their own way of keeping up with the ever-expanding playing field.

Conclusion

Freedom in game design has a whole different definition today than it did in 1996;  simply breaking into the 3rd dimension was more than enough to captivate the audience of the game industry back then.  But the 3D platformer was not just the gimmick of the 1990s, it held a particular spirit of fun that many of us still enjoy after 20 years of gaming.  Here's to hoping that we see more from the talented developers of today!

*Taking the time to research these games has taught me a lot regarding their design.  I plan on writing a follow-up post that will explore these concepts much more deeply.


Thursday, January 19, 2017

NESDev - End of Semester Sprint (Pt. 2)

I just wrapped up my last blog post, which covered some programming concepts for the game.  As I had little time, I had to eventually settle on a stopping point and move on to the hardware implementation of this project, lest I risk getting a low grade.

Cartridge Overview


There are a few ways I could have approached the porting process.  The one I chose is a fairly common practice among developers, in which they purchase a "donor cartridge" and use an EPROM programmer to write their own code onto chips.  The original ROM chips would be desoldered and replaced with the new EPROMS/EEPROMS that the developers have programmed.

The other method is to simply write to new boards altogether.  Some creative individuals have managed to create their own tools and reproduction circuit boards for those who home-brew their own NES games.  I plan on testing this method in the future, purchasing boards and proprietary programmers manufactured by Infinite NES Lives.

The majority of the instructions I followed were provided by The Poor Student Hobbyist.  He provides incredible detailed and easy-to-follow guides for the porting process.

Mappers and Donors


I did not conduct extensive research into the various mappers that can be used for NES games, but I figured that with how small my game currently stands, I could certainly get by with the standard NROM mapper, which was used on classic titles like Bomberman, Mario Bros., and Ice Climbers.  There are many dedicated users who have created full databases of cartridges and mappers, which makes the process of finding a suitable donor much simpler.  After a little research, I visited my local video game retail store and purchased used copies of Baseball and Tennis as my donors.  

After purchasing my donors, I took them to the laboratory to try to desolder them.  I attempted to take apart Baseball first, with little success...

Thank God I bought that second donor cart.

Programming the New Chips


As I learned the hard way, you cannot re-program the CHR and PRG chips that are already in your donor cartridge.  Turns out they are called Read Only Memory chips for a reason.  Once I had got this fact through my thick skull, I went to a local electronics store and picked up a few M27C512 EPROM chips, 1 to hold the PRG data and 1 for the CHR data.  This chip is much bigger than I needed, but I figured I could spare the funds to ensure I had a lot of space to work with.

Now, I kind of lucked out in regards to programming equipment.  The campus had a Chipmaster 6000 hidden away that was used as a universal programmer for EPROM and EEPROM chips.  You can see a few more details on this device on my previous post regarding my hardware setup.

The programmer.

Using the software for this programmer is fairly straight-forward.  In short, you check to ensure that the chip is empty (if not, you need to erase it using UV light), choose the local file that you wish to write to the chip, and burn it.  The software (as well as the indicator lights on the Chipmaster itself) will let you know whether or not there was any issue writing your chosen file to the chip.

Upon reviewing the instructions from the Poor Student Hobbyist, he talks about using the ReadNES3 program to split a ROM file into the PRG and CHR files that will be placed onto each chip.  I was unsure if I would have issues if I instead simply tried to burn the files I had already prepared onto the chips, but being that I was short on time, I went ahead and compiled those files into a ROM, and used ReadNES3 to separate them again.  I even went ahead and doubled the sizes of the separated CHR and PRG files, to ensure they took up the majority of the space on the EPROM chips.

Once all of these steps were said and done, it was time to try programming the chips.  To my amazement (and skepticism), the programmer completed each task without any errors on the first pass.


To ensure that this had worked, I needed to now solder the chips onto the donor board.  To ensure that there would be no damage done to the data, it is recommended that the window on the EPROM is covered with electrical tape, as this window's exposure to UV light sources would essentially erase any data on the chip.




And for the moment of truth...


It works!

Conclusion

The fact that I tried to cram so much information into these last two posts should demonstrate just how much time and effort goes into home-brew games.  I can't help but look at games like Battle Kid and be impressed by the developer.  Truthfully, this was a fascinating experience, and I'm glad that I was able to use it as my senior project before graduation.

I had originally attempted this project due to my life-long love of video games;  I wanted to find a way to combine that passion with the field I had chosen to pursue in school.  What I ended up with, however, is a new hobby.  There is still a lot that I don't fully understand, but with graduation around the bend, I want to continue learning until I can build the game that I am proud of.  This blog was originally intended to share my learning experience, and I am to continue to do just that.

-JWest

Wednesday, January 18, 2017

NESDev - End of Semester Sprint (Pt. 1)

I'm pretty late for this update, but it needs to be written.  The ultimate goal for Cloak n' Dagger (did I mention that was the name of the game?) was to have a working game by the end of the fall semester.  Originally I had aimed to have a full working game at the time of presentation; however, the design of the game got smaller and smaller, and I ran so low on time that I eventually decided "If I have two characters on a screen that move and jump, I'll be good".

Thankfully, I was right.  Ultimately, my project was well received among my classmates as well as my professor, even though my project had less hardware involved that the other projects (an L.E.D. voice-controlled chessboard, laser harp, and a smart mirror, to name a few...).

This blog is going to touch on the last week of the semester.  It will cover my process for porting the game onto a cartridge, some of the issues I ran into a long the way, and where the project currently is.

The Final Week


It was difficult to manage my time during the final sprint, as I had final exams for 4 additional courses to study for.  As previously mentioned, I had to change my goal for a final product; this meant taking focus away from certain issues and turning to new ones.

In the last post, I mentioned that I was trying to implement the GPU's mirroring feature in order to force a sprite to "turn" and face the direction they were moving.  I eventually decided to forgo that feature altogether, and moved my focus to adding a second player, jumping, and collision.  If I had the time, I would go so far as to add background tiles and change up the color palette from the "black and blue" that I had been using from the Nerdy Nights tutorials.

Player 2

Adding Player 2 was relatively easy.  I opted to simply copy/paste/modify the code for player 1, accounting for a change in sprites and change in controller port.  This simply meant using LDA $4017 instead of  LDA $4016 where necessary, and adding onto the sprite loop to account for "Dagger" (yeah, the characters have names now too).

LoadSprites:
LDX #$00              
LoadSpritesLoop:
LDA sprites, x        
STA $0200, x          
INX                   
CPX #$60   ; Compare X to hex $60, decimal 96 (overshooting)
BNE LoadSpritesLoop

Here, I think I overshot the upper limit of sprite tile addresses quite a bit (trying to recall why...).  Essentially, I only aimed to use two characters, but that meant 12 sprites overall.  


sprites:
  ;     vert tile attr horiz
  ; Y - TILE - ATTR - X
;----------------- Cloak Sprites -----------------
  .db $80, $00, $00, $40   ;headleft $0200 - $0203
  .db $80, $01, $00, $48   ;headright $0204 - $0207
  .db $88, $10, $00, $40   ;spine $0208 - $020B
  .db $88, $11, $00, $48   ;front $020C - $020F
  .db $90, $20, $00, $40 ;back leg $0210 - $0213
  .db $90, $21, $00, $48   ;front leg $0214 - $0217
;----------------- Dagger Sprites ----------------
  .db $80, $44, $00, $B0   ;headleft $0218 - $021B
  .db $80, $45, $00, $B8   ;headright $021C - $021F
  .db $88, $54, $00, $B0   ;front $0220 - $0223
  .db $88, $55, $00, $B8   ;spine $0224 - $0227
  .db $90, $64, $00, $B0   ;front leg $0228 - $022B
  .db $90, $65, $00, $B8   ;back leg $022C - $022F

Documentation is immensely important for this project.

For those who may be wondering, the "tile" address (column 2 in the above tables) simply lines up to the position of the tile when drawn in YY-CHR.  The software makes it easy to keep track of where each tile has been placed in memory.



Jumping

Oh boy.

I initially thought that jumping would be fairly straight-forward.  I've figured out how to make a group of pixels move left and right at the same time, all I have to do is make them move up and down, right?

beam_gif



Turns out there were a few obvious points I didn't think about:
  • What goes up is supposed to come down.
  • You're not supposed to continuously jump in mid-air.
Both of these issues where fairly simple to solve, though my solutions were fairly buggy.  There is a lot of code and a bit of a confusing road-map that I will need to explain, so bear with me for a moment.

;--------------------------  P1 Read A ---------------------------
LDA $4016
AND #000001  
BNE A1Fix
JMP ReadADone1  
A1Fix:
NOP

FloorCheck1:
LDA $0200
CMP #$80
BEQ APressed1
JMP ReadADone1
RTS

APressed1:
LDA #$00FF
STA DelayRegister
Jump1:
; ;;;;;;;;;; HEAD LEFT ;;;;;;;;;;
LDA $0200       ; load sprite X position
CLC
SBC #$02  
STA $0200 ; Save Sprite 1 X position
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

------Insert Recycled code for the rest of the sprites here...------

vblankjumping:
BIT $2002
BPL vblankjumping
LDA $0200
CMP #$32
BNE Jump1
BEQ FallDown


FallDown:
LDA #$00FF
STA DelayRegister

Fall1:
; ;;;;;;;;;; HEAD LEFT ;;;;;;;;;;
LDA $0200       ; load sprite X position
SEC  
ADC #$02  
STA $0200 ; Save Sprite 1 X position
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

------Insert Recycled code for the rest of the sprites here...------

Needless to say, jumping took up a lot of my time during finals week.  There were several bumps I hit at this point that required additional research, but before I get into those, let me see if I can simplify the order in which this code is run.
  1. Check $4016 to see if A has been pressed.
    • If A has been pressed, jump to "A1Fix".
    • If A has not been pressed, move on to check if 'B' has been pressed ("ReadADone1").
  2. After jumping to "A1Fix" (to be explained), check if the character is touching the floor.
    • If the character is touching the floor, continue on to "APressed1".
    • If the character is not touching the floor, move on to check if 'B' has been pressed (ReadADone1).
  3. APressed1 will load FF into a register set aside for a delay.  The code then moves on to the actual "Jump".
  4. "Jump1" systematically moves all of the character's sprites up 2 pixels.
  5. The game waits for a VBlank, then compares the position of a sprite to a "ceiling".'
    • If the sprite has not hit the ceiling ($32, in this case) then the game loops back to "Jump1".
    • If the sprite has hit the ceiling, then the character falls, which is our "Jump1" in reverse.

"A1Fix"

This part of the jumping routine was used to fix an issue (Branch address out of range!) I was having when assembling the code.  It isn't an issue with the assembler, but a limitation with the processor.  As explained by users tokumaru and koitsu in this forum post, if the code is expected to "branch" to a subroutine that is rather far away, the processor will throw the above error.  However, we can use this trick of using the JMP command to branch rather than and actual branch statement to avoid the error.

This is simply a result of limitation differences between the two commands.  Any of the branch commands, such as BNE or BEQ consist of 2 bytes: 1 for the opcode itself and 1 byte for the operand.  The operand leaves availability for a signed 8-bit number, which means that the branch command is limited to travelling 127 bytes forward or backward from its location.

The JMP command, on the other hand, reserves 1 byte for the opcode and 2 bytes for an address to jump to.  As koitsu points out, a pretty important distinction here is that the JMP command observes an "absolute address" as the command argument, while a branch command will use a relative address for it's operand.  The relative address is often considered an offset from the opcode using it, which in this case will be very limited.  As the JMP command uses absolute addresses, the command is fully intended to jump anywhere in the processor's memory.  In this case, the JMP command can travel anywhere from $0000 to $FFFF.

In short, rather than checking to see if A has not been pressed (as we have done with all button presses), we check to see if it has been pressed pressed.  This allows use to use the branch command within it's limitations, while the branch is simply 2 lines away.  When the branch command finds that the button has not been pressed, it simply continues onto the next line, which utilizes the much winder address range of the JMP command.

That was a longer explanation than I intended.

VBlank


The concept of the V-Blank state is something that I really should have tried harder to understand when I started out on this project, as it would have made programming jumps much easier (or any vertical movement, for that matter).  

Originally, I had realized that when I programmed jumping into the game, it might have been happening so fast that it wasn't visible to the human eye.  That is why, in the code above, you see remnants of me trying to apply a "delay" subroutine.  I assumed that by applying a delay that decremented the value in an address from a very high number, I could slow down the jump to be more visible.  This is the closest I could get...


It turns out, the highest value I was able to apply to my delay subroutine to count down from was $00FF, for the exact same reasons that I needed to apply "A1Fix".  The branching instruction I was trying to apply simply couldn't handle a higher value.

Thankfully, the nesdev forum users once again came to my rescue.  In user 9258's post, he discovered that he could only create a functioning jump by applying a small subroutine that waits for the V-Blank state.  The V-Blank state is a period of time in which the PPU is in-between drawing sprites onto the TV screen.  As you might remember, television sets during this time would use a "gun" that travels left to right, from the bottom to the top of the screen.  Relying on the period in which the screen would be refreshing this cycle is the best method for creating vertical moving sprites in a smooth and effective manner.


While I ended up with a jump I'm happy with, the user response to the forum post goes into much finer details about how to build a basic jump.  Fine tuning the jump is on my to-do list, as well as fixing up a lot of the other flawed methods I applied to making this game functional.


Collision

Another fun one.

Figuring out collision took a lot of research and a lot of thought, and I'm still pretty sure I'm doing it wrong.  I eventually came across this article, which addresses the fundamentals of collisions among multiple sprites.  I am planning on revisiting it and actually trying to apply the mathematical logic behind it, as at the time of implementing collision, my head was pretty weighed down with the stress of finals.  Eventually, I settled for simply establishing collision between the front sides of each character, narrowing down the number of tiles and directions that would need to be accounted for.

I decided to take a similar approach to my jumping logic, where I control sprite movement based on sprite location.  In this case, the code would compare the positions of the sprites of player 1 to the sprites of player 2, and if there was overlap, all sprites would be pushed backwards.


;--------------------- Collision Checks -------------------

CFace2DFaceX:
LDA $0207
CMP $021B
BCS CFace2DFaceY
JMP NoCollision
CFace2DFaceY:
LDA $0204
CMP $0218
BEQ CFace2DBackX
JMP NoCollision
CFace2DBackX:
LDA $0207
CMP $021F
BCC Cloak_CollisionFront

Cloak_NoCollision:
DFace2CFaceX:
LDA $021B
CMP $0207
BCS DFace2CFaceY
JMP NoCollision
DFace2CFaceY:
LDA $0218
CMP $0204
BEQ DFace2CBackX
JMP NoCollision
DFace2CBackX:
LDA $021F
CMP $0207
BCC Dagger_CollisionFront
NoCollision:
  
  RTI             ; return from interrupt

As I tested this concept more and more, the above code was the first working result I could produce.  Unfortunately, i do not have any record as to why the overlap of sprites was required (again, collision is something that will be fine-tuned with jumping), but as you may be able to follow, these subroutines check to see that one set of sprites has overlapped the sprites of the other player, then only forces the sprites away from each other when reaching the "back" set of sprites of the other player.  If those conditions are met, another set of subroutines are called, which simply move the sprites in the intended direction:

Cloak_CollisionFront:
LDA $021B
CLC
SBC #$04
STA $0207
LDA $0223
CLC
SBC #$04
STA $020F
LDA $022B
CLC
SBC #$04
STA $0217
LDA $0207
CLC
SBC #$07
STA $0203
LDA $020F
CLC
SBC #$07
STA $020B
LDA $0217
CLC
SBC #$07
STA $0213

RTS

Overall, this was the result I settled on before moving on to the hardware implementation of the project:

collision_gif.gif

This blog post has kind of worn me out.  As I begin to tinker with Cloak n' Dagger again, I will probably go through this post (and previous ones) to add info or fix mistakes.  For now, I'm moving on to the next post, which will discuss the process of porting my prototype to a cartridge.

Cheers,
-JWest