PDA

View Full Version : How to make an advanced homing missile



Antikris
01-30-2011, 06:58 PM
Be sure to read my previous guide (http://www.lbpcentral.com/forums/showthread.php?46673-How-to-make-a-simple-homing-missile&p=754481) first to understand the basics. Here we'll be making the missile set a lock onto a found target and give the target a short time to escape.

http://i.imgur.com/XzWYV.jpg

The main difference from the previous guide is that the missile no longer aims for a player, but aims for the lock object. You can see I made a small crosshair out of Halo material (20%). I glued another piece of Halo (0%) to it to be able to stick a chip in the center.

Instead of picking the player as a target, you can make the missile aim for whatever you like; just change the Followers on the lock to aim for a Tag (http://wiki.lbpcentral.com/Tag) and the Player Sensor (http://wiki.lbpcentral.com/Player_Sensor) on the lock to a Tag Sensor. We will be using one tag in this guide, though, so keep one reserved.

http://i.imgur.com/bBx6L.jpg

The missile here has its Look At Sensor set to follow the teal colored tag on the lock object. We have that tag stuck on both the missile as the lock circuitry, but that will become clear later on.

The missile will go through three distinct phases:
Fly around aimlessly. The lock will follow the missile around until it finds a target.
Target acquired. The lock will stick to its target and the missile will fly towards the lock.
Target locked. The lock will stop following the target and stand still. The missile will impact soon after. This is the time that the target has to escape.

http://i.imgur.com/NoQsS.png

Phase 1 - Fly around aimlessly

A Player Sensor (or a Tag Sensor (http://wiki.lbpcentral.com/Tag_Sensor) for alternative targets) will initiate phase 2 when activates, but a NOT gate behind it will make sure phase 1 is triggered (also, to return back to phase 1 in the rare case a target gets suddenly out of range, for instance by dying). The Follower (http://wiki.lbpcentral.com/Follower) of phase 1 tracks the missile's tag; set it to a very wide radius. Set the minimum range to 3 or 4 so that the lock's own tag will not trigger it.

Trying to save tags here; it would be a shame to have to use two unique tags alone for this missile. So, we'll use the same tag and a minimum sensor range.

A Selector (http://wiki.lbpcentral.com/Selector) is a neat way to switch between logic phases without having to manually reset everything from the previous phase.

Phase 2 - Target acquired

When the player gets into range of the Player Sensor, it triggers phase 2. The Follower of phase 2 is now chasing the player at maximum speed. Also, there is a small Timer set to 0.1s that resets itself and thus acts as a pulsar. It fuels a beeping sound here, as well as making the Halo crosshairs flicker.

Phase 2 also sets off a Timer that determines the time until the missile goes to the next phase.

I just realised I made a mistake: the timer does not get reset in case the system returns to phase 1; hooking up the phase 1 Selector output to the reset of phase 2's timer should do just that.

Phase 3 - Target locked

There is no longer a Follower in this phase but instead a simple Mover, set to 0% speed, 100% deceleration; this makes the lock stop dead in its tracks. Another pulsar with a different beep to indicate your last chance to escape.

Finally, the lock needs to disappear after the missile has destroyed itself; this can be done by linking an inverted Tag Sensor to a Destroyer (http://wiki.lbpcentral.com/Destroyer). Remember to set the minimum radius of the sensor to 3 or 4 to prevent the lock from blowing itself up.

Death from the sky. Enjoy (http://www.youtube.com/watch?v=zekiZYSVdeQ)!

Bloblblobl
02-04-2011, 04:01 AM
Interesting subject, but I don't think it was so complex you needed to make a tutorial for it alone. Next time you should add actual gameplay mechanics, like having custom sackbots that run away from it and panic. That would be a real tutorial.

Yofig
02-04-2011, 04:06 AM
Oh, stop being a downer. I think this is a good way to introduce more complex motion. Nice job! :)

Cauan-XV
02-04-2011, 01:32 PM
Awesome tutorial, very helpful and full.

:star::star::star::star::star: <3

Bloblblobl
02-05-2011, 01:02 AM
Oh, stop being a downer.

I'm not being a downer. I just think that tutorials are supposed to be lengthy. I would consider this more of a tip, not a tutorial. LBPC should make a separate sub-category for tuts like these so that people looking to find simple tips or lengthy, detailed tutorials, and so the tutorial subcategory isn't cluttered with a bunch of threads saying "To make a one shot logic take a counter and set it to 1, and set the output to reset. The end" That just doesn't seem appropriate, does it?

Epicurean Dreamer
02-05-2011, 04:45 AM
I'm not being a downer. I just think that tutorials are supposed to be lengthy. I would consider this more of a tip, not a tutorial. LBPC should make a separate sub-category for tuts like these so that people looking to find simple tips or lengthy, detailed tutorials, and so the tutorial subcategory isn't cluttered with a bunch of threads saying "To make a one shot logic take a counter and set it to 1, and set the output to reset. The end" That just doesn't seem appropriate, does it?

You're still being a downer. There's a big difference between a 'tut' for a one shot switch and a time triggered guided missile with multiple phases. I believe it will be of the opinion of many that this tutorial does indeed deserve to be in the tutorial category as, simply, there 'are' many ways of doing things, some more complex and overly round-a-bout than needed, others actually quite clever. If people have figured out efficient and intelligent ways of doing things, regardless of how remedial it may seem to some, it is our responsibility as a community of fellow creators to respect and thank those that take the time to share with us their findings.

If this tutorial is so 'basic' then please by all means take the time to make a longer, more in-depth and intelligent tutorial about something more complicated, until then, i don't think you have a place to condescend meaninglessly.

NINJAsackboy
02-06-2011, 10:17 PM
this is good - but it is fairly confusing. Why not post a tutorial level?

Tamland
02-07-2011, 12:17 AM
Good tutorial!
Not the way that I'm making em but it's always fun to see how others tackle the same problems. And regarding it not being lengthy enough is not a proper argument. Short, informative and to the point is the way to go with tutorials (even though I wouldn't call your tutorial 'short').

@Blobl x2
Here is the tutorial a bit more lengthy:
Owhay otay akemay anway advancedway ominghay issilemay

Ebay uresay otay eadray ymay eviouspray uidegay irstfay otay understandway
ethay asicsbay. Erehay e'llway ebay akingmay ethay issilemay etsay away
ocklay ontoway away oundfay argettay andway ivegay ethay argettay away
ortshay imetay otay escapeway.



Ethay ainmay ifferenceday omfray ethay eviouspray uidegay isway atthay
ethay issilemay onay ongerlay aimsway orfay away ayerplay, utbay aimsway
orfay ethay ocklay objectway. Ouyay ancay eesay Iway ademay away allsmay
osshaircray outway ofway Alohay aterialmay (20%). Iway uedglay anotherway
iecepay ofway Alohay (0%) otay itway otay ebay ableway otay ickstay away
ipchay inway ethay entercay.

Insteadway ofway ickingpay ethay ayerplay asway away argettay, ouyay ancay
akemay ethay issilemay aimway orfay ateverwhay ouyay ikelay; ustjay
angechay ethay Ollowersfay onway ethay ocklay otay aimway orfay away Agtay
andway ethay Ayerplay Ensorsay onway ethay ocklay otay away Agtay
Ensorsay. Eway illway ebay usingway oneway agtay inway isthay uidegay,
oughthay, osay eepkay oneway eservedray.



Ethay issilemay erehay ashay itsway Ooklay Atway Ensorsay etsay otay
ollowfay ethay ealtay oloredcay agtay onway ethay ocklay objectway. Eway
avehay atthay agtay uckstay onway othbay ethay issilemay asway ethay
ocklay ircuitrycay, utbay atthay illway ecomebay earclay aterlay onway.

Ethay issilemay illway ogay oughthray eethray istinctday asesphay:
Yflay aroundway aimlesslyway. Ethay ocklay illway ollowfay ethay issilemay
aroundway untilway itway indsfay away argettay.
Argettay acquiredway. Ethay ocklay illway ickstay otay itsway argettay
andway ethay issilemay illway yflay owardstay ethay ocklay.
Argettay ockedlay. Ethay ocklay illway opstay ollowingfay ethay argettay
andway andstay illstay. Ethay issilemay illway impactway oonsay afterway.
Isthay isway ethay imetay atthay ethay argettay ashay otay escapeway.



Asephay 1 - Yflay aroundway aimlesslyway

Away Ayerplay Ensorsay (orway away Agtay Ensorsay orfay alternativeway
argetstay) illway initiateway asephay 2 enwhay activatesway, utbay away
OTNAY ategay ehindbay itway illway akemay uresay asephay 1 isway
iggeredtray (alsoway, otay eturnray ackbay otay asephay 1 inway ethay
areray asecay away argettay etsgay uddenlysay outway ofway angeray, orfay
instanceway ybay yingday). Ethay Ollowerfay ofway asephay 1 ackstray ethay
issile'smay agtay; etsay itway otay away eryvay ideway adiusray. Etsay
ethay inimummay angeray otay 3 orway 4 osay atthay ethay ock'slay ownway
agtay illway otnay iggertray itway.

Yingtray otay avesay agstay erehay; itway ouldway ebay away ameshay otay
avehay otay useway otway uniqueway agstay aloneway orfay isthay issilemay
. Osay, e'llway useway ethay amesay agtay andway away inimummay ensorsay
angeray.

Away Electorsay isway away eatnay ayway otay itchsway etweenbay ogiclay
asesphay ithoutway avinghay otay anuallymay esetray everythingway omfray
ethay eviouspray asephay.

Asephay 2 - Argettay acquiredway

Enwhay ethay ayerplay etsgay intoway angeray ofway ethay Ayerplay Ensorsay
, itway iggerstray asephay 2. Ethay Ollowerfay ofway asephay 2 isway ownay
asingchay ethay ayerplay atway aximummay eedspay. Alsoway, erethay isway
away allsmay Imertay etsay otay 0.1say atthay esetsray itselfway andway
usthay actsway asway away ulsarpay. Itway uelsfay away eepingbay oundsay
erehay, asway ellway asway akingmay ethay Alohay osshairscray ickerflay.

Asephay 2 alsoway etssay offway away Imertay atthay eterminesday ethay
imetay untilway ethay issilemay oesgay otay ethay extnay asephay.

Iway ustjay ealisedray Iway ademay away istakemay: ethay imertay oesday
otnay etgay esetray inway asecay ethay ystemsay eturnsray otay asephay 1;
ookinghay upway ethay asephay 1 Electorsay outputway otay ethay esetray
ofway asephay 2'say imertay ouldshay oday ustjay atthay.

Asephay 3 - Argettay ockedlay

Erethay isway onay ongerlay away Ollowerfay inway isthay asephay utbay
insteadway away implesay Overmay, etsay otay 0% eedspay, 100%
ecelerationday; isthay akesmay ethay ocklay opstay eadday inway itsway
ackstray. Anotherway ulsarpay ithway away ifferentday eepbay otay
indicateway ouryay astlay ancechay otay escapeway.

Inallyfay, ethay ocklay eedsnay otay isappearday afterway ethay issilemay
ashay estroyedday itselfway; isthay ancay ebay oneday ybay inkinglay anway
invertedway Agtay Ensorsay otay away Estroyerday. Ememberray otay etsay
ethay inimummay adiusray ofway ethay ensorsay otay 3 orway 4 otay
eventpray ethay ocklay omfray owingblay itselfway upway.

Eathday omfray ethay yskay. Enjoyway!
;)

Antikris
02-08-2011, 08:29 AM
Good tutorial!
Not the way that I'm making em but it's always fun to see how others tackle the same problems. And regarding it not being lengthy enough is not a proper argument. Short, informative and to the point is the way to go with tutorials (even though I wouldn't call your tutorial 'short').

I don't take offense in critique on the length of my article. Rather, I'd like to respond to it with my reasoning: the lengthy, complex tutorials and subsequent discussion on this forum are of incredible value to the community and really push the boundaries of what you can do with this game. However, we should not lose touch with the much larger crowd to whom much of those tutorials are still jibbajabba; I like to believe that it is short, concise concepts like a basic missile that guides confused creators to this website, where they will find so much more to learn. Getting simple concepts to work can be very empowering and inspiring. Remember how often perhaps you yourself thought: "Hey, this is a nice simple idea, let's try this out and if it works I might make a whole level out of it!"

Also, I don't like to put too much complexity into a tutorial yet because I am still learning and too unconvinced of my own capabilities in order to instruct others.

If tutorials of simple concepts are not what one is looking for, I am happy to say there are so many more members that write stuff that goes way beyond my contribution. I wholeheartedly recommend rtm223's blog (http://www.lbpcentral.com/forums/blog.php?4150-rtm223).

alexbull_uk
02-08-2011, 04:03 PM
If anyone's ever played the turn based game "Worms"; you'll know that firing a homing missile means launching it into the air (while it spins around and around) until it starts beeping, and then it locks to it's target, and flies towards it - but not entirely accurately (in a sort of arc).

I basically recreated that almost perfectly. You could even set the target in the air and get a sort of "fake gravity" effect as it spins around the target :)