Hey all,
I have been a hobbyist programmer all the way back to the gw-basic days. If you wanted dumb text programs, I was your man. (like Monkey Kill which would just display a random number generator with the words “Monkeys killed. Continue(Y/N)” added to it.)
I wanted to finally move into the 3d world and decided to try a few engines. Many seemed glued together and not very cohesive. Unity, however, really puts the “Integrated” back in IDE.
Anyways, I thought I’d share what I was up to as a way to say thanks. Maybe it will be helpful to
someone else as much as I found the code on these boards helpful to me.
This is a skeleton for a 3d fighting game.
Camera and movement:
the camera will try to keep the 2 players in view (it follows the Player1 and Player2 tags)
It will also rotate to keep the players in the familiar 2d fighting game plane. The movement is 8-way, relative to the camera. This set up mimics 3d fighters such as Soul Calibur, Tekken, Virtua Fighter, etc.
attacking:
Since the concept of frame data doesn’t work correctly for the variable FPS of a PC (and the fact unity doesn’t deal with frames anyways), ‘frame data’ gets converted into ‘time data’ on the fly.
Each attack has execution frames, active frames, and recovery frames. Currently there is one poorly self animated attack. This attack is an exact data copy of Akira’s jab from VF5 (11 frames execution, 2 active, 13 recovery).
When an attack is thrown the game waits out the execution time then checks if there are any collisions only during the active time and then the effect of the attack is applied.
Misc:
life bars, fall out catcher, “victory” message.
stuff not yet implemented:
Nearly everything.
This code is most likely horribly implemented as many of these concepts are new to me.
A few things I’m not happy with:
Depending on position, the collision detection as it can be very dodge-y. Most noticeable from the side.
I’m looking for a better method then sphere and character controller interaction.
I was trying to avoid making hitboxes for every frame of every attack.
If you spin around the other guy you will slowly slide backwards.
The camera is nice and tight when people are close together but when farther away it zooms out too much.
Controls:
P1: movement: wasd. jump:space. attack:mouse 1 or r.
p2: movement: arrows jump:/ attack: mouse 2 or l.
Thanks to:
Unity Technologies for the great free engine and the tutorials.
UnityLabs.net for the model and the idle/walking/running animations.
Someone on the forums for the ‘keep things in view’ camera code. (I wish I could find this post again!)
The unity wiki for the float text code, fps display code, and Keycombo.
The community for being so large that i can just google my problem+unity and find the asnwer.