With Violent Sol Worlds we started with a Proof of Concept project and moved to the real code base after we validated the idea of the game was fun. So we had the player shooting in the POC quickly but now we need to get that code organized and in place in the real game.
Step 1 - get the player animation in
First we need the animation system to have "blocking" animations. That is an animation that the player cannot escape from. This makes the player have to wait until done shooting to perform another animation/action. This included us creating a player state that tells us the player is performing an action and will have to wait to perform another.
As you can see the cowboy can shoot, walk around then shoot again. Right now the player is one single animated layer, but in the future the arms will be animated separately from the feet and head so that the arms could have a blocking animation of shoot and the legs could be walking. For now the player has to choose between walking or shooting.
Step 2 - laser creation
Up next is getting those lasers to fly out of the gun in the proper direction. This kinda turns the player into a generator of sorts and it will be having to put some sort of create action on the action queue to make that happen. We already have the proper infrastructure in place to build new entities so that part won't be bad.
On first attempt we simply got the lasers to create in the world. They were being created, but nothing is reacting to them and they were not flying around yet. So it looked like this...
They are a random color on load so that is neat. They needed to fly though and not just sit there at the players current position.
Step 3 - motion
We had to add some velocity to the lasers. They fly from the player out of the gun. So now we had to make their collisions work correctly with bugs, trees, and cars.
As you can see the lasers fly out of the gun at this point and push the bug around, but nothing feels like it is truly happening. It really feels like things are just spawning in and flying around and the lasers do not seem deadly.
Step 4 - reaction to collision
In this part we simply wanted to get the laser taking down health of a bug. It was not that hard, and we got the bug to be taken out of the world when it was killed.
It looks terrible because there is no indication that I am hitting that bug. Needs blood, and such for feedback to the user. Plus this bug would have torn the player in half and not just cuddled with him. But it is baby steps in game development that make awesome things come together.
Step 5 - starting the feedback
Started to add splatter for a bug impact. Giving the hit of the laser a bit more of a feeling that you are actually hurting that beast.
The splatters needs to transition in and out though. But it does add the feedback to the player that we needed although it is not accurate to the location of the laser hit which would add some better feedback.
Removing the randomness of where the blood spawned in on the bugs so that it appears in where the laser hit the bugs makes things look a bit more responsive.
The splatter will be a giant memory leak though if it just stayed forever on the ground, they need to cleanup, but the bugs cannot just go away when dead, so we made them drop body parts when they died.
Step 6 - carnage
At this point we have gotten the bugs to die, drop blood as they are getting hurt, and now leave parts behind when you crush them. I think my job here is done, but there is that problem of the memory leaking parts staying around forever.
Step 7 - cleaning up the goo
You cannot have blood and guts stay around forever without eventually bringing any machine to its knees. So we added a lifespan to each one and let them expire by fading out gracefully.
We now have an awesome system for shooting creatures and having them react to projectiles. Everything cleans up after itself and provides good feedback to the user. Can't ask for much more. If you are interested in Violent Sol Worlds please do follow us here on IndieDB, and check out ViolentSol.com for more details on the game.