Not a member yet? Why not Sign up today
Create an account  

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 
Notice to modders- new data management system

#1
Hello.

Let me start by saying that GetParameters1(), GetParameters2(), GetExtraInfo(v) andare depreciated and will be removed entirely on the 5th of May 2019.

SetParameter1(v4), SetParameters2(v4) and SetExtraInfo(v) will stay forever, to allow old designs to be loaded, and their data migrated.


They are replaced by a system that manages 
a) Saving and loading
b) Copy and pasting
c) Multiplayer syncronisation
d) Local change events 
e) Clamping (min, max, etc)
f) More data types (Guid,componentId, Dictionaries,Lists,Colors,Vector4s,Vector3s,Vector2s, enumerations, etc)
g) Quick display on the UI

I've used the example of the Adv Cannon Firing Piece (APS firing piece)

I've made AdvCannonData, which extends PrototypeSystem (yes, I should have refactored the name after it stopped being a prototype, but that ship has sailed).
It defines a bunch of Var objects of different types. See Var<float>,Var<int> and special types such as VarFloatClamp,Var01 in this example, but there are lots more.
Each Var object must have either a Variable attribute on it, defining a unique index to save to. If you want to use a slider for the variable on a UI and define it in one line of code (see below) use the Slider attribute which extends the Variable attribute.
Each index is unique. The name and description can be input (if using Slider these are the display string, and the tooltip).
[Image: oX2vqYX.png]

Next, you make this AdvCannonData object a PUBLIC member PROPERTY of the block.
[Image: SVEa4Fc.png]

Then you can hook up some change listeners. This code is in BlockStart (actually WeaponStart in this case).
[Image: kpNBxza.png]

Then you can use code like this to easily display the info on the UI (as a slider, or as a boolean toggle).
[Image: T5ZhJRZ.png]



For migrating data from the old way to the new way please see this screenshot.
I've commented out GetExtraInfo but kept it in the file so I can see the order data used to be SAVED in.
I've changed the SetExtraInfo so that I am writing this old data into my new data packet, and thus completing the migration of old blueprints to the new format.

[Image: cUa76lO.png]


"Vars" declared like this are automatically saved / loaded / copy / pasted / MP synced 

Here are some more advanced usage notes:

If you want to change a variable but don't want to sync the change over the network (GP PIDs make use of this function to avoid massive amounts of data being sent over the network when controlling hydrofoils, as the PID is run on both client and server), then follow this example
[Image: A8tI5f4.png]


If you want to run a single callback once per frame if one or more variables in the pack has been changed you can use this call (seen in ParticleCannonMeleeLens)
[Image: C3Ptv6I.png]

A single Var change callback function looks like this, giving the new value, the old value, and the type of change.
[Image: hYtukrL.png]




Please share this post with modders that you know.
Reviewed FtD on steam yet? It's the #1 thing you can do to help FtD (and future games by Brilliant Skies!), so please take the time!
Bug tracker - view, "upvote", comment on and add all bugs here.
Request tracker - request new features here
support - private portal to service desk
Reply



Messages In This Thread
Notice to modders- new data management system - by Nick Smart - 2019-04-14, 10:32 AM

Forum Jump:


Users browsing this thread:
1 Guest(s)