October 12, 2017

The Rewrite

There has been a very clear lack of posts this year, but not because I haven't been busting my butt. In my last post, I outlined what I wanted to accomplish and by what sort of time frame I was hoping to make it all happen. For the fun of it, I haven't looked at that post since I posted it in December 2016 and I feel like I can take a guess at where I wanted to be by this point.

I believe the main thing I was hoping for was getting a custom physics engine up and running, and I had debated reworking the graphics engine. I think I was aiming to get a prototype going by the end of summer. (Something I certainly haven't been able to do). Now I'm going to take a look.

Well, I certainly promised a few other things that I haven't finished yet. I also dramatically deviated from my outline. I think maybe the best approach is to outline what I have done in the last almost 10 months.

Physics
This one was a big one, I knew going into it that I would be going deep into a very technically complex topic. There is a huge difference between knowing physics engines and actually writing one. It was a challenge, which I took on and am very happy with my result. I have a very unique physics engine that should be able to do everything I want. It is extremely robust and has absolutely no issues handling high-speed collisions flawlessly. I also have a nice automated test suite to make sure all the little parts tick correctly. I still haven't really built out the part that I originally intended for my game, but it isn't a high priority because have solved most of the difficult technical challenges.

Graphics
As I had expected, I wasn't going to be doing a lot with client-side graphics. However, what I ended up doing was completely ripping out my old graphics and rewriting it and an engine from scratch. I was able to come up with something I believe can do high-quality real-time shadows. Time will tell if that truly ends up being the case, but it would be wonderful if it works out. I suspect it will be based on a few prototypes but we will see. I'm using a completely different rendering technique that I haven't seen used by anyone else as well.

The motivating factor for doing my own graphics engine is because of the art style I've decided to go with: primitive object graphics. That doesn't mean low-polygon but it might have the look of it at times. I basically want to mix high-quality lighting with basic shapes to give it a very unique feel.

Interface
I was planning to upgrade my graphics, what I wasn't planning on doing was reworking my integration with CEF. I ended up reworking my build system and dramatically simplifying it. I am now also able to make use of bleeding edge web technologies and have the ability to easily write automated tests anywhere in my software stack. I also have opened up the ability to debug every layer, which is going to be extremely useful for development. Effectively there is no guess and run, everything is testable and debuggable. The build system is straightforward and very easy to work with. Most of my frustrations with having a complex build process was having to figure out what went wrong and how to diagnose issues. Now everything is easy to debug and test.

Network
A while ago, I was using a number of libraries for networking, but they lacked customization and seemed to carry a decent amount of overhead. Seeing how I basically reworked most of the engine/game I decided to rip out the network libraries and roll my own solution. Instead of going all low-level I settled on using Netty as the backbone for my implementations. I was able to whip up a TCP client/server, an HTTP server, and a WebSocket server in a few days. Each customized to match my needs for the engine. I now have a proper authentication layer and security around the client/server as well as considerable control over how everything operates. The best part of it was I basically tossed four libraries and now use just one which does everything I need and more.

Math
Slightly unrelated, but I ended up extending my own linear algebra library because I was sick of dealing with terrible API and not being able to distinguish between immutable and mutable data structures. I even included a few useful types to deal with special cases and basically make the type system do correctness checks for me when performing calculations. All that dramatically simplified my work on the physics engine and made writing unit tests a breeze. I also wrote an arbitrary precision fixed-point library. This allows me to work at whatever precision I need, and I can use fixed-point for consistent number handling where it makes sense. I'm still using floating point for internal parts of the physics engine because it is just faster. I'm also using floating point for the graphics engine because that is just faster when dealing with it. However, I can now store and operate on numbers of any scale when I need to, something kind of important when working at solar system scales. Unfortunately, it takes up to 3 times longer to perform some calculations compared to a floating point but at other times is just as fast as floating point. Enough I won't use it for core calculations but I certainly can use it for intermediate values when transitioning between coordinate systems. It was something I was attempting to figure out previously, but now that I can scale to whatever precision I want and still run at fairly high performance there isn't any concern now.

Gameplay
After all the previous work I've finally been able to get back to working on the game itself. I spent a ton of time working out engine design and am not able to crank out features related to the game. It is extremely easy and I've come up with an architecture that looks to be robust and extensible.

Administration
I now am also using my own wiki for keeping track of architectural and development information (such as how to build the application). I wasn't sure what I wanted to do to keep track of it but figured it is better to use a real wiki with markdown over text files in the repo. I'm also recording and planning out my designs and thoughts in OneNote. It seems to work well, but I'm split on if google drive would simply work better. I'm also using a proper issue tracker now and making cards/organizing my backlog for cards. It really is just a glorified TODO list at this point, but it really helps me stay focused and provides a nice way to show progress.

Based on my outline from before, I look like I'm roughly on track. Behind on a few things, but also pulled in a lot more than I was expecting. I will be continuing to work towards a playable demo (technically I have one but its nothing special) and as I work on it I'll be continually improving the physics and graphics engine. To the end of the backlog I go, one card at a time.


No comments :

Post a Comment