Alternative LOS method

Alternative LOS method

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

b1ind
Posts: 48
Joined: 21 Apr 2005, 04:01

Alternative LOS method

Post by b1ind » 25 Oct 2005, 02:16

With all the tweaking being done to LOS these days, I was brainstorming an alternative means of handling LOS. The disadvantage is that it would probably be more resource intensive, but not dramatically so. This new approach would reflect reality more than the current circular los.
  1. Maps would define a sort of view distance. This would be analoguous to the earth's curvature. For earth this is somewhere around 20km for the average human. This would have to be standardized to be the distance seen for a unit of a certain height.
  2. Units would define an eye-height. This would tie in with the above.
  3. Units would have a size, probably calculated by L x W x H or something.
  4. Units would have some sort of eyesight resolution tag so that units with 'sharp eyesight' could see smaller units at greater distances.
So basically, each unit has a given size. Whether or not a unit is seen is determined by the height of the observer relative to the observee, the distance between the two and the resolution of the observer's sight. Some sort of heuristic could easily be made to accomplish this.

Total distance would be: (observer height - observee height) * constant / curvature. For practicality's sake, the constant / curvature part could either be precalculated or be the value given in the map def. Also factored in here would be the units eye height relative to the ground its on.

So, first a unit must be within view distance (viewable part of map). Additionally, the observer's view resolution needs to be factored in. This would be done by some sort of simplification to avoid square roots (for absolute separation). Viewability = distance (or approximation) * constant / observee size (see #3). Thus, if viewability >= observer resolution, the unit is visible. Note that units are not necessarily viewable even if they're in the view distance.

This system would encourage dragon's eyes and such things to be built to prevent small, discrete units from slipping by half-blind metal extractors. I think it would add a really neat element to the game. At no 'extra' cost, building on top of mountains is suddenly a good idea.

You may think that this is fairly complex, but in reality it is not all that crazy. Hope someone likes this. Perhaps, if time permits, I will even attempt to do some of it myself.

Comments please!
0 x

User avatar
Maelstrom
Posts: 1950
Joined: 23 Jul 2005, 14:52

Post by Maelstrom » 25 Oct 2005, 07:30

Well, this is definatley worth trying. Dunno how it would actually work in game, but we can always test it and see.
0 x

SJ
Posts: 618
Joined: 13 Aug 2004, 17:13

Post by SJ » 25 Oct 2005, 08:55

Well if you go by that method you will either have to remove the "los" part of los (not seeing through mountains) or take a very large cpu hit.
0 x

Torrasque
Posts: 1022
Joined: 05 Oct 2004, 23:55

Post by Torrasque » 25 Oct 2005, 12:45

I like this idea, it always make really strange to not see a krogoth behind a peewee just because it's just not in sight. :?

I just want to add somes things :
  1. For point 2 and 4, why not just have one value? It will be perhaprs a bit less prescise, but very less complicated.
  2. I really doubt about the hit performance:(
  3. And the more important in my opinion : There is no way to visualise it ! It's very disturbing to not know how far we can see...but it can certainly come with experience, and reward skilled player!
0 x

Warlord Zsinj
Imperial Winter Developer
Posts: 3742
Joined: 24 Aug 2004, 08:59

Post by Warlord Zsinj » 25 Oct 2005, 16:41

I think for gameplay reasons it becomes a pain in the arse when you cannot immediately assume the LOS of your units as a constant. If the constant is variated across the board (as in, a "fog" or "night" effect obscures all the units sight), then the variability is still within ease of comprehension for a player with a million things on his mind.
However, if the standard LOS of a unit is variating according to a million different factors, LOS itself becomes a moot point, where players don't even bother thinking about it, and just take it as it comes, which sort of ruins elements of preemptive strategy.
0 x

User avatar
FizWizz
Posts: 1998
Joined: 17 Aug 2005, 11:42

Post by FizWizz » 25 Oct 2005, 16:54

It is a very cool idea, but implementing it would really change gameplay a ton.
0 x

User avatar
GrOuNd_ZeRo
Posts: 1370
Joined: 30 Apr 2005, 01:10

Post by GrOuNd_ZeRo » 25 Oct 2005, 17:27

Heh, I got an idea, forward view will be cone shaped, about 90°, could be different for every unit...the back side will be a darker colored area, the unit's hearing kinda, objects would be dots if behind a unit, so LOS would still be complete.
0 x

User avatar
AF
AI Developer
Posts: 20667
Joined: 14 Sep 2004, 11:32

Post by AF » 25 Oct 2005, 17:32

We should have a toggle in options with all these different ideas implemented, that's set to circular by default.
0 x

b1ind
Posts: 48
Joined: 21 Apr 2005, 04:01

Post by b1ind » 25 Oct 2005, 18:30

I didn't think of that part SJ. How does Spring currently go about this. I know that I've seen screens where LOS was affected by terrain features.
0 x

User avatar
FireCrack
Posts: 676
Joined: 19 Jul 2005, 09:33

Post by FireCrack » 25 Oct 2005, 19:08

I think the simplest method to implement this would simply be to add some sort of "LOS_MULTIPLIER" .smd tag.


Then units could have a "Visibility" in their tdf that determines how far into the enemies line of sight (probably not linear, sqrt function mabye) they have to be before seen.
0 x

User avatar
zwzsg
Kernel Panic Co-Developer
Posts: 7005
Joined: 16 Nov 2004, 13:08

Re: Alternative LOS method

Post by zwzsg » 25 Oct 2005, 22:30

b1ind wrote:[list=1]
[*] Units would define an eye-height. This would tie in with the above.
[*] Units would have a size, probably calculated by L x W x H or something.
[*] Units would have some sort of eyesight resolution tag so that units with 'sharp eyesight' could see smaller units at greater distances.[/list]

So basically, each unit has a given size. Whether or not a unit is seen is determined by the height of the observer relative to the observee, the distance between the two and the resolution of the observer's sight. Some sort of heuristic could easily be made to accomplish this.

Total distance would be: (observer height - observee height) * constant / curvature. For practicality's sake, the constant / curvature part could either be precalculated or be the value given in the map def. Also factored in here would be the units eye height relative to the ground its on.

So, first a unit must be within view distance (viewable part of map). Additionally, the observer's view resolution needs to be factored in. This would be done by some sort of simplification to avoid square roots (for absolute separation). Viewability = distance (or approximation) * constant / observee size (see #3). Thus, if viewability >= observer resolution, the unit is visible. Note that units are not necessarily viewable even if they're in the view distance.
Please NO!.

Spring's a game, a game that I wish to be playable and enjoyable. Having a clearly definited LOS, and being able to tell quickly if you have los or not over an area, is a really important element of gameply. Los must work in an understandable way. Having some untis with longer los, having high ground give a los bonusna, and mountain block los, are all fine, because you can still now where you have los and where you have not simply by a press of the L key, but having some undefinite los where you can see things but only if they are big enough just mean los will become some sort of random element, and that no one can use strategy based on los because no human mind would be able to understand such an overcomplex los system. Making tons of whacky overcomplex pseudo realist suggestion like that is not the way to improve Spring.
0 x

b1ind
Posts: 48
Joined: 21 Apr 2005, 04:01

Post by b1ind » 26 Oct 2005, 05:32

Making tons of whacky overcomplex pseudo realist suggestion like that is not the way to improve Spring.
Well I'd be glad to refrain from future attempts at contributing. Seriously, I see what you mean, but no need to cut my ankles out from under me. I put some thought into this and the very fact that one person appreciates it makes it worthwhile. On the other hand, if I'm going to be bashed for my time and effort, then it is not worth it. I think your unit work is great, but try and be a little more open minded to us other people trying to contribute. I'm in no way saying that this must be the way. Instead, I was proposing this in response to some people being unsatisfied with the current los system.

Edit: killed the stupid bb code trying to close my already-closed quote tag.
0 x

User avatar
FizWizz
Posts: 1998
Joined: 17 Aug 2005, 11:42

Post by FizWizz » 26 Oct 2005, 05:52

well, about a week before you posted this...
FizWizz wrote:
Pnakotus wrote:That's a good idea. It's increasingly ridiculous that units still have their 'five square' view radius, even on perfectly flat maps. Perhaps the 'fuzzy' LOS area could be quite long, to allow a K-bot to spot the HUGE PLASMA CANNON on the TOP OF A MOUNTAIN even when it's outside the view range?
That raises a very interesting concept for LOS: changing it from a distance, to what size a unit has to be for your units to see it. it'd be like
LOS=(unit-los-constant)(size of target's collision sphere)/(distance to target)
if the LOS value is over a certain number, you see the target, if not, you don't.
Higher LOS simply means your units can pick out enemies while they're smaller from you units' perspective. It could be like the resolution of their optics.
0 x

User avatar
FolCan
Posts: 190
Joined: 23 Apr 2005, 09:39

Post by FolCan » 26 Oct 2005, 07:25

THis would make level 1 units useful as they not as likely to be seen

Sounds like a good idea
0 x

User avatar
SwiftSpear
Classic Community Lead
Posts: 7287
Joined: 12 Aug 2005, 09:29

Post by SwiftSpear » 26 Oct 2005, 08:53

CPUs don't like realism, and games get difficult to understand in realistic circumstances.
0 x

User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Post by yuritch » 26 Oct 2005, 12:00

Why not make it a switch then? (set in the battleroom, if all the players agree on it). Some people may like more realistic LOS, while other may like a simpler one, and if the game can do both, it will be only better (that is if new LOS can be handled by the CPU at a reasonable speed, of course).
0 x

User avatar
SwiftSpear
Classic Community Lead
Posts: 7287
Joined: 12 Aug 2005, 09:29

Post by SwiftSpear » 26 Oct 2005, 12:12

yuritch wrote:Why not make it a switch then? (set in the battleroom, if all the players agree on it). Some people may like more realistic LOS, while other may like a simpler one, and if the game can do both, it will be only better (that is if new LOS can be handled by the CPU at a reasonable speed, of course).
Because it's alot of work, won't be CPU reasonable without even more insane ammounts of work, the feature part of it can be emulated with more excessable scripting control of the engine mechanics we will probably be getting with the new unit lua interface, and it changes balance too signifigantly from OTA standards, making mod ports impossible (due to adding new nessicary tags to all the FBI's ala "sharp eyesight") and gross (due to changing balance).
0 x

User avatar
mecha
Posts: 98
Joined: 30 Sep 2005, 09:53

Post by mecha » 28 Oct 2005, 06:08

Theres been a few ideas about how to do LOS simply before as well

http://spring.clan-sy.com/phpbb/viewtopic.php?t=2557
0 x

User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Post by Pxtl » 28 Oct 2005, 15:30

yuritch wrote:Why not make it a switch then? (set in the battleroom, if all the players agree on it). Some people may like more realistic LOS, while other may like a simpler one, and if the game can do both, it will be only better (that is if new LOS can be handled by the CPU at a reasonable speed, of course).
Which ruleset do you balance the units for? Large units become weaker with "large units are more visible" LOS rules.
0 x

User avatar
Caydr
Omnidouche
Posts: 7179
Joined: 16 Oct 2004, 19:40

Post by Caydr » 28 Oct 2005, 18:25

Exactly what zwzsg said.

Since SJ has just announced he's not going to be actively developing anymore, why don't we nag the remaining developers about things that actually matter? There's a thought. :roll:
0 x

Post Reply

Return to “Engine”