A Change of Scenery

Most of the screenshots so far have taken place in the outside “Grasslands”.  This past week I have focused more on buildings (houses), NPCs and text boxes!

Houses

Hannah had supplied version one of the houses last week, so I wanted to begin working on a building structure.  One idea I wanted to try out with this game is having no loading zones.  None.  Zero.  When the player goes into a dungeon, it will have already been loaded.  When the player goes inside a building, it will also have already been loaded.  Essentially, the entire map will be one big “room”.

To do this, all buildings and structures will need to be able to be toggled seamlessly when the player enters or exits one of these buildings.  From an artistic standpoint, all buildings on the outside and inside need to be the same size.  That is what we worked on this past week, and it seems to be working great so far:

Houses
Houses
Inside Left House
Inside Left House

The first picture shows the outside of the houses.  When the player enters a house (in the above picture, the left house of the first picture), a black surface is drawn over top the parts the player should not be able to see since the walls would be blocking visibility.  This feature had already been built when going into and out of forts.  However, this week was refined to work better with concepts of being inside and outside.  For example, when we in a fort,  it is okay for rain to be visible, even though the game considers the player “inside”.  Inside an actual house, it would be weird for rain to visible, since there is a roof over top our heads. Now all building structures have a hasRoof property.  If a building “has a roof”, we should not let the rain be visible inside the house.

I experimented with the day and night effect as well when being inside a house.  Initially I wanted to turn that off the night effect when inside.  However, as I was working late one night, I realized that if it weren’t for my lights being on in my office, it would be pitch black.  The same now goes for our buildings in the game.  If it is dark outside, it will be dark inside.  That is why the house pictured above appears to be “on fire”.  It’s actually a torch object that gives off light.  At night, it makes the house have light.

Mice

Originally, the houses were kind of sad and empty.  I decide to make them more sad by adding mice to them:

House of Mice
House of Mice

Since I have a Simple Animal object, I was able to create a Mouse object very quickly.  Mice’s movement are very quick and chaotic.  When a mouse spots you, unlike other enemies, they will turn the opposite direction and run.  If they get cornered, they will do their best to avoid taking damage.  But they are just mice after all — they are not the smartest creatures.

Throwing Objects

One feature that was made very quickly a while back was the ability to pick up objects and throw them.  This was originally because I wanted to make an enemy type that hid under these objects (and still do).  However, there was no collision when the object was thrown and it was limited on two specific objects.

Now, all objects that can be thrown are a child of Interactable.  If an object has a pickable property on it, it is allowed to be “picked up”.  Enemies, mice, stones, bushes, anything really, can now be picked up and thrown.  There is currently a weight variable attached to anything that can be picked up.  The heavier the object is, the slower the player is to move with the object.  Also, weight contributes to how far the player will throw an object.  Heavy objects will not be thrown very far, will lighter objects can be tossed quite a distance.

Carrying a Bush
Carrying a Bush

It may appear that these objects are just on the ground, but that is because we currently do not have proper animation for picking up or throwing.  I promise it’s not a Photoshop trick. 😉

Carrying a Mouse
Carrying a Mouse

When throwing objects, they will have an arc to them, as if “gravity” was pulling them downwards.  If the player is not targeting anything, an object will be thrown in the relative direction the player is facing.  If the player is targeting, an object will be thrown in the relative direction of the target.

Objects can now collide with walls and other enemies, taking damage to both.  The more weight an object being thrown has, the more damage that will be dealt to both the thrown and the collided.  When colliding with solid objects, the object will also “bounce”.  To bounce an object, we can simply “mirror” the object’s current direction it’s traveling, represented by:

var direction = 2 * n – v – 180;

Where n is the angle of surface and v is the current direction the object is traveling in.  I was stumped for a good hour or so at first because I assumed that n was always 90 (straight line).  However, if the object is traveling between 315° and 45°, the surface angle is actually 0 (assuming the wall is a straight line, which we are treating all collisions as straight lines at this point).  If the object is traveling between 45° and 135°, the surface angle is 90.  etc.  For our case, n represents either 0, 90, 180, or 270, depending on the cardinal direction the object is moving.  Once I figured that out, we had objects bouncing around beautifully.

Freezing Enemies

Since we now have the ability to pick up things, the player should have the ability to pick up enemies if they are frozen.  After breathing “ice” (that’s supposed to sound like “life”) into the ice rod, the projectiles that come out of the rod is now able to be collided with.  If an object that can be frozen collides with this projectile, it will take damage and freeze.  When frozen, an object cannot move or do anything.  There currently is no way to be unfrozen, but that shouldn’t be too hard of a feature to build.  However, when frozen, an enemy can now be picked up, which allows us to carry enemies around, and throw enemies at enemies.

Carrying a Frozen Zombie
Carrying a Frozen Zombie

It’s a lot of fun to carry enemies around and toss them into other enemies!  These enemies are pretty heavy, so movement is pretty slow as expected.  At some point there will probably be a cap on how much weight a player is allowed to pick up.  Perhaps an item will allow the player to pick up heavier objects???

NPCs

The bulk of the work this week has been around NPCs.  The first thing that was implemented was movement.  Moving a simple NPC was relatively easy since we were able to inherit the behavior of similar objects.  However, this worked good for an NPC with no objective, appearing “mindless”.  My next task was to build movement for an NPC that could follow a path.  I thought this wouldn’t be too hard since the Soldier type enemy already computes, and then follows a path to get to their target.  However, I ran into a few hurdles.

For one, Soldier enemy’s paths are from point a to b.  Our NPC paths could be that, or they could be circular.  A Soldier‘s path also doesn’t have points that repeat, or come near each other.  Our NPC paths could do that.

NPCs
NPCs

Though we are using Game Maker Studio’s (GMS) path creator, I am not using their path manager.  This is because I personally think it’s terrible.  This is mainly because it updates an object’s x and y positions, as expected.  However, it does not update variables like speed.  This is rough because we are currently preventing collision into objects (such as walls) by checking if an object’s horizontal and vertical speed components added with an object’s x and y position respectively is inside an object.  If GMS simply sets positions, but not speed, objects will not check collisions correctly.  This will put unintended objects on top of walls, for example.

The hurdle then was that Soldier and other enemies that use “Dan’s Path Manager” currently keep track of where it is at on a path with this script:

/// @description path_get_rough_position(path) returns a position/point identity based on current x/y location
/// @param path

var path = argument0;

var smallest = 1000000;
var index = -1;

var length = path_get_number(path);

for (var i=0; i<length; i++)
{
  var ptX = path_get_point_x(path, i);
  var ptY = path_get_point_y(path, i);

  var dist = point_distance(x, y, ptX, ptY);

  if (dist < smallest)
  {
    smallest = dist;
    index = i;
  }
}

return index;

The script is actually named path_get_rough_position and was never meant to do much other than return a rough index of where we were at on a path.  It essentially compares an object’s x and y position with each point on the path.  The script decides that whatever point an object’s x and y position is closer to, that is where “it is at” on the path.  If you remember from earlier, an NPC path could cross with itself, or have points that come close to one another.  Because of this, an NPC determining where it was at on a path failing because point 2 could be the same or close to point 98.

The solution was actually pretty simple.  Sometimes figuring out what the problem is when it comes to programming is half the battle. 🙂  The solution was to manage the NPC’s path index manually (not to be confused with GMS built in path_index variable).  Since a Soilder‘s path is usually on average 4 points (thus not being very expensive), is rapidly changing, and from point a to b, it doesn’t make sense to manage the path index.  For an NPC though, a path could be hundreds of points, rarely changes, and may not be from point a to b.  Because of all of this, it made sense to manage that ourselves.

Managing a path index meant we could do paths like the red line in the screenshot below:

Long Path
Long Path

Currently the path is very square, but that is because we were simply testing.  We can easily do much nicer, “natural” paths.

The NPCs that can follow paths do so on two different timers:

  1. Independent
  2. Global

An independent timer simply means the NPC will move along the path at its own speed.  A global timer means the NPC will move along the path at the rate at which the global time of day timer moves.  For example, in the above screenshot, the starting point is where the NPC is at near the upper right of the white rectangle.  A NPC should complete “one lap” around this entire path in the time it takes for a day/night cycle of the game (approximately six minutes).  If for some reason a rock gets in the way because we were throwing it at the NPC, or we were talking to the NPC, or just standing in its way, the NPC will start moving faster on the path to catch up to where it should be on the path.  And vice-versa — if the NPC is moving too fast, it will slow down.

Text Boxes

Even though it’s fun to stand in the way of NPCs, or even throw mice and rocks at them, most games have the ability to talk to NPCs.  I began work on this feature last night and into late afternoon, with great success.  Most games “freeze” game play when talking to NPCs.  This is so we don’t get hit by enemies, or miss an event that was supposed to happen.  However, I noticed in Breath of the Wild, the environment will continue to “live” — the wind is still blowing, rain is still falling, clouds are still moving, etc. (interestingly, objects like Link and the NPC currently being interacted don’t freeze).  I ended up mimicking this idea of the environment staying alive for the most part, with a couple tweaks we will work on later.

Currently text boxes support these features:

  1. Text is pulled in from a language file — so that text is not hard coded and can be adapted for translations.
  2. Text boxes can have multiple pages (think paragraphs you continue on with by pressing a button)
  3. There is currently a typewriter effect.  Don’t worry speed runners…
  4. Holding the talk button will make the text go faster.
  5. Pressing the cancel button will make the letters stop typing and immediately show up.
  6. Pressing the talk button once all the letters are on a “page” will begin the next page with the typing effect.
  7. Pressing the cancel button once all the letters are on a “page” will begin the next page with the text immediately there.
  8. Finally, text boxes support a title (like the NPC’s name) and a portrait.

Here is a current screenshot of the concept:

NPC Text Box
NPC Text Box

Conclusion

Somehow I managed to make this post as long, if not longer than the last one.  I am thinking that the next few days are going to be refactor days.  We’ve added a lot of new features, but not a lot of clean up has been done, and my brain is starting to twirl.  Plus, some thorough testing ought to be done.  Either way, I will of course keep you updated!

Ice Ice Baby

This title poorly summarizes what I have been working on over the last week.  However, the last day or so I have been working on the Ice Rod and ice physics.  So naturally this title came to mind. 😀

This is one of those instances where it has been great to look back at the past week.  I was feeling a little discouraged, as if I had not done much.  After looking at a diff between last weeks commit and my latest commit, I realized I had actually done quite a bit.  It was a great starting point at looking at what I wanted to write up for this post.

Comparing Commits
Comparing Commits

Retro Palette Swapper Fix

As I mentioned in a previous post, we will be/are using a palette swapper for sprites.  Here’s a quick example of what this means:

 

The Red Minotaur is currently the original sprite.  With the palette swapper, we can simply tell a shader to change the red colors to blue.  This makes it nice because we don’t have to recreate a ton of extra sprites for different colors.  This saves on file size and time!

However, I ran into a bit of an issue.

For some reason, our friend (or enemy rather) was multi-colored.  I spent a little bit debugging, but then ended up reaching out to the owner of the shader/plugin we are using.  The support from the owner was amazing.  After a few emails back and forth, it ended up being a graphic setting that needed to be toggled in Game Maker (Interpolate Colors Between Pixels).  I’ll spare the details of what exactly this does (because it can get really technical), but it basically smooths out the graphics, which we don’t want for pixel art.  With this turned on, the shader wasn’t sure if we were talking about red, or a “smoothed” red, and thus, it was not working properly.  Turning off the setting fixed the issue and made our pixels look more “pixely” (which is good in our case).

Flying Objects and Shooting Off Cliffs Update

In a previous post, I mentioned that we now have the ability to shoot arrows off of cliffs.  I ran into a bug with my quick solution to the problem originally.  I ended up resolving with these four things:

  1. Every flying object has a depthHeight which represents how “high” the object is.
  2. Every wall that a flying object that can pass through has an angle at which that object is allowed to pass through.  Every wall also has the option to disable collision altogether, if an object’s depthHeight is greater than 0.
  3. If the flying object is passing through a wall between an angle of -90 and +90 of said angle, we increase our depthHeight, and store that wall so we don’t recalculate it.  If the flying object is passing through a wall of the opposite angle as stated previously, we decrease our depthHeight and store that wall so we don’t recalculate it.
  4. When a flying object collides with a wall, if our depthHeight is 0, the object stops moving.

That was sort of technical, but this approach solved the bug.  And now, we can shoot arrows, ice, fire, or any other projectile off of cliffs.  It also let’s us shoot over a lake correctly, like below:

Shoot Across the Lake
Shoot Across the Lake

Updated Enemies and AI

We currently added a few more sprites with the Soldier type enemy as mentioned in a previous blog post.  I called them Horned Knight (evil knight with a horned helmet), Reptile and Zombies.  Zombies have to be the most fun:

The Zombie Apocalypse

When adding the reptile, I wanted the enemy to behave similarly to the Lizafos in The Legend of Zelda: Breath of the Wild, where the enemy can evade your attacks.  So, now all soldier enemies have the ability to dodge (if we want to give them that privilege)!  It currently works by the following rules:

  1. A property called maxAttempts is set on a Soldier.
  2. Every time the Soldier‘s target’s weapon is swung, increment a swingCount property.
  3. When a timer goes off and the enemy is near the target, randomly, between swingCount and maxAttempts choose to go backwards.

This approach works well when spamming the attack button, the enemy will have more of a chance to dodge your attack.  I am not a big fan of the RNG at the moment.  This is mainly because the Soldier enemy thus far is very logic driven.  This is one of the few things left to chance.  Perhaps I’ll come back to updating this when I can think of a better solution.

Climate

I haven’t talked much about the actual game world much.  Most screenshots shown thus far are in a demo playground.  The world is pretty large though.

Zoooomed Out Map
Zoooomed Out Map

If you look really closely in the center, there is a small white rectangle.  This represents your viewport, or screen.  There is not much in this world yet.  Even if there was, the detail would be hard to see since we are zoomed out so far away.

What is pictured though is some obvious colored regions.  These currently represent climate regions.  In the east is the desert, where it is hot during the day and cold during the night.  It will rarely precipitate.  In the north is the mountain region, where it is brutally cold and storms (blizzards).  The lower region of the mountains is cold, but not nearly as many storms.  In the south is a beach, where it is hot!  Finally, the west region has a swamp in the north west, where it is rainy and mild.  The forest is due west, with a mid-west like fall climate. Finally, the southwest, is a jungle, where it is hot and rainy.

I mentioned the big regions, but the climate is actually controlled in two subsections smaller, actually called sections.  Though these sections generally follow the above climate patterns, there are a few variations to these.  For example, we are envisioning a town in the northern-east most area.  This area currently will be cold, but without storms.

I ended up spending a day on this — coming up with the proper percentages (how often it can rain, being cloudy, etc.) and temperature ranges for each area and casually testing these out to make sure they were working properly.  These are of course subject to change as the game progresses. 😉

Water (Again)

I decided to play around with water again.  This is mainly because I knew I was going to be working on swimming this week.  My findings were interesting, as I continued to play with blending modes and masks.  I thought it would be important to create large bodies of water in the future.  Thus, I decided that water should be created with shapes, and then a texture would be drawn within that area.  There was a lot of learning here for me since I am not a GPU drawing wizard.  I did manage to learn how to draw sprites/textures onto a masked shape.

With this learning though, the end result will be to scrap this approach. For one, each frame to draw the water, its shape, its ripple effect, its underwater objects, its reflections, etc. is pretty expensive.  Even though I could spend hours optimizing and making better, was it really worth it?  There have been two rules I have been following when creating something new:

  1. Is it believable?
  2. Is it fun?

Water is one of those things that is hard to make believable, because of its complexity.  Though the effects were “fun”, Hannah and I didn’t find them to be believable.  I had Hannah sketch up more of a Link to the Past style, which hopefully we can be implementing soon.

Water Sketch

In the end, learning how to draw a sprite/texture onto a mask was a key learning and take away.  I am currently masking sprites/textures roughly in a few places (for example, the mini-map in the lower right hand side of the screen). But with this new learning, this functionality can be cleaned up and reused throughout the game.

Swimming

If there is water, then there must be swimming.  Swimming is an interesting mechanic because to make it believable, most games will reduce the speed of movement, as well as eliminate attacks altogether.  Personally, I dislike parts of games that make me swim, because I don’t like having my movement constrained.

Swimming

The current implementation we went for is to be believable, and all movement is a third of what the hero can do on land.  However, we do allow the player to attack — but again, at a third of the movement.  This allows for some interesting combat in the water.  My end goal though is to think of a clever way to make a believable water scenario where movement feels slick.  Worst case scenario, we will design the game around spending less time in water, for those like me who dislike the slow movement.

If we can jump into water from a cliff, we need the ability to get out of water with some kind of “dock” mechanic.  In the screenshot above, we have added docks to the lake.  When colliding with the dock on the edge, it makes the player “jump” out of the water.  It’s currently the same mechanic and animation used to jump off of cliffs.  In a future polish update, we can change that around to look more like the character is getting out of the water.

Finally, ICE

Ice currently has some interesting behavior.  My goal with fire, ice, and water is to develop a Rock-paper-scissors concept, where fire beats ice, ice beats water, and water beats fire.  Currently fire is used with the Fire Rod, torches, and enemy’s that breathe fire.  Water is currently developed where there are natural bodies of water and rain.

Where ice is “nice” is when it interacts with water, because ice beats water.  Whenever the Ice Rod is shot near water, it creates Ice Blocks which the player can walk on.

Ice Rod Shot Over Water
Ice Rod Shot Over Water

Since it is ice we are walking on, there of course is ice physics that makes the player feel like they are on ice.  Originally we had this less slippery, but most of the feedback I received so far was to make it more slippery.  We’ll continue to tweak the values so that it feels believable, but not annoying.  We aren’t creating an ice simulator, after all.

Since fire (heat) beats ice, ice currently melts during game play.  I have an interesting formula I would like to share.  I call it Ice Melting Rate:

var rate = ((logn(62, temp + 30) - 1) / 200)

The inputs are a temperature. Temperatures are based in Fahrenheit. Currently the lowest temp in the game world is -22°F. We add 30 to the temperature always because the logarithmic function cannot accept zero or negative values.  We then use a base 62 logarithmic function.  Let’s say our temperature is 32, which is freezing.  When we add 30 to that number, we get 62.  I wanted freezing point to always return 1.  Thus, log base 62 of 62 would yield 1.  Numbers that are less than one will actually freeze the ice tile faster, while numbers above 1 will melt the ice, but not at the same rate as freezing.  We subtract 1 from the output of the logarithmic function because in the game, rate being a negative number will increase the melting timer (we subtract from rate and if rate is a negative number, we’re really adding).  Finally, the constant 200 seemed to be a good number that gave us good rate at which every frame of the game the ice melts.

In practical terms, when ice is around 40°F, it will take 56 seconds for the ice to melt, where as ice around 70°F will take 14 seconds to melt.  In game terms, if the player is standing on ice above water, and the temperature is warm, the player better hurry to create more ice, or they will fall through into the water!

Conclusion

After writing this, I realize that there was definitely a lot accomplished!  I think moving forward, it will probably be best to write blog posts every couple days with the feature that was being worked on, instead of a week’s worth of features.

All that to say, a lot of progress has been made this past week, and I cannot wait to share the next set of features!

 

There’s No “I” in Team

Over the past few weeks I’ve been trying to figure out how I can accomplish making a game on my own.  There is a lot that goes into creating a game.  When you consider art, programming, music, and all the other details, it can become overwhelming.  I decided it was in the best interest of the game to begin looking for individuals who could help contribute on this unique journey with me.  Today was an especially exciting day as it was the first time “the team” could all get together and meet each other, share ideas, play some games (Super Smash Brothers Ultimate anyone?) and simply have fun.

It was amazing to see and hear all the new ideas.  We first were able to share feedback of the creation, the Centaur.  The team concluded that though some animation was needed for the anticipation frames, it was challenging and fun to play.  We also talked updated story ideas, and let me tell you — the updated story plot completely “floored” me — this is going to be good stuff!  Next we listened to a few music samples for the game.  Though I am a hard rock guy myself, I was digging the “Accordion Song” with a Cave Story, Mimiga Town vibe to it.  We finally checked out some amazing concept art from old and new ideas alike.

One of the plans for the day was to play through The Legend of Zelda:  A Link to the Past.  To my surprise, no one on the team had ever played this amazing game (seriously though, if you haven’t played, do yourself a favor and play it!).  After booting up my Wii U, I realized I no longer owned a Classic Controller for the Wii Virtual Console because I owned GameCube controllers, which worked on the Wii, but not on the Wii U.  So, I ran over to my parents to pick up the legend. 🙂

I personally haven’t played through the game in a while, and it was great to hear criticism of a game from first time players that sometimes I can be blinded by nostalgia.  My most interesting discussion take away was how a games’ difficulty wasn’t necessarily due to well programmed AI, but rather dropping in a ton of enemies who’s objective was to simply move in your direction.  It is easy in 2019 to be critical of this attack pattern when games that ran on the SNES and similar hardware during that time couldn’t be computing real time paths for hundreds of enemies — so they made due with simple and fast.  Looking back though, this can be frustrating for a player to feel “ambushed” — especially when the method of an enemy’s attack is simply to run into you.

Anyway, I digress.  The original reason for this post is to introduce and praise on my team.  So without further ado:

Hannah Boellner – Artist

Hannah’s been actually helping with art back in May or June of last year.  A couple friends of mine had mentioned how talented of an artist she is.  After “Facebook Stalking” a few of Hannah’s artwork, I decided to ask her if she would be interested in the project.  Though she hadn’t done pixel art before, she was willing to try.  She first started with some concept art of the Violet.  After I was completely impressed with her skill, we decided to try doing a tree in pixel art.  After a few rounds, we nailed down the style and since has continued to impress me day after day with amazing and awesome art.  The thing that impresses me most about Hannah is how she is willing to give anything a try, with 110% effort.  I want to conclude by admittedly waiting WAY too long to publicly give her credit, where credit is rightfully due.  Without Hannah, we would not be as far along as we are today.

Tyler Shipley – Composer

In my early twenties, I started really getting into composing with FL Studio with some pretty solid tracks.  However, compared to the musical genius mind of Tyler, it pales in comparison.  I’ve actually got to know Tyler pretty well in the last couple months.  We both have a love for really good video game music and love listening to it on a regular basis.  Of course, I am listening to metal remixes while Tyler is listening to more relax, ambient soundtracks.  But this contrast is great as we both share thoughts and ideas to make each other better (though, frankly, I just inputting notes into FL Studio while Tyler is flawlessly composing and playing on his digital keyboard).  I feel like we’re scratching the surface of what Tyler is capable of.  So, watch out world — we have an upcoming David Wise on the horizon!

And So It Begins

In my first post, I mentioned that I would be taking a leave of absence from Root.  Well, this past week was the official start of that journey.  I’ve been getting into the routine and have made some good progress.  This past week has been about adding a few more enemy types.

The main current enemy type so far has been a Soldier type enemy.  This enemy type, without getting too nerdy, uses logic to find the best path to the target (in most cases, the hero).  It uses the A* algorithm to compute a path, and some “magic” to not feel so stiff.  This enemy has been great, and can even wield single-handed sword and/or shield combo, single-handed spear, two-handed big weapon, and a bow and arrow.

I wanted to add some more unique enemies that are a ton of fun, but much less “smart”, thus being quicker to develop and less CPU intensive because it is not trying to “compute a path” in real time.

The first I named Reveel:

Reveel
Reveel (graphic credit to Nintendo)

I wanted an enemy type that could “reveal” — appearing and disappearing, much how the Leever works in the original Legend of Zelda game.  Now that the codebase is there, and I can essentially replace this graphic with my own art.  We can add other types of Reveel objects too by creating a child object of the Reveel object.

Next is a Centipede type enemy:

Centipede

If you have ever played any of the Snake games, the movement of this enemy is very similar to that.  The idea here is every time we deal enough damage to the Centipede, it will lose a piece, until there is nothing left.  This guy isn’t fully built, but enough of him is there to take a screenshot. 😀

Next is the Minotaur:

Minotaur
Minotaur (graphic credit https://opengameart.org/content/minotaur-2)

This guy has quite the story.  As I mentioned, I wanted some less “smart” enemies.  Originally, the Minotaur was that.  But as I began playing against him, he was just too stupid for the attacks I gave him.  I originally gave him a dash attack and a projectile (fire ball) attack.  Though the attacks worked well, his movement and lack of being smart was weird.  I moved on because I wanted to make the ultimate baddie…

Meet the Centaur:

Centaur
Centaur (graphic credit https://opengameart.org/content/centaur-0)

Anyone who’s played the Legend of Zelda: Breath of the Wild knows that the Lynel is one of the meaner enemies in the game.  However, Nintendo didn’t just make the Lynel tough to be cruel.  They created the Lynel to feel a sense of accomplishment when beating it, as well as getting a ton of loot from what they drop when defeated.  I wanted to create an enemy type that was just as tough and rewarding.

I thought about creating a brand new enemy type. However, after thinking for a while, I decided to merge the above Minotaur enemy with the Soldier enemy.  I took what was good with the Minotaur, the attack patterns, and added the path finding ability of the Solider, and got and even more robust Soldier enemy.  Soldiers can now wield weaponry that was already mentioned and also can perform dash and projectiles attacks as well.  The best part is if I wanted to update the current Solider enemies with these new attacks, it is as simple as adding graphics for them.

It’s pretty cool to see something like the original roughly developed Minotaur become an awesome dynamic enemy by taking a few concepts and merging them together!

Fire, Water, and Chickens

I wanted to post a few screenshots of some smaller items I have been working on the last month.  First, fire:

Fire
Fire

Currently the only way to create fire is using a “fire rod”.  Fire cast from a fire rod has a uncontained property, meaning that it can burn things that are burnable, such as brush, trees and stumps.  Fire can spread and catch other burnable objects on fire too!  If set in the right spot, it could cause a forest fire effect.  Fire that is contained (such as in torches) cannot spread.  However, an idea to be built upon is taking an arrow, lighting the tip with fire, and now the arrow has fire that is contained to the arrow, but shot at a burnable object could catch it on fire as well.  Finally, when it rains, fire will be put out.

Next, water:

Water
Water (https://marketplace.yoyogames.com/assets/6081/realistic-water-reflection) 

I spent WAY too much time goofing around with shaders, blend modes and other nonsense. Unfortunately, this is all I have to show for it.  But at least I learned a little bit — I think. 🙂 Water currently has a ripple around the edges, and reflection with objects that are underneath and above.  I currently want to optimize this, because the current approach is pretty expensive.  I also want to put a “shallow end effect” near the edges of the water, basically coloring the graphic with a lighter shade of blue.

Oh!  This screenshot reminded me, we can also shoot arrows off cliffs.  For example, shooting the arrow would go across the pond here.  Before, it would collide immediately into the edge of the cliff, because it is considered a wall object.

Finally, Chickens:

Chicken
Chicken (graphic credit https://opengameart.org/content/lpc-chicken-rework)

Honestly, this little guy is just a placeholder for an enemy I’ve been working on.  But it did get me thinking — I need to add animals that roam around eventually.  I started creating an Animal object that all Animal’s will inherit from (I just realized I have gone full circle in my programming career now).

Also in this screenshot, you’ll notice the tree is colored differently.  We are now able to do a color palette swap.  This will keep the file size down by not having to recreate a ton of art with different colors, and of course, save time 🙂

That’s all for now.  Thanks for reading!

The Port is Over — Game Maker 1.4 to 2.0

I was leery to make my second post be a more technical one.  However, it’s been a little over a month since my first post, and I wanted to give an update on what I have been doing.

In my about page, I mentioned that I started building the game in Game Maker Studio (GMS) 1.4.  I did this because of how similar GMS 1.4’s interface was to what I used to use when I was a kid.  When I was first coming up with the initial ideas of the game, I wanted to quickly get my ideas in code, much like how writers gets their thoughts down on paper.  The last thing I wanted to do was learn a new interface while building out game ideas.  Thus, I started making the game originally in GMS 1.4.

I decided about a month ago that it would be a good time to start porting.  For one, my leave of absence is coming up soon.  I figured it would be a good time to start using GMS 2 and learning the new interface.  Secondly, GMS 2’s device support is much better than GMS 1.4.  Being very ambitious, GMS 2 supports the Nintendo Switch — and I would love for Mario to play my game someday.  Finally, there were a few new core features that GMS 2 has that I was really needing.

GMS 2 completely redid the way they handled tiles, and for the better.  Violet the Game is using a tile grid, much like many games in this genre.  Tiles are exactly what they sound like, squares in a game that represent some graphic.  The tile engine in GMS 2 is much faster now, supporting tile maps too.  This is really useful for the game as I can start using tiles for backgrounds, and not take a performance hit, which was happening in GMS 1.4.

Along the lines of tiles, I had created a concept called decor tiles.  Decor tiles are pretty similar to standard tiles, except these tiles can be scaled and animated, unlike traditional tiles that are on a standard grid.  When coming up with the idea of the decor tiles out with GMS 1.4, they were taking a performance hit due to how GMS 1.4 handled tiles.  However, GMS 2 solves this by having what is known as assets, which are graphics with no other interactions.

With the open world, we needed a way to turn these assets on and off.  Computers are pretty fast now compared to what they used to be.  But, loading an entire open world of these assets would surely cause any game to crawl to a screeching halt. The way we solved loading all the assets at once is to break up the entire open world into zones.  We defined a zone as a 960 x 960 pixel grid.  These grids are loaded into the game based on the camera’s position.  We will always load the zone the camera is in, plus a few surrounding zones.  To do this, a zone name can be defined as assets_i_j, where i is the camera’s left position over 960, rounded down, and j is the camera’s top position over 960, rounded down.  For example, if our camera’s position is in location (2000, 1000), i would be 2 and j would be 1.  Thus, we can toggle an asset group called assets_2_1 and turn that layer on.

The final big feature that GMS 2 added was a new concept called layers.  I have mixed feelings about this new function.  On one hand, it solved my problem of these assets as when we say “asset group”, we mean a layer.  It also solves the problem with tiles as that we can have multiple tiles on multiple layers.  I think my biggest issue is how layers work with objects and the rendering order.

To give an illusion of a 3D perspective in a 2D game, objects need to have some kind of depth to them. In GMS 1.4, every object has a depth variable.  Objects drawn at a smaller depth will be drawn closer to the camera versus objects with a higher depth.  An easy way to give this illusion in Game Maker was to set an object’s depth to -y.  Using an inverted y axis (like most game engines do), the farther down an object is in a room, the larger its y variable will be.  If we want that illusion of fake 3D in a 2D game, we can take an object’s y position, which is larger the farther the object is from the origin, and negate the y value, thus, being closer to the camera.

Though we can use a depth variable in GMS 2, the engine prefers to use layers instead.  GMS 2 will not let us mix depths and layers.  In fact, if we assign an object a depth, GMS 2 will automatically create a layer and manage it for us, giving one no access to this said layer.  Depth according to the GMS 2’s manual is slower than using layers.  However, I did not notice a slow down using depths, unless being called every frame by every object.  So, we solved this by only changing the depth variable when an object needed its depth to be changed.

Why is this depth and layer thing a big deal you may ask?

In order to do the 3D illusion with layers, we have to take every object in the layer, and make a list ourselves, sorting by the y value descending.  Then, once sorted, we can draw each object.  I had a couple problems with this approach:

  1. Making a list and sorting every frame was CPU intensive.  Sure, I could figure out ways to make a list pre-sorted, but…
  2. I had to turn off the default drawing functionality of Game Maker to do this.  To turn off Game Maker’s draw event for an object, we can set a visible flag to false.  To me, setting a core built in variable like this seemed weird and counter productive to the readability of the code later on.
  3. By doing this approach, we completely bypass the framework in which Game Maker works for rendering objects, almost side stepping an optimization.

For me, the depth = -y approached seemed like a much better way of handling drawing.  I just wish there was a native way to group objects using the depth = -y approach with layers at the same time.

Those are the main core features that GMS 2 introduced in their latest version of Game Maker that I found useful.  If you stayed with me through this post, then you’re a trooper!  Thanks for reading.

 

Hello World!

As a developer, I thought this placeholder title injected by WordPress was very fitting.  I am deciding to keep it 🙂

So yes, I am a developer.  I have been coding since the 8th grade.  I started out with a little tool called Game Maker.  I’ve always been fascinated with videogames and Game Maker was a great way to learn the fundamentals of programming.

During college, I worked for a small company that made games for freearcade.com.  My most notable game was Wicky Woo in Lavaland.  It was actually an expansion of one of the first games I made in Game Maker.  In another post, I should do an analysis of this game.  But I digress.

After college, I began work for a company called Pixo.  At the time they were creating mobile games with Unity.  Unity was quite a fun program to play around with.  However, I was mostly doing web development for Pixo.  Web development was alright, but I could do that type of work much closer to where I grew up, which is where I wanted to be.  I moved away from my friends and family to take that job, because I wanted to pursue doing my dream, which was making games.

Shortly after Pixo, I found a company called Root, which is where I am currently employed doing web development. After a few years of working for Root, I realized that though web development wasn’t the dream thing, that Root’s awesome culture and flexibility was a dream in-and-of-itself.

After working for Root for a few years, I went through a difficult time in my life.  Luckily, The Legend of Zelda: Breath of the Wild had recently come out, so I played the game to near completion (everything but the 900 Korok seeds) to pass the time.  It was quite an amazing game to play through.  I thought to myself, “wouldn’t it be cool to make a game like that?”

One day on the internet, I discovered that Nintendo had built a 2D prototype of Breath of the Wild to concept out new ideas for the Zelda game quickly.  I thought to myself “this would be cool to re-imagine.”  And reading through the comments on similar postings, I was not the only one.

I started tinkering around again in Game Maker with my “Zelda” prototype.  I am a big believer in Miyamoto’s philosophy of building the game around the fundamental mechanic.  Thus, I began working on the combat mechanics for this prototype.  After several iterations with people trying it out, I landed on something that other people seemed to enjoy.  And the best part is that it isn’t even a “game” yet.

So, here we are, October 15, 2018.  What’s the plan?

As I mentioned, I work for an awesome company called Root.  We’ve worked out an arrangement where I will be taking of leave of absence from January 1st through March 31st of 2019. During this time, I am going to be working on this project as a way to heal from my divorce.  Even though it has been over a year since those events happened, I am still wanting to use this project as a way to relieve stress and heal.

I’ve decided to start a blog about the experience for two reasons:

  1. As a way for me to track in words (rather than code) the progress of the game.
  2. As a way for me to share with my friends and others the progress of the game.

I should have started this process sooner — but as they say, “better late than never”. 😀  I am excited to share my continued progress with you!  Thanks for reading.