A few days ago (on the 25/9) we finally got S.W.A.P out the door with the release of version 1.0. Since the release of the first beta in January S.W.A.P has been downloaded more then 2,000 times and we have seen more then 1,200 new players since the release of 1.0. If you want to be one of these new players you can get S.W.A.P here.
In addition to all the new players we have been getting some grate positive press, most notably from PC Gamer and Euro Gamer. This built on coverage we got during the beta period from places like Rock Paper Shotgun.
In order to build on the success of the launch weekend we have arranged (thanks to the guys at AIE, where S.W.A.P started) to be at EB Expo again this year. We are hoping to duplicate the success of last year and bring in a whole bunch of new (and hopefully younger) players.
In conjunction with the released of the game Justin Jet Zorbas has released the Original Sound Track. You can listen to the OST on YouTube or download it from Sound Cloud. Justin has been a terrific help during the development of S.W.A.P. Not only has he composed all the music but he provided us with all the sound effects and announcements in the game. He has also been a traffic help with play testing the game throughout out the beta period. I’d appreciate it if you could help him out by liking or sharing the OST.
Finaly what about S.W.A.P’s future? I’ll let the boys over at Chaos Theory Games answer that one. Its been a great Ride developing S.W.A.P and its not over yet :D!!
I recently Made a short Video tutorial on how to host a S.W.A.P Server and play the game at the same time. You can watch it below:
For those who can’t watch a video here’s a text summary of the tutorial:
Due to an early design decisions the server is a dedicated server. To work around this so you can Play and Host at the same time on the same PC you need to:
— Be using a PC that exceeds the recommended system specs.
— Run the game in windowed mode, with Graphics Quality set to “Low”, at a resolution of 800×600.
— Host a game and leave it running.
— Run another instance of the game, this time select your desired quality settings and resolution, and run in full screen if desired.
— Use this second instance to join the game.
When hosting a server problems can arise due to any installed firewalls and/or you router. If others are having problems connecting to a server you are hosting check to make sure that you have allowed S.W.A.P. through your firewall and if necessary configured port forwarding on the router (by default S.W.A.P. uses port 8888). You can find further information on how to setup post forwarding for you specific routerhere.
Recently while I was tweaking the Swap missiles tracking in my upcoming game S.W.A.P. I encounter a funny little Bug where it would “orbit” its target. I recorded a short video which you can watch below:
I thought I’d briefly share the code that produced this result:
// ... Target Acquisition Ocures up here ...
void RotateTowards(Vector3 target)
Vector3 dirToAvatar = (transform.position - target).normalized;
// work out angle between us and the target.
float angle = Vector3.Angle(dirToAvatar, transform.forward);
float rotAmount = Mathf.Clamp01( maxTrunAmount / angle ); // this prevents us from rotating more them the maximum allowed!!
Quaternion temp = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(-dirToAvatar), rotAmount);
So the goal of this function is to rotate the missile so it faces the target. However the amount it can rotate is capped by maxTrunAmount. The problem was that if you got the distance and angle right the missile would need to rotate more then maxTrunAmount would allow it to. If you got this just right this would result in stable “orbits” where the missile would just keep circling the target.
The final code I ended up using looked like this:
void RotateTowards(Vector3 target)
Vector3 dirToAvatar = transform.position - target;
float distToAvatarSqr = dirToAvatar.sqrMagnitude;
// Work out how far we can rotate based on distance to target:
float t = 1 - (distToAvatarSqr / (trackingDistanceSqr - 2));
t = Mathf.Clamp01( missileTurningCurve.Evaluate(t) );
Quaternion newRot = Quaternion.Lerp(transform.rotation, Quaternion.LookRotation(-dirToAvatar), t);
Needless to say this actually works quite differently. This time, in addition to tracking the target we also wanted to adjust how far the missile could turn, when it was right at the end of its tracking range, it would turn only a small amount. As it gets closer it can turn faster, When it gets really close it will got straight for the target.
On line 8 we work out how close we are to the target as a percentage (0 being far away, 1 being at the target). Note that we take 2 away from our max tracking distance, this is to take into account that the targets position is in the centre of the avatar and for this number to ever be 1 we must get to a distance of 0. Because of the Targets collider (and the missile’s too) this is impossible, so we have minus 2.
On line 9 we use a curve (which I have expose in the inspector) to transform this range percentage into a rotation percentage. We use the curve because we wanted to have the missile turn in gradually at first but much more sharply as it got closer. The curve looks like this:
By eliminating the artificial maxTrunAmount we have allowed the swap missile to (eventually) turn the full required amount to actually hit and eliminated the “orbits”. (of course if I couldn’t fix it we would have ended up with swap Sharks instead, which could have been fun :D).
Actually the single best thing to come out of this was my learning about the AnimationCurve.Evaluate() function. It makes it trivial to expose a curve in the inspector which can be edited by an artist and then use it to control a lerp between two values (colour, position, rotation , whatever). This actually allows me solve one of the most frequent questions I get from an artist when I setup a mechanic that involve a lerp, i.e Can you change it so…? Now I can just tell them: Do it yourself! and that always make me feel good.
When we were developing the original Prototype for S.W.A.P. we ran into A LOT of problem, by far the worst of which was encountered on the afternoon the day before our deadline. With more then two players in the game there would be ‘ownership’ issues after a players swaps, i.e. two players would control the same avatar. In the end this bug forced us to rely on a video when pitching the game, instead of a live demo.
One reason why the bug caused such a problem was because we had no way to get debug information from the unity player. We needed a console, one where we could enter commands and receive feedback from the game and we didn’t have one. Continue reading The S.W.A.P. Debug Console→