Spring's range ring and targeting issues

Spring's range ring and targeting issues

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

Moderator: Moderators

Locked
el_matarife
Posts: 933
Joined: 27 Feb 2006, 02:04

Spring's range ring and targeting issues

Post by el_matarife »

There's a wide variety of weird issues with the range rings displayed when building or attacking with a unit in Spring.

1. When placing a building, the proper range range ring isn't called: http://springrts.com/mantis/view.php?id=1225
2. Range rings don't take into account maximum angles of fire, so if you build something on the top of a cliff, the range ring won't reflect that it is unable to shoot a the base of the cliff.
3. Range rings don't reflect terrain problems that make units unable to reach a firing solution, for instance building a Bertha too close to a hill will make you unable to fire at large portions of the map. Similar things happen when building too close to each other and not being able to fire through their hitsphere.

I'd love to see at least some of these issues be tackled. My real goal is something like the F2 "is this possible" view for movement or placing a building. Imagine a view like that for "what can these selected units fire at?", and being able to call that from a Lua widget. It'd make placing defenses or running attacks much much easier. It would also be great for Smoth's tower defense map.
YokoZar
Posts: 883
Joined: 15 Jul 2007, 22:02

Re: Spring's range ring and targeting issues

Post by YokoZar »

+1 -- showing something like this when considering where to build a defense turret is a major feature for just about every mod.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Re: Spring's range ring and targeting issues

Post by KDR_11k »

The calculation may be too hard.
User avatar
thesleepless
Posts: 417
Joined: 24 Oct 2007, 04:49

Re: Spring's range ring and targeting issues

Post by thesleepless »

i suspect it would be similar to LOS calculation, although quite a bit more intensive since LOS is straight lines and range is affected by gravity.
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Re: Spring's range ring and targeting issues

Post by Tobi »

100% accurate rings/arcs for all weapontypes is probably too hard yeah; but taking at least horizontal firing arcs into account should be possible.

Vertical firing arcs may be possible too; but this is already a lot more complex because the circle may have holes in it. E.g. from a single (possibly concave) polygon it becomes multiple polygons.

(e.g. when there is a hole in the ground, there should be a sub-circle indicating a weapon can't fire at the ground inside the hole; same with a cliff: a weapon may be able to fire a bit away from the cliff, but not directly at the bottom of it.)
el_matarife
Posts: 933
Joined: 27 Feb 2006, 02:04

Re: Spring's range ring and targeting issues

Post by el_matarife »

Well, the way I look at it is make it "calculate on demand" by hitting a key and just tell players with slower systems "don't click this". Maybe even split it out to its own thread or use OpenCL or something?
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: Spring's range ring and targeting issues

Post by Evil4Zerggin »

A real-time, exact solution for this is extremely non-trivial--it roughly represents as much work as rendering the game world a second time every frame.

If you loosen the requirements, I suppose one could try a progressive Monte Carlo simulation, where some percentage of the processor time is spent detecting the impact points of shots fired at random angles. I doubt this will be satisfactory, though, as it would probably take a long time to get a clear picture of the area covered.

The immediate, less satisfying, somewhat annoying, but functional solution, is to get Google Frog's (?) widget that places a nanoframe without building it (forget what it's called) and use FPS camera + T and/or Attack AoE. I suppose you could try to adapt Attack AoE to cover non-ballistic weapons and activate when a unit is being built, although you would need some second pointing method to specify the desired attack location, since the mouse is already taken up with placing the building. Unfortunately I CBA to do that for you =p Also note that Attack AoE does not have perfect knowledge of units' fire points; the position returned by Spring.GetUnitWeaponVectors tends to jump around, so I decided not to use it.
YokoZar
Posts: 883
Joined: 15 Jul 2007, 22:02

Re: Spring's range ring and targeting issues

Post by YokoZar »

Why not just imagine a peewee standing in a few different "tiles", and then going "could I shoot at it from here"? If yes, shade the square (or whatever unit is in it) green, if no shade it red.

We don't have to have a range ring - in fact we won't have a ring on anything involving physics and terrain.

This is basically the monte carlo simulation, except rather than pick random firing arcs we pick random targets representing things we'd actually want to shoot.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: Spring's range ring and targeting issues

Post by Evil4Zerggin »

Yeah, that's a better idea (after all the player is looking for coverage on the ground, not the results of shooting at a particular angle), and not a bad one overall, assuming you aren't going for super-high resolution. A progressive simulation is probably even within widget capability (although the implementation may be rather involved), assuming you can get the weapon position properly.
el_matarife
Posts: 933
Joined: 27 Feb 2006, 02:04

Re: Spring's range ring and targeting issues

Post by el_matarife »

And remember, for static units you'd only have to run the calculation once unless there's been some terrain deformation or another unit build nearby that may choke the firing arcs.
User avatar
Evil4Zerggin
Posts: 557
Joined: 16 May 2007, 06:34

Re: Spring's range ring and targeting issues

Post by Evil4Zerggin »

Well, you certainly wouldn't have to redo it every frame (as long as the player stays on the same buildoption and the same build position, and there are no appreciable changes in obstacles). Beyond this, however, I don't see much potential for precalculation; number of turret trajectory characteristics x number of possible build positions on the map x number of grid squares on the map is way too much to calculate even for a pregame calculation (to say nothing of terrain deformation and unit blocking), not to mention the memory needed to store the results. Even just the last two would take an unacceptably long amount of time and memory upon clicking the build button: supposing a grid square size of 64 x 64 and a map size of 16 x 16, I believe we're already looking at over 4 billion elements. Granted, not all weapons can cover a whole 16x16 map, but they are far from unheard of.

I would be wary of trying to do thousands of projectile simulations in a single frame though, even if it's not every frame--thus, a progressive simulation.
YokoZar
Posts: 883
Joined: 15 Jul 2007, 22:02

Re: Spring's range ring and targeting issues

Post by YokoZar »

Something to keep in mind is that here the player is also looking for if he can target known buildings/units in range. So in addition from shading a hypothetical peewee on a bunch of tiles, we should also consider known enemies (and shade them green or red as well).

Peewees (or whatever "default" unit) may have different targeting sweet spots than the actual units in those locations; it may be important for mods to be able to define the default targeting model for this sort of thing.
a1983
Posts: 55
Joined: 02 Dec 2009, 12:01

Re: Spring's range ring and targeting issues

Post by a1983 »

I try to do such widget, using AttackAoE, by testing every point with ballistics vectors, but has great perfomance impact. May be there are exist the better way??? Any suggestion would be apppreciate )))

Image
Attachments
AttackRange.jpg
(143.04 KiB) Downloaded 2 times
9heart
Posts: 55
Joined: 16 Sep 2010, 16:14

Re: Spring's range ring and targeting issues

Post by 9heart »

wow, which mod/UI is that? looks really nice! sorry i have nothing to contribute to discussion
User avatar
Forboding Angel
Evolution RTS Developer
Posts: 14673
Joined: 17 Nov 2005, 02:43

Re: Spring's range ring and targeting issues

Post by Forboding Angel »

Unless I'm mistaken, that would be NOTA.
Locked

Return to “Engine”