The online racing simulator
LFS Layout Editor Blender Tool
1
(27 posts, started )
LFS Layout Editor Blender Tool
Hello,

I have come up with some kind of tool that can be used to create basic skeleton for LFS Layout.
It uses Blender 3D editor and outputs LYT file than can be directly loaded in LFS.

A guide is part of the zip package, however it assumes some basic familiarity with Blender.

Currently in version (v0.2) only slabs, ramps and wedges are fully supported. But those are most used blocks when creating new layout.

Basically I have pre-modelled all possible variants of these blocks so you only need to copy paste them and put them together into layout.

The script for actual export is included in .blend file and can be directly run from Blender - it exports all selected objects to the output layout.

Any feedback, suggestions or improvements are welcome.
Attached images
image_002.png
image_001.png
Attached files
LFS_Layout_Editor_Blender_Tool_v0_2.zip - 1.2 MB - 348 views
Thats looks cool, I haven't tried it yet, if its really works with no rotation restrictions this will help make smooth lays
Quote from Aleksandr_124rus :Thats looks cool, I haven't tried it yet, if its really works with no rotation restrictions this will help make smooth lays

That's a game limitation though so once you import the thing over inside LFS it will find the closest rotation to the slab it can have, in 1.5 degree steps or how much was it i forgot already. Big grin

Seems like a neat idea though i can imagine atleast scenery structures being easier to design through blender, atleast once pillars and walls could be made available Big grin
Quote from Aleksandr_124rus :Thats looks cool, I haven't tried it yet, if its really works with no rotation restrictions this will help make smooth lays

Rotation restrictions are there. They come from packing all info about object into 8 bytes.
You can rotate blocks along Z axis as you want in Blender, it will be rounded to nearest angle LFS supports during export.

But you cannot rotate along X or Y axis in Blender, for that purpose I made predefined blocks that are already properly rotated. Their rotation is encoded into the name of the block and from there the export script read it and convert to appropiate LFS object.


But main advantage of editing layout in Blender is that you can easily copy paste, have big layout and export only some sections of it. Create structures or template certain blocks into larger building pieces and use all the tools that Blender supports, like repeating last action with Shift + R or vertex snapping, spin dup around cursor etc... you can even script things, so if you can generate some layouts... possibilities are endless.


I am now experimenting with converting a curve into layout. I already have some success. I have converted entire Akina mountain track into layout. Although I had to reduce its height to 64 meters so it fits LFS limits.
So far I made things simple and so I used only basic slab block so there are bounces which need to be changed for elevated ramps. But all I did was fully automatic done by script, I can enhance it in Blender or in game.

I attach the Akina layout so you can take a look.
Attached files
LA1_Akina_004.lyt - 8.6 KB - 165 views
I made another progress. I've written import script, so now it is possible to import LYT file into Blender, do modifications and then reexport into LYT file again.

Since I haven't modelled all ingame blocks yet (only slabs, ramps and wedges), I made partial support - those object will display as small cube in Blender, but they will be at right location, properly rotated and I saved their metadata so it will be exported exactly as it was, despite lack of model for it. They can also be repositioned or rotated along Z axis in Blender.
Attached files
LFS_Layout_Editor_Blender_Tool_v0_3.zip - 1.4 MB - 306 views
That's amazing, now with blender i can adjust slab on real track! If you use linux, you need remove os.system("cls"). I can create layout from my RPI5 Smile
Quote from NENE87 :That's amazing, now with blender i can adjust slab on real track! If you use linux, you need remove os.system("cls"). I can create layout from my RPI5 Smile

Nice that you find it useful.
Don't you want to collaborate on this tool with me?
We could make it better
Maybe we could release other objects? Programing is not my cup of tea, but maybe can i edit some objects from lfs?
Why am I seeing this tool only now? It's something I've been thinking bout for a long time, glad someone has actually catched this idea before. Looking forward to see how it progresses!
Really useful tool, thank you very much for your work!
Quote from Vritrasura :...Currently in version (v0.2) only slabs, ramps and wedges are fully supported. But those are most used blocks when creating new layout...

Sorry to be a killjoy, but not so.

Slabs, ramps and wedges are not the most widely used or supported. That would be concrete walls,armco, banners and barriers (at least by me in my layouts). And these are the hardest to position.

Slabs, ramps and wedges are the easiest to do, even by hand/eye.



What's hard, is trying to get a nice curve (especially inside curves) when any object can only be rotated 360 degrees in 256 increments (1.40625 degrees per turn). Curves with straight shapes is really difficult. But constant radius turns like a 180 degree u-turn hairpin is much easier than a sort of v-shaped hairpin.

If you develop this tool further, will it be able to do smooth looking turns?

What about turns with different objects in the same turn? E.g. concrete walls and armco.
Attached images
curves.png
Another version is under release. Do you have tried 0.3 version?
Quote from sinanju :Sorry to be a killjoy, but not so.

Slabs, ramps and wedges are not the most widely used or supported. That would be concrete walls,armco, banners and barriers (at least by me in my layouts). And these are the hardest to position.

Slabs, ramps and wedges are the easiest to do, even by hand/eye.



What's hard, is trying to get a nice curve (especially inside curves) when any object can only be rotated 360 degrees in 256 increments (1.40625 degrees per turn). Curves with straight shapes is really difficult. But constant radius turns like a 180 degree u-turn hairpin is much easier than a sort of v-shaped hairpin.

If you develop this tool further, will it be able to do smooth looking turns?

What about turns with different objects in the same turn? E.g. concrete walls and armco.

I already included a script in version 0.3 that you can duplicate blocks along curve... it is not documented in guide, but it is there, you can try it.

I am also making another tool, called editorman's insim https://www.lfs.net/forum/thread/105303.

There I plan to make possibility to draw line of objects by clicking with mouse directly in LFS. I think that will be the ideal tool for you for this kind of problem.

The editorman's insim can also load a layout "as composition" and spawn it anywhere on the map.
Therefore you can save some often used groups of objects as composition. Maybe that will help you too. You can make 5 predefined curves and use them wherever you need.

No killjoy, it's welcomed. Tell me what you need and I'll try to make it.

By the way we prepare release which has all blocks supported and maybe also some better UI.
A preview of the update, these objects are created by us, they are not original objects.

I hope you enjoy our work.
Attached images
A.png
B.png
C.png
D.png
Version 1.0 released
A new version with all blocks released.
I did my best to to test every block,
but let me know if you find any error.

A special thanks to Nex_ (NENE87) for modelling majority of blocks!
Thumbs up
Attached files
LFS_Layout_Editor_Blender_Tool_v10.zip - 2.2 MB - 417 views
Proof of concept Smile
Attached images
Capture d'écran 2024-02-23 184222.png
Capture d'écran 2024-02-23 173236.png
Capture d'écran 2024-02-23 180341.png
So i tried this blender tool and it's kinda weird to me. I tried importing my Kitchen Rats map because it's kinda of a stress test and this is how it should look like:


But after i imported it, it looks like this:


I think it's mainly slab walls that are weirdly rotated, so maybe that object is not supported yet?
Also i don't quite understand what i'm doing wrong here:


(Ignore all the slab walls being weird) i rotated the selected piece a bit by Z axis which i should be able to do so, only this one object, but when i export it back to LFS somehow many others are affected as well? (different sizes, angles, etc.) And slab walls looking normal.
Quote from Drifteris :So i tried this blender tool and it's kinda weird to me. I tried importing my...

Did you have already tried the normalize script? That adjust the piece for exporting the rotation that lfs accept
Quote from NENE87 :Did you have already tried the normalize script? That adjust the piece for...

i tried, but idk if it does anything because nothing changes, selected objects or not. I tried using ramp objects that i copy pasted and rotated on Z axis but it just doesn't work as expected for some reason.




I'm using blender 4.1.1 for this.
Can you share your file? Maybe i can take a look and try to find solution Wink
Quote from Drifteris :i tried, but idk if it does anything because nothing changes, selected objects...

Hello

yes, it seems this block is badly mapped... I'll try to fix it in next few days... Thank you for pointing that out and sorry for delayed reply, i missed notification in my e-mail.
Hi,

I like the tool, but i have 2 issues

The first one, where is the normalize option? I don't found it..

The second one, i try to export something, and this happen :

Python : Traceback (most recent call last):
File "C:\lyt_editor_Montlhery.blend\LFS_LYT_Import.py", line 94, in <module>
struct.error: unpack requires a buffer of 12 bytes

How i suppose to fix this? As i'm really bad with python i don't understand how it work

Thank you by advance !
Fixed, you need to choose export.py for export...
can I load a map from google into this editor?
Quote from scania :can I load a map from google into this editor?

the editor is Blender3D and I am sure it is possible to load background images into it. Just goigle any tutorial how to do it.
1

LFS Layout Editor Blender Tool
(27 posts, started )
FGED GREDG RDFGDR GSFDG