Simple Space Shooter (source included)
by Clint Herron · in Torque Game Builder · 12/06/2006 (10:18 am) · 29 replies
Hey all!
Here is a project I've been working on for the past few weeks. It's an attempt to make a game that focuses on having good cooperative multiplayer. When we were created, I feel we were wired for games. I really think that cooperative gaming was one of the things God had in mind when He created us, and I feel a distinct lack of good implementations of that in games today. MMOs of course have great cooperative play, Lego Starwars has fantastic cooperative play, and the Diablo series is right up there as well.
But I feel there could be more. One of the things that bugs me about the camera in Secret of Mana and Lego Starwars is that the camera only zooms out so far, and then you're locked. It can make for frustrating gameplay.
So I decided to experiment with a dynamically zoomable camera in Torque Game Builder. For that, I returned to my perennial project of Air Locked, and in an evening or two had learned enough to get a camera that updates itself to track all of the players on the screen. I think it's pretty neat!
I took some more evenings to learn how to do some AI, and spent a fair bit of time poring over equations in Wikipedia's Torpedo Data Computer entry (which was incredibly helpful).
I finally got some AI that uses trig properly to lead targets accurately, and I must say I think I understand why games like Escape Velocity didn't do this -- it's quite tough at times!
But I persevered and prevailed. Here's a screenshot:
Download the game!
Or, if you're so inclined, feel free to even check out the source -- at some point, I intend to add two-players-one-keyboard multiplayer, and hopefully at some point in the future Internet multiplayer. The game layout was designed so that multiple players could hop-in and hop-out without disrupting gameplay for the others (because cooperative AI could take over for any players who left), etc.
I realize it's somewhat small and cheesy, but I hope it's fun, and if nothing else, it's been a fantastic learning experience for me and TGB.
Feedback is appreciated, and I hope people can find it useful! Please feel free to copy/paste and learn from that source code, or even build bigger games from it. I'll continue to be working on it, and hope to eventually open it up as a fun game that can bring people together having fun. :)
Cheers!
--clint
Here is a project I've been working on for the past few weeks. It's an attempt to make a game that focuses on having good cooperative multiplayer. When we were created, I feel we were wired for games. I really think that cooperative gaming was one of the things God had in mind when He created us, and I feel a distinct lack of good implementations of that in games today. MMOs of course have great cooperative play, Lego Starwars has fantastic cooperative play, and the Diablo series is right up there as well.
But I feel there could be more. One of the things that bugs me about the camera in Secret of Mana and Lego Starwars is that the camera only zooms out so far, and then you're locked. It can make for frustrating gameplay.
So I decided to experiment with a dynamically zoomable camera in Torque Game Builder. For that, I returned to my perennial project of Air Locked, and in an evening or two had learned enough to get a camera that updates itself to track all of the players on the screen. I think it's pretty neat!
I took some more evenings to learn how to do some AI, and spent a fair bit of time poring over equations in Wikipedia's Torpedo Data Computer entry (which was incredibly helpful).
I finally got some AI that uses trig properly to lead targets accurately, and I must say I think I understand why games like Escape Velocity didn't do this -- it's quite tough at times!
But I persevered and prevailed. Here's a screenshot:
Download the game!
Or, if you're so inclined, feel free to even check out the source -- at some point, I intend to add two-players-one-keyboard multiplayer, and hopefully at some point in the future Internet multiplayer. The game layout was designed so that multiple players could hop-in and hop-out without disrupting gameplay for the others (because cooperative AI could take over for any players who left), etc.
I realize it's somewhat small and cheesy, but I hope it's fun, and if nothing else, it's been a fantastic learning experience for me and TGB.
Feedback is appreciated, and I hope people can find it useful! Please feel free to copy/paste and learn from that source code, or even build bigger games from it. I'll continue to be working on it, and hope to eventually open it up as a fun game that can bring people together having fun. :)
Cheers!
--clint
About the author
#22
10/07/2007 (2:50 pm)
Hi, I have downloaded the source code and using it in a similar game I have, believe it or not a clone of subspace. I am interested in seeing your modifications because it seems there is a bug in my code - the ai bot will lead the target correctly except when it has to aim 45 degrees up/right or 45 degrees down/right in that general area the player is safe. I think I'll figure it out sometime with debugging but if you think you know the solution to this problem let me know. Unfortunately I do not have trig knowledge so I don't understand the math itself, for the most part.
#23
All I can think of is maybe torque game builder changed a way of representing rotation or direction since you made this game...That gets really confusing btw, sometimes an angle is negative, sometimes it's always positive and sometimes it's between 180 and -180.
10/07/2007 (4:00 pm)
It seems that the problem occurs when the player is on the right side of the AI ...when directHeading is below 180. I tried all sorts of hacks, like adding +180 to various places, though nothing seemed to work, best case scenario I just reversed the problem to not making it on the left. All I can think of is maybe torque game builder changed a way of representing rotation or direction since you made this game...That gets really confusing btw, sometimes an angle is negative, sometimes it's always positive and sometimes it's between 180 and -180.
#24
I haven't messed with this a whole lot lately, I'll have to try and remember to take time and see if I have any un-posted updates to this. It might just be something that was always there, that I just never realized.
Chris Jorgensen, if you're reading this -- did you happen to notice things like this when you integrated the aiming code into Xeno Versus?
--clint
10/09/2007 (12:45 pm)
Hey Jacob, thanks for the bug report.I haven't messed with this a whole lot lately, I'll have to try and remember to take time and see if I have any un-posted updates to this. It might just be something that was always there, that I just never realized.
Chris Jorgensen, if you're reading this -- did you happen to notice things like this when you integrated the aiming code into Xeno Versus?
--clint
#25
Yes, I had similar issues. But I haven't had time to exhaustively test the code and see exactly where the aiming works / fails. I do plan on taking a serious look... I've just been writing new camera code still. I'm on my 4th major iteration of that...lol... but the aiming code is on my agenda next. :)
10/09/2007 (6:06 pm)
Clint/Jacob:Yes, I had similar issues. But I haven't had time to exhaustively test the code and see exactly where the aiming works / fails. I do plan on taking a serious look... I've just been writing new camera code still. I'm on my 4th major iteration of that...lol... but the aiming code is on my agenda next. :)
#26
10/14/2007 (10:53 pm)
I ended up hacking in some code from OpenSteer, that is a really great resource and maybe you guys should check it out. The intercept code is better considering it takes into account relative motion of all involved parties (including the ship who is chasing, which is very important for my subspace-style clone I am making (and I would assume important for any inertia-based game in general))
#27
03/27/2008 (4:12 pm)
Please, if someone has this source code in his(her) HD, please re-upload it to a more stable server! The current links are not working. Thanks
#28
I've uploaded the source from post #4 in this thread:
AirLockedRevisited_Source_2006_12_09_Multiplayer.zip
03/27/2008 (11:07 pm)
All the screenshots and source downloads are working fine for me.I've uploaded the source from post #4 in this thread:
AirLockedRevisited_Source_2006_12_09_Multiplayer.zip
#29
--clint
04/09/2008 (12:53 pm)
Sorry if there were glitches in my server hosting -- it all seems to be up and running again now.--clint
Torque Owner Clint Herron
Instead of "fires randomly" and "thrust", you could have "fires on key press", and then you've got a user-controlled auto-aiming turret, that you could mount to your spaceship or something.
So basically I was wanting to take this behaviors system, and shoehorn all of my smart "torpedo data computer" AI into a behavior, and use it in the new and upcoming TGB paradigm of behaviors. That's all. :)
Thanks so much for the feedback on my game! I'm glad to hear that the camera zooming worked well -- I was must admit that when I first got it done, I was surprised at how smoothly it worked -- it certainly exceeded my expectations.
The game is slightly more fun with 2 people, but the lack of fun is certainly the biggest shortcoming of the game at this point -- I hope to make it more fun in the next released version. That's actually why many of the unreleased changes have remained unreleased -- I didn't find that they added anything fun to the game, and I'm struggling to bring back more fun. Any suggestions on how to make the game more fun would be very welcome.
Thanks again! It is genuinely appreciated. :)
--clint