Jump to content
Sign in to follow this  
Raunhofer

The best way to add roads?

Recommended Posts

@Bartchie

The road pieces will snap together ok - and look ok... but it's really more a question of "do they work"? - as in "do the AI recognise them as a roads network and actually use them as such to plan a route from A to B"?

You know what the AI can be like sometimes on roads... weaving around - cutting cross country - refusing to use bridges, etc...

It's all down to their AI routines and how they "see" roads...

There's - as usual - no absolute definitive description of the exact details of the road system and the AI reaction to it - but there's fairly clear guidlines as to how to make them - and it seems to have a heavy emphasis on "keyparts" and "terminators" (which don't necessarily "terminate")...

Obviously - keyparts and terminators are important (maybe the AI navigate the road system by looking for keyparts in vaguely the right overall direction and then navigating the road system from keypart to keypart??? - I dunno)... best not skip them entirely - just to be sure.....

Roads aren't covered by Sgt Ace's tutorial - the only thing it's lacking... However - there are several threads around which cover the procedure in detail... check ZeroG's sticky for "road placement"...

1. Tools > Roads

2. In the upcomming window push Add...

3. Give it a name

4. Switch to Straight parts

i.e. scroll down to roads2 and add step by step:

asf1_12.p3d (12.5m)

asf1_6.p3d (6.25m)

asf1_25.p3d (25m)

5. Switch to Curves

i.e. scroll down to roads2 and add step by step:

asf1_10 25.p3d (Angle 10°, Radius 25m)

asf1_10 50.p3d (Angle 10°, Radius 50m)

asf1_10 75.p3d (Angle 10°, Radius 75m)

asf1_10 100.p3d (Angle 10°, Radius 100m)

5. Switch to Terminators

i.e. scroll down to roads2 and add step by step:

asf1_6konec.p3d

6. push Ok and close window

(at this point you should also switch to the "crossroads" tab and add EVERYTHING with a "kr_t" or "kr_x" prefix.... they're your T-junctions and Crossroads)...

You need to do a seperate entry for each road type - the straight parts, the curved parts, the special parts (crosswalk only), and the konec terminators...

roadsmenus.jpg

Then you lay the roads using the road tool...

I've been using the "T"'s and "X"'s defined as "Crossroads" (because they're where roads cross :) ) - the only "Special Part" defined being the crosswalk/pedestrian crossing, and "konec" being the only terminator...

To lay a road, I've been starting by clicking the map and laying an initial keypart - usually a crossroads or konec part - then off you go - extending the road along Direction A or whatever...

Once I hit about 50 parts or so, if I haven't reached a junction, I "Generate terminator"... (DON'T confuse this "terminator" with the "Konec end-of-road terminator part!)... this asks you what you'd like to use as the "terminator" - I select "Straight part" and that section of road network (for smoothing purposes), finishes there... (I do this because too many parts and "smoothing" takes forever, or occasionally doesn't finish at all)...

Then, to carry on the road, I select that new "straight part, which is now a "keypart" and I carry the road on from "Direction A" as before...

If you hit a point where you want say, a T junction, you generate a terminator again - select crossroads as the terminator part, and pick your junction part...

Whether it's a left or right hand junction (or left AND right) depends on which end you attach to your previous piece...

This T then becomes the keypart for a new network section - which you can expand in Direction A or B (or C, depending on which end you attached to the previous section)

A genuine actual "end of road" situation gets a "Generate Terminator" too - with the real road-end "Konec" part being selected as the end/key/terminator part....

End result should look something like this...

roads_small.jpg

AI navigate the roads ok... I guess... they seem to "hesitate" a bit when approaching junctions that currently "don't go anywhere"... see pic above... it's like they recognise the junction as a potential place to turn and follow what looks like it could be a viable road, but then it's almost as if they think along that road - can't find a "keypart" further along it, and then reject it as a potential route...

All guesswork of course - but it's this behaviour that has me thinking that keyparts play a role in AI road navigation...

B

Share this post


Link to post
Share on other sites

I was thinking the same as bushlurker.

One would have to test if the roads work for ai or not. As well a all the smoothroads scripts..

@ Homer jhonston: Are you using 3DE by mapfact in the video? That looks really impressing..

Share this post


Link to post
Share on other sites

Afaik junction parts are not really needed for AI. AI finds the new path quickly if you end the previous road with terminator and they "hop on" the new intersecting road. But I agree, all roads need to be "terminated" in order for AI to use them.

Share this post


Link to post
Share on other sites

@Beton - it's just a script I wrote up last night. I'm going to try and get it to the point where you can draw subsequent paths connected to each other, then I'm going to post it here and ask for input on whether or not it's worth developing any further...

Share this post


Link to post
Share on other sites

Homer: we would just need a starting coordinate/heading and the generated script file that we could import the road from this tool? Cool!

Share this post


Link to post
Share on other sites

Something like that. It would take quite a while to develop this tool into something really usable (due to being involved in several other projects :( ).

I got it working to draw subsequent paths... it's really, really rough right now so don't make too much fun of it, but feel free to have a look at it :cc:

No mods required.

http://dl.dropbox.com/u/4621600/RoadTool.utes.pbo

depbo and load it into the editor, or else load it as an SP mission. press your "optics" key to end a path segment and start a new one, and your move forward/back/strafe keys to move around (I'm too lazy to make it mouse-controlled for now)

it doesn't use a lot of the actual road-piece shapes and the algorithm is really rough right now, so you'll have trouble making any nice lines with it, but it might be a start of something... comments and opinions are welcome.

Edited by Homer Johnston

Share this post


Link to post
Share on other sites

Sorry for my insistence... but... what is the use for an automated tool to place roads, if roads must (at least on mountain maps) follow the bottom of the hills?

What kind of tool can follow the best slope for you, instead of your eye and a little bit of patience? Sorry but i still don't understand how a ROAD tool can help me (different if we're talking about fences and powerlines...)

Share this post


Link to post
Share on other sites

it needs ACE and CBA... it wouldn't have to be a requirement, but it's how I made it for now.

@shezan74 - I think you're just unclear on how it would work. Maybe if you tried the proof-of-concept mission I just posted it would make more sense to you?

Edited by Homer Johnston
oops ... it does need ACE :P thanks Bushlurker (below)

Share this post


Link to post
Share on other sites
Does it need ace?:)

...apparently... ;)

... crashes with an "Include file x\ace\addons\main\script_mod.hpp not found"

... accidental dependancy, I think...

B

Edited by Bushlurker

Share this post


Link to post
Share on other sites

I considered ACE household material :p neither of you have it?!? I'll see if I can remove the dependency sometime this weekend...

Share this post


Link to post
Share on other sites
it needs ACE and CBA... it wouldn't have to be a requirement, but it's how I made it for now.

@shezan74 - I think you're just unclear on how it would work. Maybe if you tried the proof-of-concept mission I just posted it would make more sense to you?

Yep! i'll give a try tomorrow :)

thank you for your efforts

Share this post


Link to post
Share on other sites

@ Homer jhonston: Are you using 3DE by mapfact in the video? That looks really impressing..

Actually, it would be nice to have this tool for A2 as well...not only for the roads...by that, we could build beautiful maps even without Visitor 4...

Share this post


Link to post
Share on other sites

Works well as a test ...... now for your next trick ;)

Can a matrix be set up of curves, so that exact xy positions and angles for ever road bit.

Your program would access this and lay a best guess as the "layer" moves around the screen.

Sounds easy but I know its not ...... I can't fully picture the 2d code just yet .....

Share this post


Link to post
Share on other sites

It'll take a while, but in the end it's just math. My main concerns are getting the algorithms to produce something which is actually appealing to the map creator, and the transfer from the editor to Visitor.

The complexities in the algorithm will be things such as:

- does it need to use larger-radius turns at the start/end of straight sections?

- sometimes larger-radius turns won't fit; how to control whether to make the turn as tight as possible or more realistic?

- how best to handle quick changes in direction (S-curves)

- what controls to give the tool? e.g. I'm considering to have rolling the mousewheel to change turn-radius...

- how to handle improper placements; maybe add the ability to delete (backtrack) the road piece-by-piece?

Then there's the issue of getting it from ArmA to Visitor. I admittedly haven't done a lot of road placement in visitor, so I need to learn more about road networks, and how they are set up. Will the benefit of a tool like this outweigh the hassle of needing to copy stuff into text files and other odd junk? I don't know yet...

The list could probably go on, those are just a few things that strike my mind right now...

Share this post


Link to post
Share on other sites

Then there's the issue of getting it from ArmA to Visitor.

I'm not good at programming but I think it's possible. Think about scripts like forest forest maker. For example this script is using some algoritms to place some types of trees/plants selected by you in the menu. It propably won't be easy but I believe it's possible.

Share this post


Link to post
Share on other sites

If youre aiming for a tool that auto-forms a large section of road, I'm thinking that may be unnessisary. Just being able to draw a road bit by bit is great.

I may be very nessisary to change the camera angle and zoom for the user to be able to see / better make a road fit terrain.

Edit: After re-reading your questions I'm guessing you didnt aim for the tool to lay actual road bits "live" (instead of the green / red dots).

I was thinking laying the road bits "live" may have been a better idea. From a maths/calculation time perspective, the user couldn't make the road too long each "live draw session", otherwise it would become laggy.

- does it need to use larger-radius turns at the start/end of straight sections?

User selectable. Have 1 keypress that cycles through each curve type maybe; large, medium, tight.

- sometimes larger-radius turns won't fit; how to control whether to make the turn as tight as possible or more realistic?

Maybe 2 keys, 1 to increase radius, 1 to decrease.

- how best to handle quick changes in direction (S-curves)

As suggested, user manually selects each curve, 1 section at a time.

- what controls to give the tool? e.g. I'm considering to have rolling the mousewheel to change turn-radius...

Better still! If its scriptable.

- how to handle improper placements; maybe add the ability to delete (backtrack) the road piece-by-piece?

Hmmmm ..... tricky. To have undo youre going to have to store each point into an array.

In theory if the user is doing each "section" live, then you may not need "storage". User just manually deletes each road bit, and then the script continues the road building on the basis of the closest road bit found near the cursor.

Will the benefit of a tool like this outweigh the hassle of needing to copy stuff into text files and other odd junk?

I'd suggest it will VERY much outweight. If it takes me only 5 minutes to make a Visitor import file, after spending and hour crafting a 5km "live" road winding through a forest ..... sounds like a win to me ;)

Share this post


Link to post
Share on other sites

yeah; I used the 'dots' for the concept because it was dead easy to implement. I'm hoping to figure out a way to use actual road objects in the future. I may need to make a small addon to make them placeable in the editor - I don't know if they have a defined classname to spawn them in-game...

I was planning on having it work essentially just as the concept does; every mouseclick is capable of placing a set of turns and/or a set of straights. My points about different turn radii and S-curves was referring to the fact that a turn doesn't look realistic if it has an R25 turn immediately changing to a straight or swapping left/right; I may want to have the script start with gentler radius's and then go tighter, then gentle again as it exits the turn... otherwise you have to place a turn in at least 3 sections with different radii. It'll get challenging if I get into that sort of behavior but it might make it that much better to use... probably toggleable by a button.

Also, it'll have to store all the road pieces in an array so maybe it'd be good to be able to back-track piece by piece. That shouldn't be an issue - I've had one array storing the location, type, heading, and all sorts of properties of several thousand objects without any performance issues before...

But again, the biggest mental challenge is actually figuring out how to make it all work in a way that is most effective and efficient to use... maybe by next weekend I'll try to make a separate thread about this to try and document my progress, and get more public input :)

Edited by Homer Johnston
more thoughts

Share this post


Link to post
Share on other sites

Haha, anyone care to try something for me while I'm at work?

-make a new mission, create an init.sqf file. Put this in the init file:

sleep 0.1;
StringTest = format ["%1 ---\n\n%2 ---", "line1", "line2"];
copyToClipboard Stringtest;

Start the mission. Then go into Notepad and hit 'paste' - tell me what shows up (or if there's an error message in game). I'm specifically interested if the copyToClipboard function will copy return/newline entries... if not, then this tool is going to be a little more annoying than I hoped it'd be.

Edited by Homer Johnston

Share this post


Link to post
Share on other sites

RoadTool_firstImport.jpg

:drinking2:

I made a screw-up in the left/right turns when it changes to straights so it doesn't match up exactly (the last turn flips around for some reason), but things are starting to look up :) So far the whole annoying process goes like this:

1) I use "optics" key to place sections, as per previous concept version.

2) I can use "reload" key to erase it backwards, piece-by-piece.

3) I can hit "action" key (enter) to copyToClipboard something like this:

( ca\roads2\asf1_10 25^( ca\roads2\asf1_10 25^( ca\roads2\asf1_10 25^( ca\roads2\asf1_10 25^( ca\roads2\asf1_10 25^( ca\roads2\asf1_10 25^( ca\roads2\asf1_10 25^

4) I paste this into a text file with Notepad++ and use find/replace to change ^ symbols into new lines (unfortunately, this requires Notepad++ or another "special" editor)

5) I place a KeyPart section in Visitor, and import the text file I've generated.

I'll update the PBO on the previous download link, mostly just for a backup of my work (I'm always paranoid that I'll get hit by a bus and will disappear from the community and noone will be able to continue my work, haha). It's got some elements that are somewhat hard-coded still (plus the turn-mixup mentioned above), so don't expect to be able to use it yet. More improvements to come... I may also eventually try using Nutty's tool to replace step 4

Edited by Homer Johnston

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×