Lugaru Map Import / Export scripts for Blender
Posted: Wed May 05, 2010 10:34 pm
You can now load, edit and merge maps with Blender.
You can get the scripts in a ZIP archive right here: viewtopic.php?f=7&t=5620&p=232622#p232622
(Used to be http://www.alice-dsl.net/wolf.mathwig/tools/py/ -- not anymore though)
These scripts really only handle object placement. Character starting points, enemies, dialogues et cetera should be edited with Lugaru or other third-party tools.
Here's some help regarding the other things you might want to do as a modder:
viewtopic.php?f=7&t=6297
The objects this stuff is interested in is the immobile meshes in a map. This is the list of files the script bothers with:
- Box.solid
- Weird.solid
- Spike.solid
- Treetrunk.solid
- Leaves.solid
- Bush.solid
- Rock.solid
- Wall.solid
- Chimney.solid
- Platform.solid
- HIDDEN (no file)
- Tunnel.solid
- Cool.solid
- FIRE (no file)
The zip file you download at the above URL contains a Blender project named lugarumapping.blend and the script files for importing and for merging.
You want to install the scripts before opening the .blend file.
I strongly recommend you start with opening lugarumapping.blend every time you want to make a new map.
lugarumapping.blend setup (click for full view)
Workflow:
- Open lugarumapping.blend
- Import a map that has the objects you want to place
... - If you import a map from a location where there's no .solids in ../Models/,
..... the previously existing template meshes will be used (see Layer 2)
- Duplicate, delete, translate, rotate, scale objects
- WYSIWYG - What You See Is What You Get
- Don't switch to Edit Mode
- Start the merging script (File -> Lugaru map merge...)
- Choose a map to merge with. Click "Merge Map".
... - If you choose a map named MYMAP, the merge result will be in MYMAP.merge
... - The merge script only replaces objects. It replaces all immobile objects. Everything else in the map stays the same.
Limitations:
- Only operate on Layer 1. Layer 2 is reserved for template meshes.
- Do not duplicate template meshes from Layer 2 to Layer 1. You need to import some map that has the objects you need instead. Use those imported objects. The objects in Layer 2 don't have the right properties set.
- The maximum number of objects in a map is 299. This limitation comes from Lugaru.
- You can only rotate around the X and the Z axis. This limitation comes from Lugaru.
- ScaleX sets the general scale. If you scale ScaleY and ScaleZ in some crazy way, it won't affect the outcome.
- The Z jitter that's built into the terrain of Lugaru isn't represented. So some objects may be further in the ground than they appear.
- In general, the heightmap displacement is a rough approximation. It's good enough though.
- Fire is displayed as a text saying FIRE in red
- Hidden stuff is displayed as a text saying HIDDEN in black
- Meshes are UV-mapped, but the textures aren't loaded automatically for a bunch of reasons
Sweet features:
- If you want to change the heightmap, choose one in the Texture View (bottom, middle).
Don't forget to load it beforehand in the UV/Image View (bottom, right).
After you've chosen a new heightmap, click once into "Texture: heightmap" in the displacement modifier (bottom, left) and press Return. The new heightmap is then applied.
- The template meshes will be re-imported every time you import a new map. So if you have N sets of template meshes, I recommend making N template data folders, like this:
TEMPLATE_1/
---------------Data/
--------------------Models/
----------------------------Box.solid
----------------------------Weird.solid
----------------------------(et cetera)
--------------------Maps/
----------------------------map1
----------------------------map2
----------------------------(et cetera)
TEMPLATE_2/
---------------Data/
etcpp.
The advantage is that when you import map1 from the folder TEMPLATE_K/Data/Maps/, the script automagically pulls the matching meshes from the folder TEMPLATE_K/Data/Models/.
Good to know:
- Lugaru's Rotation1 is in 30° increments (meaning that if you choose 57.2°, you end up with 30°)
- Lugaru's Rotation2 is in 1° increments (meaning that if you choose 121.06°, you end up with 121°)
- Leaves are rotated randomly around the local Y axis (up local) unless you have more than 2° in Rotation2
- Bushes are always rotated randomly around the local Y axis (up local)
Useless knowledge for map editing in Lugaru:
- Rocks have a weird rotation scheme: Rotation2 is Rotation1*7+Rotation2. Meaning that if you rotate a Box by 150° and 55° and a Rock has the exact same mesh, then the Rock would have to be rotated by 150° and 1105° to match orientation (or 150° and 25°)
- Platforms have a similar thing with Rotation2 being Rotation2+90° (so if you rotate a Platform by 0° and 37° and a Box has the exact same mesh, then the Box would have to be rotated by 0° and 127° to match orientation)
I've dealt with all this in my scripts though, so you can rotate away and go by what you see in Blender no matter what kind of .solid you have on your hands. It's completely transparent.
One thing I might add later is rounding to the nearest 30° / 1° increment upon export on the proper axis, together with applying rotation increments as Lugaru exports them if it's wanted. It's not really essential though.
READ THE THREAD please. It helps.
I guess that's really all you have to know. Ask away if something isn't clear to you.
You can get the scripts in a ZIP archive right here: viewtopic.php?f=7&t=5620&p=232622#p232622
(Used to be http://www.alice-dsl.net/wolf.mathwig/tools/py/ -- not anymore though)
These scripts really only handle object placement. Character starting points, enemies, dialogues et cetera should be edited with Lugaru or other third-party tools.
Here's some help regarding the other things you might want to do as a modder:
viewtopic.php?f=7&t=6297
The objects this stuff is interested in is the immobile meshes in a map. This is the list of files the script bothers with:
- Box.solid
- Weird.solid
- Spike.solid
- Treetrunk.solid
- Leaves.solid
- Bush.solid
- Rock.solid
- Wall.solid
- Chimney.solid
- Platform.solid
- HIDDEN (no file)
- Tunnel.solid
- Cool.solid
- FIRE (no file)
The zip file you download at the above URL contains a Blender project named lugarumapping.blend and the script files for importing and for merging.
You want to install the scripts before opening the .blend file.
I strongly recommend you start with opening lugarumapping.blend every time you want to make a new map.
lugarumapping.blend setup (click for full view)
Workflow:
- Open lugarumapping.blend
- Import a map that has the objects you want to place
... - If you import a map from a location where there's no .solids in ../Models/,
..... the previously existing template meshes will be used (see Layer 2)
- Duplicate, delete, translate, rotate, scale objects
- WYSIWYG - What You See Is What You Get
- Don't switch to Edit Mode
- Start the merging script (File -> Lugaru map merge...)
- Choose a map to merge with. Click "Merge Map".
... - If you choose a map named MYMAP, the merge result will be in MYMAP.merge
... - The merge script only replaces objects. It replaces all immobile objects. Everything else in the map stays the same.
Limitations:
- Only operate on Layer 1. Layer 2 is reserved for template meshes.
- Do not duplicate template meshes from Layer 2 to Layer 1. You need to import some map that has the objects you need instead. Use those imported objects. The objects in Layer 2 don't have the right properties set.
- The maximum number of objects in a map is 299. This limitation comes from Lugaru.
- You can only rotate around the X and the Z axis. This limitation comes from Lugaru.
- ScaleX sets the general scale. If you scale ScaleY and ScaleZ in some crazy way, it won't affect the outcome.
- The Z jitter that's built into the terrain of Lugaru isn't represented. So some objects may be further in the ground than they appear.
- In general, the heightmap displacement is a rough approximation. It's good enough though.
- Fire is displayed as a text saying FIRE in red
- Hidden stuff is displayed as a text saying HIDDEN in black
- Meshes are UV-mapped, but the textures aren't loaded automatically for a bunch of reasons
Sweet features:
- If you want to change the heightmap, choose one in the Texture View (bottom, middle).
Don't forget to load it beforehand in the UV/Image View (bottom, right).
After you've chosen a new heightmap, click once into "Texture: heightmap" in the displacement modifier (bottom, left) and press Return. The new heightmap is then applied.
- The template meshes will be re-imported every time you import a new map. So if you have N sets of template meshes, I recommend making N template data folders, like this:
TEMPLATE_1/
---------------Data/
--------------------Models/
----------------------------Box.solid
----------------------------Weird.solid
----------------------------(et cetera)
--------------------Maps/
----------------------------map1
----------------------------map2
----------------------------(et cetera)
TEMPLATE_2/
---------------Data/
etcpp.
The advantage is that when you import map1 from the folder TEMPLATE_K/Data/Maps/, the script automagically pulls the matching meshes from the folder TEMPLATE_K/Data/Models/.
Good to know:
- Lugaru's Rotation1 is in 30° increments (meaning that if you choose 57.2°, you end up with 30°)
- Lugaru's Rotation2 is in 1° increments (meaning that if you choose 121.06°, you end up with 121°)
- Leaves are rotated randomly around the local Y axis (up local) unless you have more than 2° in Rotation2
- Bushes are always rotated randomly around the local Y axis (up local)
Useless knowledge for map editing in Lugaru:
- Rocks have a weird rotation scheme: Rotation2 is Rotation1*7+Rotation2. Meaning that if you rotate a Box by 150° and 55° and a Rock has the exact same mesh, then the Rock would have to be rotated by 150° and 1105° to match orientation (or 150° and 25°)
- Platforms have a similar thing with Rotation2 being Rotation2+90° (so if you rotate a Platform by 0° and 37° and a Box has the exact same mesh, then the Box would have to be rotated by 0° and 127° to match orientation)
I've dealt with all this in my scripts though, so you can rotate away and go by what you see in Blender no matter what kind of .solid you have on your hands. It's completely transparent.
One thing I might add later is rounding to the nearest 30° / 1° increment upon export on the proper axis, together with applying rotation increments as Lugaru exports them if it's wanted. It's not really essential though.
READ THE THREAD please. It helps.
I guess that's really all you have to know. Ask away if something isn't clear to you.