Slavers Of Skyrim: Slavery Framework changes
Dear Readers!
This blog post somewhat deep dive into scripting and how the slavery player and Slavery NPC framework going to work.
I write this for mod makers and those who interested how this mod made and what challenges I face during development.
TLDR at the end.
The problem:
It's a complex and big. I have multiple functionality that one mass provides we call slavery player framework, another mass in very early planning phase called slavery NPC framework.
Both need work together. Both has going to own unique script codes. This codes form functions like keeping track player mind status. This is one functionality.
Best if we image a function a working person who do exactly one job. We have lot of workers I estimate around 10 of them currently and over time few more added.
Now this workers organized a hierarchy where on the top is the manager boss. This boss can give orders middle level manager bosses that pass down the chain the orders.
End of the chain is the workers.
All person on this system need to able talk others: to pass the command and result of the command execution.
As long as command-response happen inside a chain can be easy done no problem. Things go crazy when things happen that affect multiple chain of command line at once.
This case here is what happen: one worker detect something big happened and inform its middle manager boss, this boss then inform other bosses: hey we have a big event here!
Then all other affected bosses send information to its workers.
This system built up and working as is. Problem the case when I need expand the system: every time I add new manager boss I need check the chain of command and communication and if needed extend it manually.
This is lot of work some cases.
More bigger concern: every time a person need to able to talk other person need to know it well. This makes each code and functionality start depend on other functionalities and codes.
With it if one place a error happen or change, has unforeseen effect on many other parts of the framework. To avoid this I started separate the code but this communication lines need kept.
The solution:
Invent a universal language that every worker understand. This language need to be:
-
can be used to transfer any data
-
expandable easy to change very flexible
-
the code not need rewritten when new type of information need to be sent
Part of the solution set up this system the way that all worker and manager+manager boss can be same room to hear the communication and filter out what one need to hear.
This means every time new worker added to system automatically receive all information that worker may need. No need to build up separate communication chain to built up.
Other good side complete code separation achieved (one of my great aim). So less likely need re write again and again same code.
The drawback:
Well yes we have some drawback... we have always! This means I need create more code to transfer the information to workers and from workers to common language. This means we have more potential point of failure.
Plus if I want fully implement this new approach I need rewrite lot of working code.
Hidden bonuses:
I found out 2 things that made my system more effective than anything ever I built before:
First array inputs a function can be different size the array size determined the code where the array size defined. This is big because a single function can accept different size of arrays!
Why this important to me? I can make a Form array that can store up to 127 forms and send through this system. Same for all variables types.
This more than enough information storage to send... this not only make possible send events like the original game (script events that uses key words, limited to few integers)
Other goodies I can scale up or down the sent data amount based on how many data need sent!
Second hidden bonus: I can use this system not only send events but direct orders to what to do.
Basically I have multiple modules that need work together to make the framework work. This under old structure required lot of coding when new element inserted in.
In short term using this common language layer give me extra work yes, but in long run make more easy to add new workers to the system. Added bonus when I make a code I don’t need think or plan what's going to be added next time, how build connections.
Because already connections built up.
TLDR:
Made a new module that make possible multiple part of the SLOS communicate each other and send lot of data very easy.
This modules don’t need know each other and not need use closely pre-defined standards to transfer data.
This make more easy to scale up or down the mod and adding new modules.
Plus makes modules code independent mostly to each other (one of my coding wet dream come true!)
0 Comments
Recommended Comments
There are no comments to display.