Staredit Network

Staredit Network -> Concepts -> Various way to detect Speed
Report, edit, etc...Posted by fishgold on 2005-08-24 at 21:34:21
For some people who doesn't seem to know the purpose of detecting speed of particular unit, I will briefly explain why it has got so many uses for UMS maps.

Have you played 'Metal Gear Solid' series? What's the concept of this kind of game? "The Stealth Action", right? Now how the hell would you put stealth action into starcraft when there is no such thing like that. This is why detecting speed is important. It's because lots of stealth action games uses detecting speed to interact with environments in the game.



Here are more examples of stealth action games.

- Thief
- Hitman
- Rainbow Six
- Soldier of Fortune
- Splinter Cell
- Starcraft: Ghost


Now you know how this system might be useful for your map once you plan to make Stealth Action based map.

Ok, then how do we archieve this? There are various ways to detect speed. Hopefully, you should figure out the differences between each method.




Detecting Speed by Distance Traveled

This method detects unit's speed by evaluating the distance traveled in specific time. Let's say, in 1 sec, Unit A has moved from centre of Location 1 to the edge of Location 3 where Location 1 has size of 1x1 and Location 3 has size of 3x3. Then we can know that Unit A has moved distance from center of Location A and edge of Location 3 in 1 second.

(note: This method is applying the way we evaluate speed of some object in reality)



Detecting Speed by Distance Between Units

This method is slightly different from previous one. You can imagine this method as "Speed Camera". Speed Camera records the distance between car and itself, and after some interval, it again records the distance between car and itself, and then evaluate the speed. By applying this "Speed Camera", we can evaluate the incoming unit's speed towards specific object. For example, if the incoming unit is in the Location 3 and after some interval, it now is in the Location 1, then we can know distance it moved, therefore speed can be evaluated. But in order to do this, the unit who records the distance between incoming unit and itself SHOULD be stationary. Otherwise, it will miscalculate because you can not really evaluate the speed when two objects are moving and speed of them are unknown.




Detecting Speed by Comparing Coordinates

This is very similar to the first method. Only the difference is that we use new system called "Position Tracker" Position tracker basically, and literally, keeps a track of unit's position. But before we use this system we should know how to move location by 1 grid to any direction you want.

Try creating 12 Kakaru slowly. You can see Kakaru being created in different coordinates. Yes, it has got a pattern. First Kakaru will be created at the center of location and then second Kakaru will be created 1 grid to bottom from center of location. Next will be created 1 grid to right from position of second Kakaru created. And then It creates unit in anti-clockwise.

But using Kakaru isn't totally accurate. So we have to use Scourge as a first unit being spawned. And then rest of them will be Kakaru except for final unit that indicates the destination. Destination should be Observer in order to move location to the correct coordinate more easily.

Now if we know how to move location by 1 grid to any direction we want, then move 8 locations to each 8 directions. Assume that player's unit is at (64,64). If player unit go to location 'South' which is preplaced. Then subtract 1 from Y coordinate. And after some interval, calculate the difference between original coordinate and current coordinate. Original coordinate was (64,64) and current coordinate is now (64, 63). By knowing that unit has moved 1 grid, we can evaluate the speed.




Detecting Speed by Faster Units

This method is bit weird. You need units who can move faster than the unit you want to evaluate the speed of. Create 2 locations with size 1 X Map Height and Map Width X 1, but I will demonstrate only X direction. These two location will always follow player's unit. And at the side of map, create the straight pathway where Faster Units will move as player's unit moves. I'd recommend hero zealot for being a "Faster Unit". Place Zealots in this order

Owner: P9, P9, P10, P11, P11

Now if Location has any unit that is belong to P9 or P11 then zealots will move. P9 represents West and P11 represents East, and ofcourse, they will stop moving if Location has only unit belong to P10.

It's pretty easy to evaluate the speed from this point. You could set the condition like below.


If Location has 1 p10 unit then modify the player's speed to 0.

If Location has 1 P9 unit and 1 P10 unit then modify the player's speed to 1.

If Location has 2 P9 units then modify the player's speed to 2.


I hope you followed the right track to this point. smile.gif
FYI: As always, I haven't covered small things, concepts only.


Comment
Actually method 3, 4 can be used to evaluate Velocity (Direction and Speed) of unit.
Report, edit, etc...Posted by Sniper on 2005-08-24 at 22:24:13
You certainly have a lot of time to think about this stuff.
Report, edit, etc...Posted by Vibrator on 2005-08-24 at 22:40:21
Detecting speed by the distance between two units would be very difficult, and it would also require a longer time to calculate the average speed of the unit.
Report, edit, etc...Posted by l)ark_13 on 2005-08-25 at 20:39:00
Once again your concepts are impressive, but I cant seem to find any practicle use for them. Make a map showing us one of your conepts and show us how this can be used. That would explain much more.
Report, edit, etc...Posted by Vibrator on 2005-08-25 at 22:51:32
You could technically use this for a game where stealth is required. Using different size locations for people to "see" you or something like that, walking faster would use a bigger location (not a very pratical idea but you get what i am saying). I might try to do a simple one right now...

Addition: Perhaps something similar to this, although I did this quickly and it could probably be improved a lot. Although I'm not exactly sure which one of his concepts this would be in.
Report, edit, etc...Posted by SacredElf on 2005-08-26 at 18:24:25
fishgold do some amazin concepts happy.gif
Report, edit, etc...Posted by Mini Moose 2707 on 2005-08-26 at 18:49:02
Except he never posts maps. tongue.gif
Report, edit, etc...Posted by TheOddAngel on 2005-08-26 at 19:44:19
I was doing this a week ago with my map... Its practicaly the exact same thing... Anyway... Only it was used for sound and a unit in a 10x10 square from you could hear you and would move towards you...
Report, edit, etc...Posted by PCFredZ on 2005-08-27 at 09:29:47
There is an easier way to detect speed, for a single unit. This is pretty similar to Speed by Distance Traveled, but has some key differences.


Recall S.W.A.T.. In it, you hear footsteps as your character moves.

I'm assuming the footsteps are done similar to the following manner-

If P1 brings exactly 0 Marines to "Follow P1"
Move location "Follow P1" to Marine at "Anywhere"
Play wav "Step.wav"
Preserve

From this, we can change it so that, instead of playing footsteps, it adds to a Death counter. Or, you can keep the footsteps for realism, it's all good.

By comparing how much Deaths you have over a period of time, you can detect speed. Ta-da!
Report, edit, etc...Posted by Vibrator on 2005-08-27 at 09:33:56
I tried that at first, really it wasn't very effective for speeding up and slowing down.
Report, edit, etc...Posted by MapUnprotector on 2005-08-27 at 11:27:21
I use a variation of Method 1 a lot as a stamina system, the same system which PCFredZ just explained.

You basically just keep centering a location over the unit whose speed you want to keep track of, only after it leaves that location though. Each time that trigger runs you could add or subtract some kind of value to keep track of the speed as a counter.

To use it as stamina, what I do is every time the unit leaves a location you subtract from a counter, and when it has 0 you make the unit constantly move the location centered over it, halting the unit. The unit can also regain stamina for every X amount of time it stays in the location centered over it.

You can change the size of the location or how fast it recenters over the unit to modify it.

It's the same system used in SWAT that makes the footsteps.
Next Page (1)