Last article I wrote was in October of last year but if you've been following the page you'll know I've been quietly updating the videos and images with things as I complete features and have things to show off. A ton of the work I've been doing has been organizing the code of the game, re-writing a lot of stuff, and learning to properly encapsulate things. I've also been experimenting with how I'm going to handle networking, hit detection, mech component system, etc. and I think I have a very good idea of what direction to go in.
Sadly a lot of the work I've done is internal and if I tried to explain it would only be understood by other programmers. Among the things I've accomplished that I can show off quite easily has to do with the bullet simulation. I've re-written all of the original code and it now runs 3x faster, it runs so fast now that I have no worries about it not being able to perform when there's 10 or more mechs on the field slinging slugs at each other at the same time. As it stands right now all I have to do for each type of ammunition is supply these parameters and the simulation takes care of everything else:
a list of completed features for the bullet simulation are:
- Each and every bullet is actually rendered with a 3d model, some people will scoff and say i's not necessary but the performance loss of rendering these models is almost nothing and hey it's my game and I think it's super cool. The bullet models are stretched out and faded based on how fast they're moving across your vision, like a cheap motion blur. You can see it in action in this video:
- All projectiles will retain the velocity of the object that shot them, this means if your mech is running to the right your shots will retain that velocity and continue to go right-ward, if you're running forward the bullets will go going a bit faster, if you're running backwards they'll go a bit slower. Does that make sense?
- Standard air drag and gravity effects.
- Non-static wind effects, this is hard to explain but this isn't just a global constant "10mph east" wind that effects all bullets across the map equally like I've seen in other games, here there is an actual animated wind map that changes the wind strength on a local level over time. There's no performance hit to do this and you can see it in action here:
- Coriolis effect, you can look this up on Wikipedia, essentially it has to do with a planet's rotation, this effect is so subtle that it hardly makes a difference, I couldn't see that until after I implemented it but hey it's there now! And it's funny to watch how the bullets fly when you make the planet rotate SUPER fast:
- Simulation of penetration through materials, I went into this in the last article but I've made a huge improvement to my equation, I don't know how I did it but it's actually predicting on a pretty accurate level how much steel armor each projectile can penetrate in real life. When I added the M829A3 round to the game (the same round an Abrams tank shoots) I only had to make minor adjustments since my equation already had it within 15mm of real world statistics.
I've implemented a random number generator for normally distributed or "gaussian" values, this is also pretty hard to explain, any typical RNG will give you uniform values, meaning the chance of getting any value over another is always equal, a normal distribution acts differently and is actually seen in the real world more often than uniform randomness is. You can read more about it on Wikipedia here and here. The following is a picture of how I've used it to govern bullet accuracy cone-of-fire:
I have a friend that was kind enough to make a few sound effects for me based on what I was looking for, this video gives a good idea of how I want the guns in the game to sound like, *VOLUME WARNING*:
I was hoping I would be able to have a simple Alpha playable version for you guys by the next time I posted an article but It's been way too long and I needed to post one up. Things have been going slower than I've planned but I think I still have enough time to have something by the end of the year. Sorry I couldn't have more to show you guys but hey I'm working on this on my own and learning as I go; bear with me. Feel free to ask any questions about the game if you're curious and thanks for reading!