Log in

View Full Version : Zig Zags [TEC] [WIP]


tater
12-28-07, 02:44 PM
In SH, we are used to seeing either NO zig zags (ZZs from now on)---utterly unrealistic, stuns me that this
wasn't in the base engine, far more important to realism than more types of ships, for example---or in TM/ICL
and RSRD, ZZs like this:

http://www3.mediafire.com/imgbnc.php/a9848ba177bdea2029eed2bfb70288076g.jpg (http://www.mediafire.com/imageview.php?quickkey=azxsyivtwkt&thumb=4)

In real life, however, the type that lurker and I use are not completely realistic. Far far better than no ZZs,
but not what was always used. In RL, the japanese used ZZs like this:

http://www1.mediafire.com/imgbnc.php/32b35bdeb465bc8c69da57ccc39f5d976g.jpg

http://www3.mediafire.com/imgbnc.php/97bc5dfb8bc7290b31794344ef3f73bd6g.jpg

This is pretty complicated to replicate... but not at all impossible (not impossible with Mcoca's incredible
Automated Campaign Editor (ACE)---and his help showing me how to code it, that is).



ZZ type A:
http://www3.mediafire.com/imgbnc.php/cdc4346cf665b962b7e1d5a6d3c692d86g.jpg (http://www.mediafire.com/imageview.php?quickkey=cjhvbpvcbj0&thumb=4)

ZZ type E
http://www2.mediafire.com/imgbnc.php/6d3ba6c5e1c8b6cae27bde3712ed8a886g.jpg (http://www.mediafire.com/imageview.php?quickkey=6bchhthwv63&thumb=4)

ZZ type G:
http://www3.mediafire.com/imgbnc.php/c869513e01db6959ec92d8b64be7bb906g.jpg (http://www.mediafire.com/imageview.php?quickkey=cmnyaaygnyj&thumb=4)

ZZ type K
http://www1.mediafire.com/imgbnc.php/3dc99a7383e64f9b35d7666ed26935ef6g.jpg



This technique will work for isolated groups since it creates a truely frightening number of waypoints compared to the
method used up to this point. In my ICL campaign (and RSRD as well), typical groups might have 500-2000 waypoints.
Using this method, that would change to 3000 to 15,000 waypoints per group. This is because the timescales are
historical (5, 10, and 15 minute legs). I actually had overflow errors trying to run the ACE with more than a couple groups
in a mission.

Because of the limitations, I could see altering the historical time scales such that the patterns are larger, which would
result in fewer waypoints, while retaining the historical shapes. Another possibility is to have the complex, short time scale
patterns only occur in areas of particular danger. Presently, I'm using it for isolated groups only since every group I ZZ
this way equals ~10 normal groups worth of waypoints. One other mitigating factor is likely the year. I'd expect that early
convoys didn't ZZ on the same short time scales.

I have also now created a couple made up patterns that are closer to the time scale of the current patterns used in
ICL/RSRD, but have some of the feel of the historical versions.

More as I play with it.

tater

DrBeast
12-28-07, 02:50 PM
Wow...that could create a truly daunting gaming experience for us. Keep it up! :up:

AVGWarhawk
12-28-07, 02:56 PM
Tater,

You come up with some of the coolest things. I'm very interested in the outcome:yep:

tater
12-28-07, 03:05 PM
Note that all the in editor ZZ screen shots are at the same scale.

Hard to hit stuff ZZing every 5 minutes, lol.

Note that the exact shapes will vary in terms of how stretched out they are based upon speed. Since they used time, not length, if the ships are moving slow, the pattern is squished (my type E above is a slow group), but if they are making 20 knots, it will spread out. That also means this technique might be better suited for fast groups for many of the patterns (fewer waypoints).

Snuffy
12-28-07, 03:09 PM
Excellent Tater.

I can only imagine the havoc caused when different ships within the same flotilla use different zz's! :oops:

Could be way cool!

tater
12-28-07, 03:33 PM
Excellent Tater.

I can only imagine the havoc caused when different ships within the same flotilla use different zz's! :oops:

Could be way cool!

That would not happen. The GROUPS zig zag, not the individual ships. So they turn in formation.

Wilcke
12-28-07, 03:52 PM
LOL, you are making this scary real! How am I supposed to get a solution on a wiggly thing like that!:nope:

Keep up the good work! I like it....:up:

tater
12-28-07, 04:04 PM
It still shocks me that some kind of organic zig zag coding wasn't built in. Virtually all ships/convoys ZZed in RL. The complex patterns date to WW1. You simply cannot have a realistic campaign without them, boggles the mind how it could be overlooked.

Wilcke
12-28-07, 04:33 PM
It still shocks me that some kind of organic zig zag coding wasn't built in. Virtually all ships/convoys ZZed in RL. The complex patterns date to WW1. You simply cannot have a realistic campaign without them, boggles the mind how it could be overlooked.

Time must have been of the essence for the devs....but you are correct its all in the details.

As I stated above the more realistic the better.

Snuffy
12-28-07, 04:39 PM
That would not happen. The GROUPS zig zag, not the individual ships. So they turn in formation.

Well that just sucks. It'll make it too easy then ... :yep:

tater
12-28-07, 04:43 PM
If every ship ZZed with a different pattern they'd collide. Turning as a group is what would happen in RL.

The reason it was time based is so that they'd all know when to turn. top of the hour, base course. 10 minutes later, turn 30 degrees right. 10 after, turn 20 degrees left, and so forth.

Once detected, the ships will still constant helm at the same time they follow the ZZ pattern (unless they elect to scatter).

If I could wave a magic wand and "fix" the game engine regarding ZZs, I would have a file that contains various ZZ types, and a pull down under each waypoint's properties for what pattern the group would use. The file containing the ZZ types could be formulaic. Step, time, and base heading offset.

Oh well.

castorp345
12-28-07, 08:27 PM
:o

that's excellent work, tater!

you, sir, are a true gentleman and scholar. :know:

weiter so!!

hc

ReallyDedPoet
12-28-07, 08:37 PM
Real nice work here tater :yep::up:


RDP

Der Teddy Bar
12-28-07, 08:46 PM
Way cool stuff as usual.

If I may be so bold :lol: adding the odd loop to way point would really go a long way to randomizing the ZZ so that a player might still end up in the wrong position.

tater
12-28-07, 10:07 PM
Oh yeah, I always add odd loops. Helmsman drifts off to sleep at 15 past on a merchant, etc ;)

Typically, I also like to use alternate paths. With this technique it's a little more complex since the waypoint count can get scary. Say the group takes 5 short waypoints to leave port and get to open water. Then 5 to get into port on the other end. I might make waypoint 6 off to the side a little, and have 5 loop to 7. I can then add a whole new path between 5 and 6 by adding waypoints, then ZZ those in another pattern.

BTW, with the automated editor, you could go back and add a random loop for every waypoint if you wanted.

Take each waypoint and give it a loop % of some small value like 1%, and have it loop to the waypoint at current.waypoint + a random number.

clayp
12-29-07, 12:11 AM
Oh yeah, I always add odd loops. Helmsman drifts off to sleep at 15 past on a merchant, etc ;)

Typically, I also like to use alternate paths. With this technique it's a little more complex since the waypoint count can get scary. Say the group takes 5 short waypoints to leave port and get to open water. Then 5 to get into port on the other end. I might make waypoint 6 off to the side a little, and have 5 loop to 7. I can then add a whole new path between 5 and 6 by adding waypoints, then ZZ those in another pattern.

BTW, with the automated editor, you could go back and add a random loop for every waypoint if you wanted.

Take each waypoint and give it a loop % of some small value like 1%, and have it loop to the waypoint at current.waypoint + a random number.


Is useing the editor the only way you can do it?

tater
12-29-07, 01:47 AM
You can do it by hand, too. Using the stock mission editor. But with 10,000 waypoints per group, that might get... tedious.

joegrundman
12-29-07, 02:30 AM
just fantastic:D

I've been wanting to use those torpedo fire plans for zigzagging convoys written about in the Submarine torpedo fire control manual for ages, and now looks like I can :)

Great work!

DrBeast
12-29-07, 08:13 AM
I'm an owner of a pretty old machine, so I wonder if this will have an impact on performance...? :hmm:

Digital_Trucker
12-29-07, 09:55 AM
I'm an owner of a pretty old machine, so I wonder if this will have an impact on performance...? :hmm:

I'm in the same boat (so to speak) and was pondering the same question. I think I know the answer and it's probably not one we're gonna like.:damn:

DrBeast
12-29-07, 10:06 AM
I'm an owner of a pretty old machine, so I wonder if this will have an impact on performance...? :hmm:

I'm in the same boat (so to speak) and was pondering the same question. I think I know the answer and it's probably not one we're gonna like.:damn:

I read you...to quote a famous Jedi, "I have a bad feeling about this" :hmm:

tater
12-29-07, 10:08 AM
There is already zig-zagging in TM and in RSRD. Variable legs, variable speeds, etc. The short time scale stuff is certainly more effective, though, particularly at higher speeds. I remember reading, I think in Silent Running, about an attack on a convoy that was zig-zagging on 2 minute legs.

As for how it impacts your computer... good question. I need to put together a layer with more than a couple in it.

Peto
12-29-07, 06:25 PM
This is Great Stuff tater :up:!!! I've been working on a new campaign for about a month now (just about done up to 44 at this point) and I'd really like to incorporate something like this.

Main potential issues I see are:

1. Overloading the computer (as you already mentioned)

2. Convoys becoming Very scattered because of the way they "view" their station/position. (When a course change for the convoy happens, they dash more individually than as a group to get to their allocated station).

3. The larger the convoy/TF, the more likely that ships will be mulling about and acting "lost".

These are things I'm sure you're already aware of.

Question: Will these types of patterns work with Random Groups and Scripted Groups? I plan to have a lot of scripted convoys when my campaign is done...

Again--Great Work! You continue to impress :yep:!

:rock:

tater
12-29-07, 06:56 PM
Scripted groups have issues, frankly. Lurker's method of using pseudo-random groups is superior, I think. That said, the staion keeping is indeed an issue. I had a random group generate its own spacing of 589 with 3 rows. I left it that way to test. They became a little mixed up just doing the ZZ pattern, but were still a coherent group. Once I attacked, it got really messy. The AI prevented them from crashing into each other, but man, were they a mess.

I need to test for ideal ship spacings, I would expect that any larger sized group should have more maneuver room for ships once they try and ZZ plus constant helming. Maybe 1000m or so.

tater
12-29-07, 07:00 PM
One thing I need to test is how long it takes them to settle down on a new heading.

Think I will make a test mission pre-war so I can run with them on the surface and watch. If they barely get settled at 5 minutes, perhaps for the sake of the game engine, I might up all the leg times by 1.5. So a 5 minute leg becomes 7.5 minutes, 10 becomes 15, and so forth. That alone might solve issues with convoys in closer spacing.

Peto
12-29-07, 07:13 PM
I've been checking some of this type of data for the past couple weeks. My findings are rather general as I didn't actually time how long it takes to reform a convoy which scatters from a course change (no sub attack involved).

The larger the spacing, the longer it takes to regroup as the individual ships "think" they have farther to travel to attain their proper station. 3 columns with a speed of ~9 knots/1200 spacing took a good 15 minutes to regroup after a 30-40 degree course change. Some ships actually swung out of the convoy and had to catch up from well astern (not all bad--fast stragglers LOL). Personally, I don't like the auto spacing the campaigns use because the columns should be farther apart (I've read of convoys using 4000 yards between columns) and ships in a single column typically tried to stay closer--usually following about 600 yards behind the ship in front of it. Oh well--can't change that :hmm:!

The formations that hold together the best are the single columns. They have less distance to go. I think the most important factor is speed. If a ship can go about 3 knots faster than the convoy's speed, they can reorganize faster.

I plan on running a couple tests in the next couple days. I'll "try" to watch/gather better info for you. But it's kind of luck of the draw as to what I encounter in my testing...

tater
12-29-07, 10:01 PM
Useful to know. I agree that the "AI" spacing in random groups is less that ideal. Heck, I wish I could determine the ORDER of ships in a random group somehow. It seems to always put them with the large ships on one side and forward, smaller ships to the back.

Personally, I tend to use wider spacings for the most part.

tater

Peto
12-30-07, 03:15 AM
Agreed. I've never been able to determine a consistent pattern to how random groups place ships in a convoy or TF. I also tend to use large spacing for groups although it tends to make them a tad more apoplectic when they're ZZing ;).

EDIT: I have found radar and map updates on to be very usefull for watching formations change course and reorganize after ZZs. They seem to hold position better in excelerated time (64X plus) than in RT. At high time exceleration the formation just "snaps" to the new course.

Peto
12-31-07, 01:28 AM
Tested a part of one of my scripted invasion forces tonight.

Lingayen Gulf Invasion: Currently 60 ships in 5 groups (should be about 80 when done). Main group consists of 38 ships deployed in 7 columns (1000 yards between), 4 ships per column (500-700 yards between ships), 6 close escorts (within 2000 yards of main body) and 4 advance escorts (about 10K yards out from main body). This group seems to station keep very well on a 30 degree turn. I made sure that each ship would have about 3 knot top speed more than the set convoy speed. A similar sized formation using similar speeds has more trouble when it is a "random" group--I think because the gap between ships in column is so large (call it 1000-same as distance between columns).

The reason it works this way (I think) is because when a formation reaches a waypoint all ships recalculate where they need to be. With the 1000 yard spacing between ships in column, it actually means that some of the ships have to make a radical course change to reach their new position. They will actually turn away from the new course to achieve their new station. This results in chaos--at least for a few minutes. Shorter Columns seem to make station-keeping easier. So far anyway :hmm:.

No idea how to smooth random groups ZZ without ensuring small degree turns and allowing time for them to regroup after each turn. I'd say 10 minutes at least for a 3 column formation.

Note: Timing the simultaneous arrival of 5 seperate groups to meet at one place is just a bit on the challenging side. Now I just have to get a couple escorts to peel off at the right place to set up patrollong at the entrance to Lingayen Gulf. That should be pretty easy though. The next step is to set up "the next couple days". Anchored ships, "empty" ships moving back out in small convoys and harbor patrols that try to keep anyone trying to break into the Gulf on their toes. Played part one and took a righteous beating :shifty:. Looking forward to setting up/testing Part II :yep:.

tater
12-31-07, 11:23 AM
Yeah, I've seen similar issues. The reason it is not so terribly pronounced in current ZZing campaigns is that the legs are long enough that the player is unlikely to see any up close, lol.

The problem, of course, is that in RL you should be seeing ZZs on short time scales, otherwise what's the point?

I will test line astern groups next. Might be that the short time frame ZZs are only appropriate for task forces and smaller groups of faster merchants.

I designated a few convoys as fast convoys, and certainly many of the troop transports are faster liners. Such ships could move at high speed for merchants (~15 knots) and still have plenty of excess capacity for station keeping. Warships, OTOH, can easily have twice the possible speed they would cruise at, so station keeping for them should be straight forward.

Peto
12-31-07, 12:15 PM
Agree completely. The single column formations work fairly well with about 3 ships. If you use 4 I recommend closer spacing (~500-700 yards). That makes it easier for them to maintain theire location--not so far to go. It's also more accurate from a historical perspective.

Japanese convoys were notorious for poor station keeping though so if merchants romp around a little it's not a big deal IMHO.

tater
01-13-08, 03:18 PM
Some code to play with (ACE version 0.4)

These are scripts (py files open as text).

Here is a sample of the code for ZZ pattern E:
def nm2meters(coords):
res = []
for c in coords:
res.append((c[0]*1852, c[1]*1852))
return res

def rotate(coords, heading):
res = []
angle = -heading*pi/180
for c in coords:
x = c[0] * cos(angle) - c[1] * sin (angle)
y = c[0] * sin(angle) + c[1] * cos (angle)
res.append((int (x), int (y)))
return res

def coordsToWP(group,coords):
for c in coords:
wp = Waypoint(c[0]+group.longitude, c[1]+group.latitude, group.getWaypoints())
group.getWaypoints().add(wp)

def heading2rad(heading):
return (pi/180)*((360+90-heading) % 360)

def projectPoint(base,speed,heading,minutes):
angle = heading2rad(heading)
distance = speed * minutes / 60
x = base[0] + distance * cos(angle)
y = base[1] + distance * sin(angle)
return (x,y)

def zigZagA(speed):
res = []
res.append((0,0)) # Added for consistency, removed later
res.append(projectPoint(res[-1],speed,60,5))
res.append(projectPoint(res[-1],speed,30,5))
res.append(projectPoint(res[-1],speed,0,5))
res.append(projectPoint(res[-1],speed,-30,5))
res.append(projectPoint(res[-1],speed,-60,5))
res.append(projectPoint(res[-1],speed,0,5))
res.append(projectPoint(res[-1],speed,-60,5))
res.append(projectPoint(res[-1],speed,-30,5))
res.append(projectPoint(res[-1],speed,0,5))
res.append(projectPoint(res[-1],speed,30,5))
res.append(projectPoint(res[-1],speed,60,5))
res.append(projectPoint(res[-1],speed,0,5))
res.pop(0) # Remove first element (base)
return nm2meters(res)

def patternLength(pattern):
return sqrt(pattern[-1][0]*pattern[-1][0]+pattern[-1][1]*pattern[-1][1])

def patternSteps(waypoint,pattern):
return int(waypoint.length/patternLength(pattern))

def patternToWaypoint(waypoint,iterator,pattern):
last = waypoint.previous
for x in range(0,patternSteps(waypoint, pattern)-1):
wp = None
for c in pattern:
wp = Waypoint(c[0]+last.longitude, c[1]+last.latitude, group.getWaypoints())
insertWaypointBeforeCursor(iterator,wp)
last = wp

def zigZagWithPattern(group):
i = group.waypoints.iterator ()
for waypoint in i:
patternToWaypoint(waypoint,i,rotate(zigZagA(waypoi nt.speed),waypoint.heading))

i = mission.randomGroups.iterator ()
for group in i:
zigZagWithPattern(group)

This code within: defzigZagA(speed) is the pattern from the illustrations above. Speed, angle off base heading, and time on each leg. You can enter the angle and times right off the real japanese ZZ pattern diagram.

http://mpgtext.net/subshare/306ZigZags.rar

^^^^ my patterns so far.

Any with trailing lower case (ZZ_Pattern_Ab.py, for example) are non-historical variants created by increasing leg times in order to spread out the pattern more to save waypoints and to give ships more time to reform after a turn.

tater