Bike Physics!
Inspiration
Over the past few months I've gotten into biking in a major way. It's now my primary means of transportation and frankly, I love it! One of my favorite aspects of it is how every trip somewhere has the potential to be an adventure, and every trip to the same place is unique. I like attaching large objects to my bike and seeing if I can make it home with them. I haven't failed yet!
Whenever I stick something weird or bulky on my bike, and particularly when I hit a bump in the road and that thing goes flying off (which is rarer now!) I think about Death Stranding, and the way it feels to stack Sam up with luggage and wobble across the rugged countryside.
One bike adventure I had recently was going to the pharmacy, but on the return trip finding that the pleasant wooded path I had ridden to get there was now dark and foreboding. Riding this trail at night was equal parts terrifying and exhilarating, and it reminded me of being a kid, doing things that were spooky while being egged on by friends.
"Finish your game! jam"
I've been working on a turn-based 2d game for a long time now (Floppy Knights - Buy it on steam!) and have been itching to do something in 3d as well as something physics based. In addition to this I recently played The Man Man for the Pigsquad halloween stream and had QWOP-like controls on the brain. This combined with thinking about making a cargo-bike game bounced around and gave me the idea for this project- a spooky, sim-y bike game that gave you the feeling of taking not near enough time to calculate the risks and saying "I can't believe I got away with that!".
Balance
Learning to ride a bike- like learning most physical skills involving balance and coordination- is REALLY complicated. To stay balanced on a bike a rider must push on the pedals fast enough that the bike stabilizes itself, shift their center of mass around to keep the bike upright, and oversteer to correct for errors made in steps one and two. This is really, really hard to simulate in a 3d physics system. In order to make a bike simulator that could still crash in the time span of the jam I decided I would have to cheat.
Cheat #1: ThinCar™!
The first way I tried cheating was to design a bike controller that was just a very bottom heavy, skinny car. Unity has these nifty things called wheel colliders which are weirdly just complex enough they are hard to work with for arcade-y car physics, and are too simple for complex car physics. Nevertheless, they beat me trying to make my own collider on my first "real" physics outing, so I took four of them and followed a car tutorial, making my "car" much thinner in the hopes it could still tip in extreme circumstances. While it "balanced" and could still tip, I found it was extremely unpredictable and unwieldy. No amount of tweaking made it feel good. You would also collide with things all the time that you shouldn't have, which was really un-fun!
"Cheat" #2: Asset Store!
I can be really stubborn and try and do things myself when I should really look at how other people do them first. After faffing about with wheel colliders and rigidbodies I eventually said "By golly! I am interested in making a GAME not interested in being the best physics boy!" and decided to see if I could buy an asset that had bike control to use for the game, and to study how they did it to get the physics learnings I wanted to get from this project. I bought an asset that was an animated guy on a bike. It ended up really not working for what I wanted, so I scrapped it after several days and kept how it set up the colliders on the bike. It did, however, give me a critical part of information for how to balance ridiculous objects in unity with NO EFFORT, which brings me to...
Cheat #3: Extremely low center of mass
Unity lets you do something which is impossible in real life: create an object whose center of mass lies outside of the hull of that object. When this offset is in the direction gravity would pull the object it has an interesting effect- it cannot be tipped over. The objects center-of-mass can then be moved left or right to allow the bike to lean, or moved drastically forward to pitch the rider over the bars! This cheat is great because it gives us a lot of flexibility, which still allowing us a simple model to control the bike from.
Pedaling
To be continued!
night ride
a spooky game about bad infrastructure
Status | In development |
Author | AvantBard |
Genre | Simulation |
Leave a comment
Log in with itch.io to leave a comment.