Space Engineers

Space Engineers

421 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
1 Apr, 2024 @ 6:42am
14 Jun @ 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
21 Apr, 2024 @ 10:13pm
Flickering Text
Souls
123 Comments
Digi  [author] 10 Jul @ 3:53am 
@Into
Sounds like something is different on the server, are you maybe extremely far from 0,0,0 ? Or does the server have some mods that affect suspension alignment in some way?
Can you get the server's world and run it in singleplayer to see if it has the same issue with your tank?

@UncleFester
No idea what that can be, I can fiddle about with the checks to re-think them and hopefully fix it xD
The strange bit is that rejoining didn't fix it but server restart did, considering that I run this check clientside.
UncleFester 9 Jul @ 5:22pm 
Should have mentioned this was on a MP server, and the regular server restart made the problem go away... Yay!
UncleFester 9 Jul @ 4:50pm 
So... odd problem... on a LG that currently HAS tracks (that I added days ago), I now cannot modify them... Pressing "F" while looking at the grid says I cannot build tracks on enemy or neutral grid"

But I personally (not faction mates, all me) own every block... this definitely not an enemy grid...

tried restart of client, tried restart of SE... any idea?
Into 9 Jul @ 5:11am 
@Digi
Here the BP:
https://steamhost.cn/steamcommunity_com/sharedfiles/filedetails/?id=3520979741
still works in creative, not on server.
Digi  [author] 8 Jul @ 9:29pm 
@Into
The horizontal alignment might not be exact with what I built there, can you provide a blueprint?

@ꪊ᭢᭢᭢᭢᭢ꪊ᭢᭢᭢
So not wheels on rotors (which this already supports)? I'm not sure what you mean then, can you link a blueprint?
Into 28 Jun @ 6:13am 
I've basically built what is seen in the title image
Into 28 Jun @ 6:03am 
Imported a rover I've built in creative and tried to put the tracks on, but it tells me that wheels do not align, it's a combination of 1x1 and 2x2. It was working in creative tho.
Digi  [author] 14 Jun @ 10:22pm 
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 14 Jun @ 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] 13 Jun @ 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.