Categories
Game Design Game Development Geek / Technical

Freshly Squeezed Progress Report – Dispensing More Toys At Once

Today is the 15th anniversary of GBGames, LLC being founded!

It would have been an awesome day to launch a new game, but alas, Toy Factory Fixer is not ready for release. However, I will be asking people on my mailing list if they want to sign up to try the game early.

Interested in being one of those people? Sign up for the GBGames Curiosities newsletter today!

In last week’s sprint report, I created an indicator to show details about the new production run of toys coming down the conveyor belt as well as created a shipping deadline to encourage the player to have some urgency when it comes to creating Good Toys earlier in the game.

Last week, I focused on making it possible for more than one toy to exist in a single conveyor belt location at once.

Sprint 14: create an economy

Completed:

  • Allow multiple toys to occupy same belt space
  • Defect: Fix Z-ordering so mouse goes over the HUD

Not completed:

  • Create way to choose if game has deadline or not
  • Allow player to start production run early

Stretch if above got done:

  • Create sound effects

Because early on I wasn’t sure how large the play area or tiles were going to be, I made toy positions based on tiles instead of the screen area. This worked great in terms of being able to render them anywhere since I could just multiply their position by the size of the tiles. That is, a toy located at position (3, 1) with tiles of 64×64 pixels square would be at (3 * 64, 1 * 64) or (192, 64).

The fun thing is that their positions were already floating point numbers, so I could make it look like they were a bit more randomly placed by adding a small offset that is less than one. I can find out which tile they were on by taking the floor of the number, so a toy at (3.25, 1) would still be on the tile at (3, 1), but it would get rendered at (3.25 * 64, 1 * 64) or (208, 64) instead of (192, 64).

Just jiggling the offset of toys being placed on the conveyor belt with -0.25, 0, or 0.25 in both the X and Y directions made for a pleasing visual:

Toy Factory Fixer - Jiggled toy offsets

Well, a relatively pleasing visual. I saw that some toys overlapped other toys visually when they shouldn’t. For instance, in the image above, you can see the small bear-headed doll looks like it is on top of the large doll-headed bear when really it should be drawn behind it.

I realized it was due to the toy sprites drawing centered from their top left instead of the bottom center. It required changing offsets for the toys being rendered, but it made it a lot easier for everything to Z-order correctly.

Toy Factory Fixer - Z-ordering toys correctly

But just drawing a toy slightly off didn’t change anything in terms of the game mechanics. Toys were still allocated 1:1 to a conveyor belt location. Well, it wasn’t strictly true, because it was possible for a worker to place a toy on a belt location that was already occupied, resulting in two toys in the exact same location. With the jiggled offsets, it looks less bad most of the time, but it still occasionally looked like one toy instead of two. Also, most of the game still operated under the assumption that only one toy could occupy a space at time.

For instance, the money you earned from shipping a good toy? You got that bonus based on whether or not there were more good toys shipped since the last check, which meant that shipping two or more toys still gave you the same money bonus as when you shipped one toy.

I wanted the game to recognize that multiple toys can be placed in the same tile, and that required creating the concept of “tracks” on the belt.

I created 9 tracks, and each track is associated with a rendering offset. Think of a 3×3 grid, with (0, 0) in the center, and everything else some combination of either 0.25, 0, or -0.25.

So when a toy gets dispensed, I find out which of the tracks is still open on a particular conveyor belt location, and I assign the toy to that track. This track system prevented the problem of toys being placed in the same exact location.

Instead of preventing workers from putting crafted Good Toys down on occupied belts, they checked if the belt had any unoccupied tracks to place the toys in.

And once everything worked well with one toy, I changed the dispenser so that it could dispense more than a single toy at once.

Here’s a close-up of a belt tile with five toys on it:

Toy Factory Fixer - Crowded Belt

I ended up not getting anything else accomplished this week other than fixing a defect in which the mouse cursor appears under the HUD, something that you wouldn’t see in the mobile app anyway.

So why did I spend all this time on getting multiple toys to occupy the same location?

A big part of the challenge of the game is in managing the flow of Bad Toys coming down the conveyor belt. A single worker can only work on a single toy at a time, so any other toys will continue moving down the line.

With only one toy per belt location, I only had so much room to manage that challenge. I could manage the conveyor belt layout, and allow the player to make strategic decisions about where to place a worker so that the worker can pick up multiple toys as they pass in either direction.

Now with up to 9 toys occupying the same location, other strategies will need to be deployed because one worker or two workers might not be enough to handle it all.

It sounds like a simple strategy: hire as many workers as you can. Done.

And I will need to balance the game play in terms of how the Good Toys earn you revenue and how much workers cost, but I came up with some ideas about how to handle the victory/loss conditions, too. If each worker hired also results in an end-of-shift payment owed, and if spending more money than you earn can result in a loss, it might provide the opposing pressure to avoid that simple strategy above. And if you keep your workers through multiple shifts/levels, then not only do you need to anticipate the end of the shift but also your long-term likelihood of surviving.

I need to figure out how to communicate it to the player so they know to anticipate it rather than get surprised by it, but I think it provides a much more elegant way to end the game instead of merely failing you if you shipped any Bad Toys.

Thanks for reading!

Want to learn when I release updates to Toytles: Leaf Raking or about future Freshly Squeezed games I am creating? Sign up for the GBGames Curiosities newsletter, and get the 24-page, full color PDF of the Toytles: Leaf Raking Player’s Guide for free!

One reply on “Freshly Squeezed Progress Report – Dispensing More Toys At Once”

Leave a Reply

Your email address will not be published. Required fields are marked *