Just so you know, this is not a tutorial series! I am writing this series mainly to give you a behind the scenes look at the process of making a game in Unity, and to document the development of this project.
Over the last two weeks, I finished integrating BepuPhysics v2, and I finally got started on cannons. I only had time for basic interaction so far, so I’ll be working on firing functionality in the next progress update.
Today I continued sorting out the last few leftover errors from upgrading to BepuPhysics v2. When they were finally all taken care of and I tried to run the server, it failed again due to errors with the player controller. Visual Studio hadn’t detected those earlier, which led me to believe I was much closer to being done than I actually was.
After looking at Bepu’s character controller demo class, I decided it was too complex. I’ve found that Bepu v2 is overall quite a bit more difficult to get going, largely due to the fact that it’s newly released and there aren’t many resources available yet. I’ve slogged through a lot of code over the last few days, and I really wasn’t in the mood to do the same for the character controller. So, I decided to write my own. It’s extremely simple and only really applies velocities based on input right now, but I’m hoping it will work (once all other errors are taken care of and I can actually test it).
This evening I encountered some dependency versioning problems. It took a while to get them all sorted out, but eventually I managed to run the server without errors. I still need to re-add the ship collider, but I think after that most of the conversion should be complete.
After testing it yesterday, I found out that my character controller doesn’t work. There’s some really strange stuff going on, and the problem seems to defy all logic. Based on the feedback I’m getting from debugging, everything should be working flawlessly, but it doesn’t. I spent a lot of time today trying to find the source of the issue, so far unsuccessfully.
Today I figured out the problem with the character controller. It turns out that the collider was going to sleep after sitting there without moving, and directly setting its velocity doesn’t wake it up. I changed it so player colliders won’t go to sleep at all, and it’s working great now.
This afternoon I fixed ship flotation. The methods used to apply forces differ slightly in functionality between Bepu v1 and v2, so I had to make a few modifications to how the flotation code works. It’s back to working properly, but it still needs some fine-tuning.
Today I spent some time compiling my networking code into a fresh project to prepare for the tutorial I’ll be writing tomorrow. This took quite a long time, so I didn’t work on the project at all.
I spent all day today writing a tutorial about the networking solution I’m using in my game. In this first part, we set up a server and then connect a Unity client, so if you’re interested in making multiplayer games, definitely go check that out (please note that this is not a beginner tutorial).
Before I start working on cannon functionality, I want to finish fixing the ship collider. There’s some issues with the mesh colliders—they’re not being positioned properly, and they seem to be scaled up.
Today I noticed that something seems to be causing a memory leak. I think it might be the meshes, because when I remove them it doesn’t appear to happen. The problems with mesh colliders seem to be adding up, and I’m starting to consider just using a bunch of box colliders to approximate the shapes I need.
I finally got tired of guessing, so I posted about my struggles on the BepuPhysics forums. Shoutout to Norbo for the quick and informative responses! It turns out that mesh shapes aren’t compatible with compound colliders, which is how I was using them (that may also be the cause of the memory leak, assuming there actually is one and my RAM usage isn’t steadily climbing for some other reason). I’ve decided to (at least for now) use multiple box colliders to approximate the ship’s shape, since I really want to get cannons working before the end of this week.
Today I spent quite a while adding all the box colliders. It took a long time since I wanted them to accurately represent the ship’s shape, but it’s done now. The best part is, it works!
This afternoon I rewrote the interaction code for the ship’s steering wheel to be more reusable. It’s now in a state in which I can easily extend it to work with cannons and any other interactable object’s I add later on.
Today I finally got started on cannon functionality. It’s Mother’s Day today, so I only got around to implementing the interaction code, but I’ll add the ability to shoot cannonballs over the next two days.
I’ll start next week off by making cannons fireable. After that, there’s a lot of things I need to polish up—player behavior while interacting with things, messy code and project hierarchies, ship flotation etc. I’m hoping to also get around to writing a “proper” character controller (still directly setting velocity right now), so I’ll be tying up a lot of loose ends.