June Dev Diary: New Jelly Stuff

Is it the last day of the month? It’s not? Oh… The last post ended up being a tad late. To make up for it I’ve prepared for, and posted my (somewhat) regular monthly dev log early (woo!). Welcome to my little corner of the internet. As always, I’ll discuss what I’ve been up to, what’s new & what’s next. Let’s begin…

Last Month

Last month was a mess, even the dev log ended up being a few days late! Because of this I didn’t really set any goals, aside from making sure this post is on time!

I spent a lot of the month getting my video out of the way, which is worth it, it’s surprisingly doing pretty well. But that didn’t leave much room for gamedev. This month that was my focus, so let’s get into the post and talk progress.

This Month

I’ll be honest this month was off to a bad start, the first week was spent catching up on everything I’d missed. I then spent a few days reading through the Jelly Toss code trying to understand how everything worked again. It wasn’t good, so I made my first job commenting out all the level spawning code and replacing it with something better.

I won’t go into too much detail about how the level works now, but here’s a snippet of the old code:

for (int i = 0; i < noofPlats; i++)
                 {
                     if (forceLong)
                     {
                         if (r == i)
                         {
                             spawnPos += new Vector3(PlatMaxDistance + .5f, 0, 0);
                             forceLong = false;
                         }
                         else
                         {
                             spawnPos += new Vector3(Random.Range(2.5f, PlatMaxDistance), 0, 0);
                         }
                     }
                     else
                     {
                         spawnPos += new Vector3(Random.Range(2.5f, PlatMaxDistance), 0, 0);
                     }

                     p = Instantiate(platform, spawnPos, Quaternion.identity, allPlats);
                     if (forceHeight)
                         {
                             int x = Random.Range(0, 100);
                             if (x < 50)
                             {
                                 p.GetComponent<platScript>().height = platMaxH;
                             }
                             else
                             {
                                 p.GetComponent<platScript>().height = platMinH;
                             }
                            forceHeight = false;
                         }
}

This may be a little difficult to understand out of context. Basically, the level spawning was split into two functions. The first decided the level type and I manually set if I wanted to force a long platform or a high or low platform. The second function spawned the platforms in order, following instructions from the first function. The code above is a small part of the second function. It’s very messy, inefficient and came with plenty of bugs. It needed changing.

The new setup generates a level code e.g. 0,0,1,3,0. From there the second function spawns what it needs to using those numbers. So 0 could be random, 1 could be a long platform, 3 a low and so on. It’s much easier to control, much easier to understand and I’m free to add as many new types as I want (if needed).

Now the level is setup I wanted more variation. The platforms were getting boring, sure, the spacing changes and the height changes but that’s not enough! I had an idea for ONE new platform, that’s all I wanted…

I ended up with 4. You know when you work on a feature then halfway through you get another great idea? Yeaaahhhhhh. Originally, all I wanted was a moving platform. But before I got into that I had an idea for an obstacle. The Showstopper:

Why only have one obstacle? I wanted something to stop the player from standing still for too long, this idea stared with a falling or breaking platform. That would require something to visually represent the countdown. So instead, I added The Windmill:

That works, but I want something to knock the player. The sweeper was my first idea, this was a red ball that would move across the tops of all the platforms. I did not snap a gif of this but here’s a quick illustration:

It was fun, but very unfair. Unless it was slowed down, then it became less of a challenge. It also had a few problems; platforms can be high or low and it will ram straight through the showstopper & the windmill. My best solution was to simplify the idea somewhat and make it follow the edge of the platform it spawns on. We have the Janitor:

Finally, we have the moving platform, a simple idea that I thought would be easy. It quickly turned into the hardest one to implement so far. Before we get into that let’s take a look at the platform in action:

Yes I died, It’s a difficult one to master! But it is very possible. Anyway, what could have possibly went wrong? To start with I had a simple problem, the platform moved, but the player wouldn’t move with it. I’d hoped it would be as simple as making the player a child of the platform. This caused many issues with the jelly, let’s not do that again.

I then tried coding the player to follow the platform manually. This came with a few bugs too. Funnily enough the solution was fairly simple. I was moving the platform using its physical position rather than forces, which is apparently a common problem. I’d never encountered this before, it took some googling! But I learned something new!

Once the platform was up and running, I had to work on spacing, speed and friction. This was a few days of playing around with the stats until I found what worked. The final problem, like the previously mentioned sweeper was it would clip with other items. Especially the showstopper. That works by spawning the blocker halfway between platform A & B. If A is a moving platform this would cause issues.

Simple fix, just detect that and push it closer to the edge of the second platform, so it looks more like this:

Changing all that forced me to work on/change the difficulty curve. I won’t give that away I can’t spoil all the fun, but the level generation is finished. Unless I add another platform type (I might), it’s time to finish the rest of the game! There’s not much more in terms of gameplay but there’s still plenty to work on. I best get to work!

Next Month

JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS, JELLY TOSS,

JELLY TOSS OR ELSE…

Until next time…

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s