1. PogoChamp
  2. News

PogoChamp News

Weekly Progress Report #77

I'm hard at work on the final level stuff! It's coming along pretty nicely, so expect to see it pretty soon! I also made some important bug fixes this week which I released early.

"Dud Jumps" Bugs

This week I was finally able to root cause an issue that I've noticed intermittently for a long time: occasionally when you're playing, you'll be jumping normally, and all of a sudden you'll land, charge up a jump, and lose all of your momentum. In order to fully explain this issue, lets go into some detail about how the momentum system works, and how some specific unity quirks were causing these problems.

[h2]Pogo Momentum[/h2]
Intuition would say that if you need the character's velocity when you hit something, then just check the velocity when you hit it. Unfortunately if you try that with Unity, you'll realize things don't work that way. On a given physics step of the game, Unity updates the positions and velocities of all objects that are controlled by the physics system. At the end of the physics step, Unity triggers the collision detection methods (OnCollisionEnter, OnCollisionStay, OnCollisionExit), based on the positions & speeds after the calculations have been completed. What this means is that if you have an object going 10m/s that hits a wall, by the time you are told by Unity that it hit a wall, it's speed would already be set to what it is after it bounced off the wall.

To compensate for that fact, PogoChamp uses a rolling window of recent speeds. Typically you'd only need the previous frame's speed, but due to the unpredictability of some of the collision behavior, I use a window of around 15 updates (0.3 seconds). When your character lands on a surface, the jump force is the maximum velocity within that time window, with scaling factors based on angle of impact, whether you're on a wall, and various other factors. In order to properly do the scaling, I store information about the collision at the time of impact.

[h2]Previous Collision Inconsistency[/h2]
During my investigation I noticed that very occasionally, the collision object I was storing would change its internal values to reference completely different objects. This was something I'd never noticed before, but I guess Unity reuses the allocated Collision objects, and doesn't guarantee anything about collisions beyond the frame that they were first created. This could occasionally result in a bounce where by the time your character was ready to jump, the collision it was using for momentum scaling had changed to a different collision, and you'd end up with a default strength jump no matter how fast you were moving before. To fix this, instead of storing the reference to the previous Collision, I now store a struct with the values I care about (mostly the collision normal).

[h2]Update vs FixedUpdate[/h2]
The other "dud jump" bug was related to the way I calculate whether you are jumping manually or due to a bounce. There's special logic to "fake" a bounce with some default values so that I can reuse the same logic for manual and automatic bounces. Unfortunately I was a little inconsistent with how I was using the Update and FixedUpdate methods, and my naiive understanding of resolution order when it came to Collision detection bit my pretty badly. I assumed that OnCollisionEnter triggered before FixedUpdate during the physics loop, but it actually happens after. Here's a summary of the steps that were causing the bug.

1. [End Of Physics Loop] Unity detects a collision and registers the character as being "on the ground".
2. [Update Loop] My code detects that you are on the ground but not bouncing, so resets your landing velocity and starts a manual bounce.
3. [Physics Loop] My code calculates your bounce force with the newly reset velocity.

What this meant in practice was that if the update loop ran between the time the landing was detected and the physics loop ran, your character would do a default strength jump. It's actually surprising to me this issue didn't happen more often in practice, given that the physics loop runs 50 times per second and the update loop runs much more often.

The fix to this was to properly move step 2 of the FixedUpdate method, which worked great, except when I messed up the logic on an if/else branch and completely broke swimming for 20 hours... That is fixed now though.

Changelog
  • BUG FIX: Fix a couple different bugs that resulted in improperly weak jumps in certain situations.
  • DEV: Update Level Select to handle the final levels.
  • BUG FIX: Fix camera movement bug when you teleport after moving quickly in the Level Select.
  • DEV: A bunch of bug fixes related to things you don't know about yet (related to the final level).
  • BUG FIX: Disable They See Me Rollin' achievement when you "jump" with the bazooka.
  • BUG FIX: Daily challenge now properly displays an error when it fails to load in certain ways.
  • BUG FIX: Daily challenge now loads properly (JSONUtility can't serialize Dictionaries...)
  • UX: Rename "Upload Gameplay Data" option to "Upload Error Logs", and remove the normal metrics uploads because I wasn't looking at them anyway.
  • UX: Remove tooltip from "Upload Error Logs" option.
  • BUG FIX: Crash logs upload properly again (another JSONUtility problem).
  • DEV: Lots of work on the final level stuff. It's coming along nicely, but I don't want to spoil anything.

Hotfix fix

The previous hotfix for "dud jumps" accidentally broke swimming completely. It's fixed now.

Hotfix

Fixed a couple of bugs that caused "dud jumps" in specific circumstances. Will add some more info in the weekly update post, but wanted to push this update ASAP.

Weekly Progress Report #76: I'm back!

Hey everybody! It's been a few weeks, but I'm super glad to be back. Thanks so much to everyone who wished me well during the time I was away. Fortunately the family emergency wasn't life threatening, and everyone is doing very well now.

In terms of PogoChamp, I'm on the home stretch! Getting so close to 1.0 I can practically taste it. I decided to finally make some levels that I think are on par/harder than Wall To Wall. For reference, Wall To Wall has been around since the game had like 40 levels, and as new levels were made they kept pushing it further and further back in the level order until now where it's level 96! It's about time there were some new "final levels"!

New Level: Quick Start (#97)

This level is all about speed. Gain as much momentum as you can, but be careful as one small mistake could mean disaster!

New Level: All The Things (#98)

This level seems like an appropriate way to cap off the end of the "normal levels" (level 100 will be something special). It involves pretty much everything you've been using up to this point: Buttons, Doors, Conveyors, Rings, Cannons, Breakable Platforms, Fans, Rolling, Swimming, Jetpacks and Bazookas, all in one.


Changelog
  • CONTENT: New Level: Quick Start (#97)
  • VISUAL: Added a computer to the desk in Relaxing.
  • CONTENT: New Level: All The Things (#98)
  • MISC: Updated FlatKit, Translucent Image library versions. (Might fix some crashes on certain machines).
  • DEV: Add "Debug Build" option to build generator script.
  • MISC: Update Unity version 2020.3.26f1 -> 2020.3.30f1.
  • BUG FIX: Fix replay bug that occurs when you get another power up after Jetpack.
  • GAMEPLAY: Increase the size of the Goal Zone in Quick Start.
  • MISC: Change from using Newtonsoft JSON to JSONUtility.
  • VISUAL: Increase character brightness in All The Things & Quick Start.
  • GAMEPLAY: The glass box walls in All The Things now move properly in replays.
  • BUG FIX: Changing display mode (Fullscreen/Windowed/etc) didn't work from the pause menu.
  • GAMEPLAY: The glass box walls in All The Things now shatter, and the shattering works in replays.
  • GAMEPLAY: glass box walls in All The Things are now much more resistant to being broken by slamming into them.
  • BUG FIX: Reenable NVIDIA Highlights support (it was accidentally disabled a while ago).
  • UX: Reorganize the Options menu: "Streaming" tab is now "Speedruns", and moves some of the options between that tab and Misc.
  • BUG FIX: The big fan particles were not displaying properly. (Fun Fact: "ParticleSystem.emission.rateOverTimeMultiplier" doesn't do what you would expect!)
  • UX: Add transparency to the Achievement Notification and make it slightly smaller (so it's less distracting while playing).
  • GAMEPLAY: Add fans to All The Things (because fans are also a thing!)
  • SOUND: Add glass shatter sfx to the glass wall panels in All The Things.
  • BUG FIX: Fix null reference when losing the Jetpack power up.
  • BUG FIX: Demo builds no longer show "New Update Available" message.

Temporary development delay due to family emergency

An unexpected family emergency means that I'll be away from my development computer for an unknown amount of time. During this time I'll be mostly unable to work on PogoChamp, so there won't be weekly updates. I don't have a firm "when I'll be back" date, but I expect this to last a few weeks at minimum. Fortunately everyone is (now) safe and recovering, but there's still a decent amount of time before things are back to normal.

I'm still super excited about finishing the game and getting to the 1.0 release, so don't worry, it's still happening.

Thanks for your patience,
Jake

PS: This was supposed to auto-post a few days ago, but I guess I didn't set it up right.