ALRIGHTY! I am back as promised with a heafty update! I have gotten the largest segment of the new system completed, that being the actual TF speed function and all of it's component parts, assembled and somehow working with seemingly no major issues on my end? (I still have no idea how I managed to get all this set up with no issues that took forever to work through. Maybe all that programming i did last quarter in college accounted for something after all?)
Anyway, I will also repost the first section that I already submitted as I know that I had added at least three lines of code to it, and I might have changed something in there as well, ( I don't recall). What you should be able to see pretty clearly is that, even if you decide that you want all different numbers for your game in the end, the function that I have prepared, although undeniably daunting. should actually be pretty easy change and modify at your leisure! I hope you can also now see why I think we can consider replacing the priority system, if we are replacing the TF system.
With this, you should have all the tools you need to reverse engineer it and be able to play around with it in your own engine and programming style. My next goal is to finish all this work up with the section on your Transformation rank, which is way less complicated but will contain some extra fluff for you to consider. Then, I think I might try to reorganize all my code to take up less space, (you know, so it is not an essay written in comments.), and so that I can run some simulations to get a better idea of how it works and behaves over time and in a hypothetical gameplay scenario.
Let me know if you want me to send you a copy with all the comment code removed?
-----
clear;
clc;
% Written by DukeofBrittany, 7-25-2024 to 7-30-2024
% Theoretical plan for Transformation Dungeon mechanics
% First things first, understand that it has been a couple months since I last programed at all, and Octave/matlab format is ...unique, to put it one way.
% For example, the way it uses ';' is very unusual, as I am lead to beleive.
% so, half of this is me just doing it under te excuse of 'practice and review'.
% remember, all of this is intended to be hypothetical, and might not be representative of how it would actually work in gameplay.
% General order of operations:
% 1. Run TF speed timer.
% 2. Calculate priorities
% 3. set up base transformationspeed value
% 4. compute new base transformation speed value
% 5. store that and also figure out wether or not there are any additional factors that need to be applied.
% 6. determine transformation rank useing priorities and found number.
% 7. apply effects of transformation rank.
% First, how and when should we update our TF speed value?
% I am thinking that it should attempt to update either when when their is ample reason to, such as death or a cursed item being updated, or after enough time has passed with no other stimuli.
% How I am going to model this is to perpose that we use an inturuptable 'for' loop.
% It will either update everything after 50 turns, or imidiately after one of several conditions are met.
% for sake of simplicity, and becuase I only know how to write code that can read one line at once and only do one thing at a time, I will also tie the natureal decay of the TF priority to this for now as well.
% So, I need to get those set up. Octave/matlab is very weird about when exactly it lets you redefine variables, so I am going to have to get a bit creative with things.
% (Hopefully, you are not haveing to jump through hoops like these, i would be suprised if you were.)
% I will just use three enemies for sake of argument and simplicity.
Bunny_priority=[0:0.1:100]; % How much influence one enemy is exerting, from 0 to 100, in increments of 0.1. This is NOT to be confused with a measure of your net transformation level.
Mouse_priority=[0:0.1:100];
Cat_priority=[0:0.1:100];
% and becuase Octave is weird like that, i'm going to predefine the priorities further to have an example to work with.
% basically, it's so I can refrence what I have them set as so I don't get confused later, and so you know where the inital consitions of the model are comeing from.
Cat_priority(331)
Mouse_priority(546)
Bunny_priority(159) %In different words, this code here does nothing except call the value stored at that location of the vector. It's redundant outside of me keeping track of numbers.
for F=1:50 %where F refers to the amount of turns passed since our inital condition.
% Every turn, I will decay the amount of pririty of all enemies by a tiny bit, then check to see if anything inturupted the wait timer.
% I will try to make this the last time I mention this, but Octave only saved the vector I establised inialy in lines 29-13. Technically, we are doing nothing here, and having to handle numbers manually. I am sure Unity dosent have these issues, and you are able to redefine variables as you plese.
% [Enemy's_prioroty((F)]=(Enemy's_priority(Inital_test_value-F));
[Cat_priority(F)]=(Cat_priority(331-F));
[Mouse_priority(F)]=(Mouse_priority(546-F));
[Bunny_priority(F)]=(Bunny_priority(159-F));
%Cat_priority(F) %(I like to comment out my temporary, bad, and refrence code, instead of deleting it.)
%Mouse_priority(F)
%Bunny_priority(F) % I did encounter a weird bug at this step where, unsupriseigly, if you went below the vector range, Octave will call an error.
%Weirdly, though, if the values got too low, but didin't leave the vector, it would start counting back up. Dunno what's up with that, let's just choose to ignore it.
% It's stange, as Octave is predominantly for being a calculator, and this is how I was tuaght to use it. Anyway.
% If (Death>=1 || Cursed_item_update >= 1 || TF_from_damage >= 1 || other_relavant_flag >= 1)
% In the event that another thing happens that would nessesitate the TF speed value be updated, we would first apply the nessasary ajustment to the prioroty:
% Example:
% If we died to a Cat,
% [Cat_priority(H)]=(Cat_priority(F+300)) && "All_Other_Priorities(H)"="All_Other_Priorities(F-50)"
% Death I feel will raise the priority of the enemy you died too by a lot, and erode the priorites of the others a small amount.
% Example:
% If the Bunny ears entered phase three, I.E. it fully activated,
% [Bunny_priority(H)]=(Bunny_priority(F+700)) && "All_Other_Priorities(H)"="All_Other_Priorities(F-200)"
% Example:
% You took damage from a mouse and rolled to get transformed,
% [Mouse_priority(H)]=(Mouse_priority(F+30)) % No compensation from the others. This I expect to be going off a lot.
% And then, we will forceably leave the for loop and move onto the next calculation.
if (F==50)
IdleB=0.25; % somethiing for later, don't worry about it.
endif
end
% We will assume, for this example, that the for loop was completed without being inturrupted.
display("----")
Cat_priority(F)
Mouse_priority(F) % just to ensure that my numbers and calculation is working correctly.
Bunny_priority(F)
display("----")
% At this time, the priorities of each enemy is as follows, Cat=28, Mouse=49.5, and Bunny=10.8.
% If fully human and "cured", I.E. not experienceing an ongoing transformation, Any one enemy needs a priority of 25 or higher in order to start a transformation,
% The reason the threshold is at 25/100 is becuase the game will choose the transformation with the highest current priority, I want the various transformations to fight over the player, and there will be a minor TF speed penalty for having high priorities.
% and,, this is the only place the transformations have a hierarchy of any kind. Basically, if there is a tie, then the game will favor one over the other.
% Also, this algorythim here will also check the H value instead of the F value, in the event one of the inturrupt conditiond is set off.
%I kept things simple here, but hopefully, you can see that with every new enemy added to the game, you should be able to just build it out backwards, or maybe use a switch?
if (Cat_priority(F) >= 25 || Mouse_priority(F) >= 25 || Bunny_priority(F) >= 25)
display("A Transformation is occuring!")
if (Cat_priority(F)>=Mouse_priority(F) && Cat_priority(F)>=Bunny_priority(F) && Cat_priority(F)>=25)
display("Cat TF active!") % I.E. set Cat as your current transformation.
elseif (Mouse_priority(F)>=Bunny_priority(F) && Mouse_priority(F)>=25)
display("Mouse TF active!")
elseif Bunny_priority(F)>=25
display("Bunny TF active!")
else
display("This condition should not be able to appear, but is included as a failsafe.")
end
% move on to TF speed calculation.
else
display("No TF active...")
% move onto TF speed calculation.
end
% assumeing that I set everything up correctly, this should recognise that both Cat and Mouse succeeded the check, but that Bunny failed.
% Then, it compares all the priority values against each other, and concluded that Mouse was the highest, which it is. In the event that the highest two prioritys were equal, cat would have been selected over mouse.
% But, at least on this scale test, you should be able to see how this priority system works, and hopefully you can see how it would be pretty easy to add new enemies to the system without much difficulties.
% Additionally, I hope you can see all the little ways you could ajust the present priorities for all the enemies useing these numbers.
% Like, maybe the biome could, depending on the enemy type, could apply passive multipliers to all priority gain and loss, (excludeing time decay), for how much it likes or dislikes the biome.
% For example, bunnies in the plains (or whatever it's refferd to in game) biome would increase all priority gain by 1.5 times, and reduce all priority loss by 0.8 times.
% However, that's beyond the scope of this project. Moveing onto the actual TF speed calculator finally...