#Vs API documentation
1 messages · Page 1 of 1 (latest)
you don't need kotlin knowledge
the api is usable in java
you just lose a bit of qol
as for documentation, the best there is right now is looking at other addon source code
and asking questions in #addon-talk
I looked at create propulsion code but I don't understand how to registrate and use force attachments and as I noticed it uses outdated VS version
registrate isn't required
its just how create propulsion is setup
theres also http://docs.valkyrienskies.org/ but its very wip
Thanks
especially the gradle section, don't follow that, its outdated
there's also https://github.com/alex-s168/vs2-doc
a bit more outdated but has more useful info
Thanks
So every force attachment runs every tick and don't needs any activation?
runs every physics tick
its an important destinction because its not thread safe
you shouldn't do game tick stuff (basically anything involving a Level) on the physics tick
at the risk of Concurrent modification exceptions randomly
Ok
and in terms of "activation"
it does need to be added to ships
usually on the ship load event
so the usual setup looks something like this
force applier has:
- get or create function. Gets it from a ship or adds it to the ship then gets it from the ship
- add thruster, adds thruster data (pos, strength, etc) to a Concurrent variable (aka a
ConcurrentHashMapor something) - remove thruster, removes thruster data from the concurrent variable
- physics tick function, loops over every thruster data in the concurrent variable and applies the actual forces based on that
Ok
Is physics ticks run on server side only or on client too?
its only run on server side
Ok
Why
because you should avoid doing server-side stuff in the physics tick, at the risk of CME crashes
so you have to use (concurrent) variables to bridge the gap
Ok
hope that helps, feel free to ask questions in #addon-talk or here any time