The Battlefield Gazette

What you always wanted to know about Raycasting…

In Military News on August 3, 2010 at 6:45 pm

Raycasting; a new revolutionary concept which is surrounded by many myths and questions. Some said it would be the solution to lag and physic problems but is it? Unfortunately not, we asked Tsume Xiao to enlighten us:

Titus Valerian: What exactly is Raycasting?

Tsume Xiao: Well, in simple terms, its a linear detection system, kind of like a sensor, but instead of setting the arc and radius, you set the start and end position vectors of the ray. So instead of a 3m radius bubble from a sensor, you could have a ray going from <32,25,23> to <32, 50, 23>. The scripter can then use that information for whatever purpose they want.

Titus Valerian: How will this new technology benefit to our community and where will it be used?

Tsume Xiao: Well, Many people think raycasting will end projectiles, but that isnt possible as even if you want to make, say, a raycasting sniper rifle, the weapon would still have to rez a prim of some type to actually kill the avatar. However. And I cant say these are all my thoughts, as I have talked extensively with Ethan Schuman, who teased that “Raycasting is his solution to everything”, but explosives, hovering vehicles, are two very good examples of how raycasting could help in the community. For examples, right now the most reliable and common method of explosives in the LL Damage combat is a sensor that rezzes a killprim. However, A sensor will only detect what you tell it to, in the case of explosives, an avatar. A sensor wont know if that avatar may be behind a 3m brick wall and the 5m grenade hit it on the other side. The grenade would still kill him or her. Now, I am a glutton for realism. I despise grenades over 5m, as the standard IRL grenades have a fatality radius of 5m (US issue M69 for example), I hate grenades and 40mm underslung rounds that damage tanks, etc… So raycasting can make explosives, especially grenades, more realistic, and more importantly for others, more fair. With llCastRay, you can set the ray to detect even walls, and avatar. And a ray will detect everything in its path, and report them in order of detection. So that same scenario with the AV and the wall. The ray would return WALL and then AVATAR. You could then use that information to have the grenade rez the killprim or not. If the Avatar is not the first thing the ray detects, then dont rez the kill prim. So the basics of how a CastRay explosion would work, is llSensor to find avatar that might be killed, then llCastRay from the epicenter of the explosion to the llDetectedPos of the avatar, and then if there is no prims between it, killit.

Titus Valerian: Thank you Tsume, so the concept of raycasting is pretty new, do we know who the pioneers in this field are?

Tsume Xiao: I heard Nexii Maltus was on of them for our community. I first heard about it when Ethan Schuman came into Ordo ventrillo going on excitedly as he does when he makes a discovery he thinks can have a large impact. Basically something like “Guys! You arent going to believe this! There is this new thing that is going to change combat as we know it forever!” Sometimes what he goes on about is nothing, sometimes it has a small, interesting change (an example is the Titan Industries Titan Wield system. Its a simple concept he thought up that, while not revolutionary, is quite unique and useful). So him going on excitedly about it on the Ordo Imperialis Ventrillo server would be the first I heard of it. That was a long time ago, before llCastRay was even implemented in any form, and was just a concept.

Titus Valerian: Thank you Tsume, do you believe that it is important to share such technology with the rest of the community?

Tsume Xiao: Yes! Without collaboration in the community this will not go far. Again the grenade example. Especailly in militaries, when people are constantly trying to one up everyone in deadlyness. If one military changes to rey-cast explosives that recognize cover, they will be at a disadvantage becuase their grenades will be less deadly because they dont kill through walls. If we want it to take effect, we have to involve all militaries and developers, Allied, Neutral, hostile, whatever, and develop this without selfishly thinking of our own personaly alliance. We must think of the community benefit as a whole. This is, again,  another thing Ethan does alot. He is currently working on a aircraft project that would be placed in the HUB’s oc military sim’s and give attackers a free, one time use aircraft to fight with. Like those jetski rezzers you see on random beaches. Thats the kind of collaboration we need, though it may be harder with raycasting, as raycasting is a much more involved system with a greater potential to change, rather than a simple “Hey lets place this rezzer for attackers” (which is still a good idea, dont get me wrong)

Titus Valerian: Is there any raycasting technology already in use by people from our community?

Tsume Xiao: I would guess probably not, or in such small use its to be considered a testing rather than a use. I know Nexii Malthus of the Mercz was experimenting with it to some extent, dont know where it went too, and I recall hearing that Leia Mercy of Vox Aeron was experimenting with it. But I think she was trying it with rifles, which is not the real use they will have.

Titus Valerian: Thank you for answering all my questions Tsume, have a nice day!

In conclusion many things could be achieved through raycasting but how can we encourage everyone to use the technology once it has become widely available? Unfortunately we can not and only time shall tell…

– Titus Valerian

  1. Back in the day is used way to much.
    Though, the good times were good.


    Also, the first time I heard about it in secondlife was Vertical Life, as vertical life has it built in clientside. Nexii = pretty awesome.

  3. Unfortunately, we asked Tsume Xiao to enlighten us.

  4. >> a8

    Tsume is fine. Though to be honest I still would’ve preferred Nexii though, partially because I know him more, but mostly because I know that Nexii has great experience with raycasting and actually made a clientside version way before it even was suggest it would be a function.

  5. The llCastRay function is not implemented yet, so I don’t have a working sample in the sense that you can throw it in a box and have it go.

    As for lag caused by it, I’m honestly not sure. Again, haven’t been able to test it.

    I could write the code, but it would not function.
    The problem I see with wide-spread adoption is that you would be technically asking people to make their weapons “weaker”. That is the main battle that must be fought with explosives, as I know many people who would rather just have things kill, cover or not.

    As for the old AN explosions with moving killprims: Old explosions would often spew out lots of fragments in the direction of a avatar, or rez prims that would use active sensors to follow the avatar. These are both more intensive than the simple rez method employed by most explosives now, but for explosives larger than 10m in radius, the long range killprims must still be used.

  6. Next time there’s an article on scripting, can you please ask someone who knows about scripting?

  7. Raycasting isn’t new…

    Doom 95 used raycasting.

  8. Lol, fucking Thunderjew <3.

    Yes, I've been excited about the concept of raycasting since waaaaaay back when Vertical Sim was still being worked on and Nexii explained what it is to me. Since there was no way to accomplish or emulate it effectively via LSL, Nexii decided he would integrate it into the client, along with other cool toys that never get used (which have since been taken out since the Vertical Sim project is going nowhere without a sim) into Vertical Life 1.5.5, and later into 1.5.8. The first really noticeable experiment involving it was a sniper rifle Nexii made that was an instant hit (Tsume will argue here that it takes time for the killprim to WarpPos to the target, but that delay is about as long as it takes you to blink your eye.), however it was far from the last. There were other ventures based around raycasting, but the one that sticks out in my mind the most is a spider mech Nexii made that can crawl over prims and land. That's just fucking cool. Nexii also made it possible for objects, regardless of owner, to use raycasting if a single Vertical Life client was present in the sim. That was a clever idea.

    It should be noted, however, that Vertical Life raycasting is processed entirely client side, so it has no effect on sim lag other than the data relay which is handled via chat. Vox Aeron also came up with a way to make use of raycasting and put it into rifles which were actually issued, so kudos to Leia, but I don't know how theirs worked. CastRay, on the other hand, will be processed server side, so there will definitely be resource consumption. How extensive that will be is unknown at this time, as we have no idea how (or even if) CastRay will hit the main grid.

    In all likelihood, raycast small arms will be very limited special purpose weapons, like bolt action sniper rifles, laser guided rockets like the ones from Half Life would be fun (though they can be done now in a more clunky manner), and MAYBE multipurpose rifles that automatically lower their velocity based on detected range, but that's not really practical. There MIGHT be potential for raycast to simulate weapons with a velocity above 255mps, or to simulate bullet flight path at a certain velocity without actually rezzing one, but we'd have to sit down and figure out an efficient way to do that. It would likely involve staggered raycast calls for different ranges (<25m would trigger instantly, 26-100, etc) which would also allow us to set a maximum range on our weapons. Flamethrowers and melee weapons will also benefit greatly, and become practical. Also, I haven't tested prim penetration in Havok 7 yet, but if it's still a huge problem, raycasting could also be used to specify an "end point" at which the bullet would stop on its own, and not pierce through. That would likely be pretty resource intensive as well, however.

    As Tsume mentioned, what will probably benefit the most are explosives, and vehicles. Finally, hovertanks will be practical, as will jetbikes (Ordo's Velox might actually become useful), drop pods that slow their descent based on how close to an object they are (as falling in Havok 7 actually hurts), Nexii's spider mechs (NO, PROTEUS! NO WALKING KREMLIN!) and a whole other host of creative ideas that the community will no doubt come up with. Also, with raycasting, we may find new munition types becoming available. I've wanted to do surface skimming torpedoes like the ones in Gradius for ages.

    Then there are other applications. The most significant of these, I feel, is the advancements in artificial intelligence that can be made. With drones/bots actually being able to see where they're going and define what they're looking at, this opens up a whole new frontier for the development of automated systems. Maybe someone will even sit down and create an application to randomly generate training areas based upon available space. We'll have to be careful how we make use of this, though. "Beacon" bullets will no longer be required. Raycasting can quickly and reliably designate points without having to deal with physics and collisions and all that other crap.

    There are many more applications for raycasting, but not all of them are positive, and I don't want to inspire anyone to engage in such activities.

    • “Tsume will argue here that it takes time for the killprim to WarpPos to the target, but that delay is about as long as it takes you to blink your eye.”

      In heavy lag it will have a noticeable delay. Its still bound to physics and lag for its movement.

      The biggest use of raycasting in “combat” to replace projectiles would be in HUD based combat that could use llCastRay to determine a hit and then do a region say to the HUD of the victim so they lost a corresponding amount of HP.

      But that’s not Linden Damage, so not too relevant.

  9. If you want to test in-world raycasting, just log into the beta grid and TP to Vox.

    You can see it in live action over there.

  10. I cant take full credit. There are many developers who have been working much more extensively than me and on a much wider variety of topics. My main focus is explosives and other more strictly military applications, and many of the ideas were developed from the more crazy Ideas that were mentioned during conversations of Ethan Schuman

    And as for being a critic of my work, critics aren’t a bad thing. Constructive criticism is one of the best ways to help people improve.

  11. Agreed with A8 for once.

  12. mind you im not a scriptor but this has given mea few good ideas for fleetship weapons and functions as well. Ethan has a good point about drones too, that could be exciting.

  13. Played with this stuff the day it was out on the beta grid; I can endorse Tsumes statements here. I will say that I don’t necessarily agree with things like adding raycasting for each agent in an explosion (mostly because current AN arms philosophy involves small ones with negligible penetration anyway). To answer your query Ethan: it’s a component of H7, and so will place stress primarily on the physics engine; although there is, of course, script cost as well, it’s very cheap.

    Most of the commentary revolving around the idea that it’s unsuitable for linden damage applications is taking the idea out of context. Of course it’s not useful on a per-shot basis; the moment we have an “llKillTheGuyUnderMyCrosshairsImmediately” function (think megaprims but invisible; wizards did it), combat will turn into a game of who can squeeze in the most cheap kills before they get banned (speaking from the perspective of someone who dislikes the concept; we’ve already decided that we won’t be exploring raycasting in small arms any further than I already have on the llCastRay talk page: ).

    Agreeing with Ethan here, of course; the most interesting applications of the function will be in support roles; script awareness of the environment. The largest hurdle we’ve ever faced as scripters is nothing more than simply knowing how far it is to that prim under our feet in a reliable time with reasonable accuracy. 🙂

    If that’s not enough for a8, they have nothing but insults to input anyway.

    • I actually fully agree with you, I’m simply gawking at the concept of Ordo’s already 10m grenades getting even bigger or… smart… and scripting every agent for even more ‘kill capacity’. Honestly I hate explosions (esp. impact grenades) as they remove the tiny bit of ‘skill’ involved in combat.

      as for insults, well, Tsume is as wide as he is tall.

      • They Ordo Grenades have not changed in a long time, and there is no plan to change them from what I have heard. They are 7m, and I dont like them, endorse them, or use them in combat. I use my own grenades from my company that are 5m radius M61’s (The IRL Grenade they are modeled after).

  14. So why not change the grenade? Why pick a silly number that’s between ‘stupid huge’ and ‘max allowed in this sim’?

    House Rules is a great system, especially when you use it to give the defenders an even bigger advantage.

    • I did not script the HUD. And last I checked 10m explosives are allowed on titan, just in limited form. I have talked to people about changing the grenades to 5m, but that’s all I can do I am afraid.

  15. Funny… a8 claimed he was Ordo in comments a few articles back, but it’s known among all our troops that our grenades are 7m, and have been for a very long time. Then again, it’s not like he/she/it ever has anything to add to conversations other than BAAAW and pathetic failures of attempts to troll.

    Now, to the topic relevant part of my post:
    Those of you who have been keeping track of, or went to read, the link Jeremy provided in his post will see a rather large discussion regarding the concept. The biggest issue facing the implementation of raycasting (and maybe if we’re lucky, spherecasting as well) is how information will be processed. We don’t know how rays will behave (what parameters we’ll have to specify other than origin and end), which basically means what they’ll detect, what they’ll ignore, and what parameters (if any) they will pass to the object/avatar they hit. I will highlight some of the more important notes relating to us below.

    We DO know that rays will ignore the object they originate inside/from, but we don’t know how they’ll pick up keys from linksets. We also do know that, for now, raycasting will be intrasim only. There may be an intersim version implemented later, but how LL intends to do that (be it a “version number” parameter or a seperate function entirely) or if is entirely unknown.

    There seems to be a universal agreement that an event handler for a raycast hit is necessary, but it is just a concept at the moment. The current discussion is trending toward passing an integer parameter (like how rezzing and on_rez work), but I don’t know if that will stick. Rezzing is a rather simple concept. Even basic raycasting has the potential to pass a LOT of data, so I’m personally hoping for a string parameter as well. This is not all that unlikely, considering the amount of utility it would provide for all sorts of applications… well, in just about ANY application. It’s not the end of the world if such an event isn’t implemented however, as RegionSay could be used (though any object that would want to interface would have to have an agreed upon channel and communication standard, which given the chaotic nature of our community’s technology regulation, would be utter hell), but let’s hope for the event approach.

    The concept of raycasting small arms is something on everyone’s mind, regardless of how unlikely it is that they will see widespread use. This potential has been addressed in the discussion, with the thought of a separate raycast function that deals damage directly. Alternatively, an llApplyDamage(integer damage) function was thrown out there, with the added ability to pass a negative value to INCREASE health (if we could combine that with the ability to turn off HP regen, combat could change radically) which would actually be the method I would prefer to see (even if it would mean us all sitting around a goddamned table for three fucking hours taking turns to raise our hands and talk 9730943 times before we finally agreed that Luca Vasilopita can reload his weapon in 3.2 seconds).

    If we were going to move to raycast weapons, we would likely factor in things like effective range, damage, accuracy, and whatever else. However, doing so would require a complete departure from our current style of combat, and I really don’t think anybody wants to even think about that.

    As a final note, check out what Moy did.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: