MoveInAStraightLine

MoveInAStraightLine

Requests for features in the spring code.

Moderator: Moderators

Post Reply
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

MoveInAStraightLine

Post by Argh »

Boolean. If 0, then Units would no longer attempt to find the most efficient path, and would just try to go straight to the waypoint.

Why do I want this?

A. It would save a lot on efficiency for World Builder objects.

B. It would mean that I have to give them a lot fewer Patrol points to keep them on roads. Even when the terrain is absolutely flat, units tend to jitter a lot, and with a road, the results are less than ideal- units crashing through trees, etc. Forcing them to stick to the straight-line path between waypoints (i.e., assuming that a human has given them valid instructions) would a very useful thing for this.

Sorry, I know that this is rather special-case, but the alternatives are pretty ugly. I had to lay out about 20 waypoints on a Patrol path just to get a vehicle to drive down a long section of straight, flat road, turn around and come back without going off the road. Even then, it wiggled a lot, and looked pretty unprofessional.

It doesn't matter with regular units, where player movement orders are really arbitrary, but for stock props, it's essential that we have something that allows for more constrained movement design, imo.
Last edited by Argh on 11 Dec 2008, 01:49, edited 1 time in total.
User avatar
jcnossen
Former Engine Dev
Posts: 2440
Joined: 05 Jun 2005, 19:13

Re: PathFindEfficiently

Post by jcnossen »

Making it possible to code your own pathfinding in lua would be a better implementation IMO.
PathFindEfficiently sounds kinda weird, as if the standard procedure is to path find inefficiently...
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: PathFindEfficiently

Post by Argh »

I don't think I have time to implement that- just designing a waypoint-following system would take quite awhile. I wouldn't even know where to start to develop that, frankly.

And it would still have to deal with height constraints, for situations where roads climb hills, turning, etc.- it'd be very hard to get it working nicely. I was just thinking that turning that portion of the pathfinder off might be easy, but meh, it's probably a scary mess. I know I'm asking a lot for something that's basically just visual tinsel :P

As an alternative idea, if I could do manipulation of the TypeMap via Lua, I could make roads very "attractive" to certain Units. That might be another useful way to go about this.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Re: PathFindEfficiently

Post by imbaczek »

i can see the use case, but the name doesn't describe it. path finding is already pretty efficient for what it has to do, if not entirely correct. what you want is more like MoveInAStraightLine.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: PathFindEfficiently

Post by Argh »

Or ObeyYourWayPoints. Heh. You're right, Lemme change that title, it's confusing.

I just tried out a "traffic pattern", and it was totally pathetic. Units driving off-road at the drop of a hat, collisions because they're off their designated path, etc., etc., etc.

I really don't want the "future" depicted with World Builder to only have flying cars, but meh, it may be the only way to not have this look really bad right now.
User avatar
Peet
Malcontent
Posts: 4383
Joined: 27 Feb 2006, 22:04

Re: MoveInAStraightLine

Post by Peet »

For that issue, why not simply create a path for the vehicles to take in world builder, and then use movectrl ingame to move them around?
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: MoveInAStraightLine

Post by Pxtl »

MoveCtrl every single unit in a traffic pattern might be a little too resource intensive, and plus Argh would have to manually handle collisions. Perhaps autogenerating jillions of little waypoints would work best - maybe you just need a widget that lets you draw lines of waypoints?

Alternately, typemap the roads and road-driving units so that they won't drive off-road ever.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: MoveInAStraightLine

Post by Argh »

For that issue, why not simply create a path for the vehicles to take in world builder, and then use movectrl ingame to move them around?
Well, the short answer is, "it's too big of a project for me right now".

It'd be pretty much building a second pathfinder, and that's not an area of computer science I really feel like messing with, tbh. Not an area I'm comfortable with, and I would probably waste a month- and I don't have that kind of time to waste right now.
Perhaps autogenerating jillions of little waypoints would work best - maybe you just need a widget that lets you draw lines of waypoints?
I've been finding that even if I lay them out very tightly by hand, units wiggle a lot more than I need them to. I really don't mind having to do this by hand, especially if it was behaving as requested- then you'd just have waypoints at points in the road where cars would turn, trains go around a curve, etc., etc. (yes, I said, "trains", because that's one thing that's not very practical until something like this exists).

The way that it currently works, not only does it not perform very well, but it's very CPU-intensive- large numbers of waypoints is bad news. And because of the "lazy" system, where waypoints use multiple LODs for nearby, midpoint, and strategic goals, wandering is pretty much par for the course, on a map that isn't absolutely flat everywhere (and even then, I suspect that some wandering would occur).
Alternately, typemap the roads and road-driving units so that they won't drive off-road ever.
The catch with that is that you cannot manipulate the typemap with Lua (which shouldn't be terribly hard to add to Spring, I would think- it's not a whole lot different than heightmap manipulation), and since the roads in World Builder maps are created after the map file is... well, I could remove that feature, which I regard as downright vital to the whole goal of the project... or I could make a feature request and hope that the engine will do what I actually need it to do.

Pretty easy call, tbh. Until a solution exists, I'll stick to the current program.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: MoveInAStraightLine

Post by yuritch »

You said trains? Interesting... (as in I have a number of armored train parts modeled, but no good way to use them for S'44). Trains would need another feature, too - the one that prevents them from turning. So not only should the pathfinder return a straight path, they shouldn't attempt to turn from it even if that path gets blocked (which isn't easy to do with regular Spring units). Of course MoveCtrl can do that, but some kind of more general system for things that can only move along whatever (roads, rails, etc.) would be better imo.
ZellSF
Posts: 1187
Joined: 08 Jul 2006, 19:07

Re: MoveInAStraightLine

Post by ZellSF »

As requested earlier, I think players should be able to ask units to do this too. The sometimes random behavior of the pathfinder can get annoying (amphibs avoid moving up and down shores and prefer moving on land, despite their move location being a straight line across the water...)
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Re: MoveInAStraightLine

Post by lurker »

Cloaked gremlin tanks coming off of shores to run into llts...
User avatar
aegis
Posts: 2456
Joined: 11 Jul 2007, 17:47

Re: MoveInAStraightLine

Post by aegis »

use a lua widget to define the roads, then generate the next waypoint at intervals of the vehicle driving along it if the vehicle chooses to "drive on this this road"
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Re: MoveInAStraightLine

Post by Argh »

then generate the next waypoint at intervals of the vehicle driving along it if the vehicle chooses to "drive on this this road"
That would not solve the real problem. It's that the pathfinder's silly. Trust me, even if you set up waypoints very close together, it frequently swerves and wiggles when there's no good reason that I can see, even on ground that's practically true-flat.

I'd call it a bug with the near-term steering code that's making it try a little too hard to find the perfect near-term path, but I'm probably wrong.
Post Reply

Return to “Feature Requests”