Game Development Community

Guided Projectile with only Scripting

by Kirchgessner · in Torque Game Engine · 12/10/2006 (8:22 pm) · 10 replies

Heres my dilemma, I need to make a projectile follow my players Eye Vector, so as to guide it.

But I can only do it in scripting, we want our game to remain open to as many OS's as possible (meaning we can't edit source code, no mac or linux machines to make a build)

I have tried to apply setControlObject in the onFire function
I've also tried to use setTransform, and getEyeTransform in a number of different combinations
I've tried adding it in the player.cs files as well and nothing has really worked yet.

Your help is appreciated.

#1
12/10/2006 (8:47 pm)
I don't think you can do this without C++ modifications.

I've implemented guided projectiles using parts of this resource (I have my own targeting mechanism):
http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=6778

But I don't think you can do this script-only if you use Projectile classes, since once they are on their way, they don't call back into script to allow you to change their path until they hit something (unless you make the C++ modifications in the resource I listed).
#2
12/10/2006 (8:55 pm)
I'm thinking you could probably spawn an object in place of the projectile and control that instead. The old bait and switch, as it were.
#3
12/10/2006 (9:00 pm)
You could probably do it by using schedule and a lot of vector math but that would be inefficient and slow.
#4
12/11/2006 (7:00 am)
I believe the guided missile resource is cross platform, I did have it running on Windows and Linux, not sure for Mac though.
#5
12/11/2006 (7:03 am)
@Dave D

I'm using the tracking part of the guided missile resource on a Mac, and it works fine. I'm pretty sure the whole thing is platform neutral.

(btw, Guided Rockets on an AITurret makes for one very nasty SAM....)
#6
12/11/2006 (8:43 am)
Its not that the resource is cross platform, its that I can't edit any of the source code because we have no Machines to build the source on. All we have is Visual Express C++ for windows so thats really the only machines we have to do the compiling on.

And as far as I know there is no way to make a build for linux and mac on a windows machine. But if there is please tell me. Because I'd much rather add it in the source code rather than trying to do everything in scripting.
#7
12/11/2006 (9:36 am)
No, I don't know of any way to build a Mac executable (or a linux one, for that matter) on Windows. I think Metrowerks Codewarrior used to be able to do this back in the day, but I don't think that version is available anymore.

What I'd do is proceed with modifying the Windows engine as you need to (keeping in mind that things like shaders, etc...may not port easily to other platforms), and just plan to get an inexpensive Mac and/or Linux box to build on later, before you release the game. 'Engine-logic' type modifications like the guided missile resource shouldn't cause any problems when porting to other platforms. Otherwise, you're going to end up building your game around the limitations of the Demo engine code, rather than building it around what you need for it to be fun.

In other words, I think it will be easier in the long run to find a Mac or Linux machine for building on, than it will be to build a fun game worth paying for without altering the demo C++ code in any way.

Just my $0.02.
#8
12/22/2006 (12:29 pm)
I would spawn a flying vehicle instead of a projectile ::onFire and set client control to it. Have the vehicles ::onCollision code handle the radius damage or direct damage as required plus deletion of the vehicle. Also when destroyed set control back to the player. Obviously you need to make a special dts model for this with a cam node in the proper place. No mount point needed.
#9
12/22/2006 (1:40 pm)
Brian K.,

Feel free to ignore this if you want . . .

If projectile tracking is a required feature and Mac and Linux are required platforms -- and no script-only solutions work out for you, another option might be to build for Windows and pay a contractor to port it to Mac for you. If money is tight, you might be able to work out a barter-system/trade of services with a Mac or Linux developer. You could provide box art/modeling services for someone who ports your game to another platform. It's not an ideal solution, but it might work.

Or, if you are a student at a decent college/university, one or more labs might be equipped with Macs that you could use. Your profile says you're in a graphic arts program, so you probably have Macs running out your ears. Obtaining coding permission on one might be an issue though, depending on current regulations at your school.

Getting up and running on Linux might be not be as tough as you think. In fact, there's no need to get a new computer. You could use your existing system, just with a different hard drive. I used to keep a system with a removable hard-drive caddy so I could swap out a variety of operating systems (each on a separate drive) whenever I needed to do something on one of them. Yeah, dual-booting is an option too, but it never hurts to keep things simple. Ubuntu Linux should work pretty well for you.

Of course none of this is any of my business. I'm only making these suggestions because it seems like you're boxing yourself into a corner by not touching the code. TGE is very cool as-is, but the source allows you to take it in new directions and make it your own (figuratively speaking).
#10
12/22/2006 (2:01 pm)
Drop into the Mac forum and ask someone to make a build for you. Wouldn't be the first time someone's done that!