Skip to content

[Feature Request] Add "Generate Network from Map Data" Function #100

@whitevamp

Description

@whitevamp

NOTE: I'm submitting this as a feature request instead of a pull request because I am aware the project is currently undergoing a major rewrite. I wanted to avoid creating merge conflicts and allow you to integrate this logic into the new codebase when you're ready.

As a course creator, I want to be able to automatically generate a base AutoDrive network directly from the map files. This would save hours of manual tracing.

This feature would add a new button/menu option like "Generate Network from Map..." which would:

Generate all road networks by reading the map's AI traffic splines.

Generate field-edge routes by reading the map's field boundary polygons.

This adds a major new capability. While AutoDrive's in-game generator can create a network from AI splines, it cannot generate the field boundary routes. This feature would allow the editor to do both, creating a much more complete and useful base network than what's possible in-game.

Technical Implementation

I've done the research on how to extract this data, and it's a two-part process that can be done entirely offline by the editor:

Field Boundaries:

    The editor can parse the map's main .i3d file (which is just XML).

    It can find all <TransformGroup> nodes with a name starting with "field" (e.g., name="field001").

    Inside these, it can find the <TransformGroup name="polygonPoints"> and read the translation of all child points.

    Crucially, it must add the child point's translation to the parent field's translation to get the absolute world coordinates.

AI Road Network (Splines):

    Parsing the binary .i3d.shapes file is too complex.

    The easiest method is to have the user export the AI splines from the GIANTS Editor first.

    User Steps:

        Open map in GIANTS Editor.

        Find the <TransformGroup name="ai">.

        Select all child <Shape name="spline"> elements.

        Go to File > Export Selection... and save as a .obj file.

    The editor can then easily parse this text-based .obj file, as it's just a list of vertex (v X Y Z) coordinates.

Proof-of-Concept Logic

The logic for this is proven. The technical steps are:

For Fields: Parse the .i3d as XML, find //TransformGroup[starts-with(@name, 'field')], get its translation, then find its children ./TransformGroup[@name="polygonPoints"]/TransformGroup, get their translation, and add the two vectors.

For Roads: Parse the .obj as a text file, and for every line that startsWith("v "), parse the three following numbers as the X, Y, Z coordinates.

PS: I am also including snippets of both parsers.

i3d_parser.js
obj_parser.js

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions