Space Engineers

Space Engineers

416 ratings
Tank Tracks Framework & API
8
5
5
3
2
3
2
2
2
   
Award
Favorite
Favorited
Unfavorite
Type: Mod
Mod category: Script, Other
File Size
Posted
Updated
512.638 KB
Apr 1, 2024 @ 6:42am
Jun 14 @ 10:06pm
17 Change Notes ( view )

Subscribe to download
Tank Tracks Framework & API

In 1 collection by Digi
Digi's Space Engineers mods
50 items
Description
This provides other mods the ability to have tracks over specific types of blocks.

Video courtesy of Patrick.

Player usage
You need other mods that use this to have something actually happen.

List of known mods using this:
If you make a mod that uses this framework, contact me and I'll add it to this list.


Features
  • Framework & API
    Any mod can use this to make their own tracks over specific blocks with their own model.
    It also has a C# modding API, refer to the tank track builder mod as an example.

  • Flexible and animated (View[imgur.com])
    Track "stretches" over any number of chosen wheels as a convex shape.
    It animates 1:1 to vehicle movement and it reacts to terrain or grids under it.
    But do mind that it's visual only! At least by default, other mods can use the API to give it special properties.

  • Static rollers
    Non-suspension wheels can also be used with or without rotors.
    They're also rotated with track movement (or a subpart can be instead).

  • Car controls maintained
    Suspensions still physically steer but visually they remain straight, allowing you to control it like a car.
    For actual tank-steering you'll have to use the various options already out there like PB scripts or mods.

  • Debris when destroyed
    The pieces get scattered from the broken wheel location and live for about 10s.
    Also an option for particle effect per broken segment (ones near the broken wheel are tagged as broken segments).

  • Multiplayer-ready
    Track creation and removal is synchronized to/from players (the API too).

  • Blueprints, projection and copy-paste support
    Tracks get saved in one of the blocks, this means they carry over to blueprints, pastes, etc.
    Designed to work with projectors by waiting until all blocks are present.
    It also shows up in projection itself (currently only static and suspension can do this).

  • Coloring and skinning support
    The tracks take on the color and skin of the base block (suspension, rotor, or the wheel block itself if static).

  • Optimized
    Various optimizations are made to help alleviate the impact
    - Animations are computed player-side, DS still computes some track checking things but no animations.
    - Update-rate based on changes and distance as well as track size, a huge track will still update smoothly over a longer distance. Also stops updating and goes invisible after a high distance.
    - Each track is computed in parallel to all others while simulation waits for all to complete, this reduces the linear increase in compute time with more tracks present.
    - Still a lot more left to be optimized, primarily in avoiding the mod profiler hit...


Modders: Adding Tracks

A few things needed:
  • A model for the track segment (can use zonechip item model as a temporary one). Recommended to be 1m wide to aid with scaling guesstimates.
  • Blocks to allow them on, can be vanilla or custom (supported types: MotorSuspension and static CubeBlock/Wheel/etc.)
  • TankTracks.ini file in your mod's Data folder, see: https://gist.github.com/THDigi/d9d41e35a97fd9b55a3e9d3a7e0a8d72
    It is important for this file to be named exactly that and be directly Data folder, the modAPI cannot search for files.
  • This mod as dependency (also let me know if you want your mod linked in this page).

You can look at Tracks over Vanilla wheels's contents as a practical example.

For fine tweaks there's /tanktracks reload to reload all the TankTracks.ini from all mods and respawn tracks. Only works in offline worlds.


Modders: API
NOTE: This is optional! To add new tracks you don't need to program anything, see the above section instead.

The Track Builder mod can act as an example for the API usage.

The gist is:
  1. Go to this mod's downloaded files and copy the Data\Scripts\TankTracks\API folder to your mod (can rename the folder of course).
  2. A session component to handle instancing and unloading of the TankTracksAPI class: https://gist.github.com/THDigi/d515209c9dce1d0bee1deb86235a654a
  3. And that's it, now you can interact with the tank tracks API.

Mind that the API is not even close to complete so don't be shy in asking for things to be exposed or fixed.


mod io?
Please read[gist.github.com]
Popular Discussions View All (1)
8
Apr 21, 2024 @ 10:13pm
Flickering Text
Souls
116 Comments
Digi  [author] 14 hours ago 
I've updated the mod to add some more info around the error to maybe track down the issue.

First try to make it happen again and when it does can you post the full SE log (here or steam or discord @m_digi ).

I've also added an option to turn off multithreading, if you want to try to see if that contributes to the problem, first close the game to reset the issue, then go in the mod's storage folder ( %appdata%\SpaceEngineers\Storage\3208995513.sbm_TankTracks\ ), there create a "nothreads" file (without any extension, that's important). Once you load a world with the mod, the info.log will have around the 8th line a "Threads: " that mentions if it's on or off.
Cona6789 Jun 14 @ 12:03pm 
Yes it seems to happen even after a reload, a complete relaunch is needed to fix it, but only temporarily. im not exactly sure what the cause is, but I know it only ever happens when my friend is in a tank thats using the tracks mod.
it has happened to him before when i was in a tank using the tracks mod, so to me it seems it happens when someone else is using a vehicle with tank tracks, and you try to use a seat or go in third person.
as soon as I removed the tank track framework it stopped happening
Digi  [author] Jun 13 @ 11:33pm 
The black screen is probably the same thing causing the errors in my mod, giving it NaN position/distance which would fail to find a valid preset because of it.

Does it happen reliably even if you save and reload world? That's good then but if you have gigabytes of mods can you please try and removes some to narrow it down, then send me the world so I can find what's causing it (likely another mod but who knows).

Also if using plugins, first try without pluginloader.
Cona6789 Jun 13 @ 10:59pm 
Encountering a glitch where when I sit in any seat the entire screen goes black and theres no audio, error displays on screen in red text that says:
"TankTracksFramework v1.1.4 ERROR: no distance preset!"
Confuoco Jun 4 @ 5:29am 
No, its just decoration.
Nyxborne May 11 @ 10:40am 
Do tracks give your Rover an advantage? Like do they grip the ground between wheels?
Sypher May 11 @ 8:03am 
@Digi, MP Server, and we added Tracks over Vanilla wheels and so far it seams to be working. I will keep you informed. Thank you for the reply.
Cona6789 May 8 @ 9:10pm 
I will next time we play together, dont know when thatll be but ill post it here
Digi  [author] May 8 @ 4:08pm 
I can't reproduce it in my dedicated server, so it's either really requiring player-hosted or it's something else going on...

Is it an actual error that tells you to send me the log? if so can you send your friend's SE log [spaceengineers.wiki.gg], either here or on discord ( @m_digi )
Otherwise if it's just an informational message can you tell me the exact wording, or screenshot it.
Cona6789 May 8 @ 12:42pm 
It happens whenever he tries to enter any seat on any blueprint, large or small grid, including vanilla seats and modded seats. I am on a MP client hosting for friends only through steam.