Jump to content

Lindor's Alternate Spells Module for Sacred 2 EE development Thread


Lindor

Beta version yes or no?  

1 member has voted

  1. 1. Should i publish an early test version of my unfinished mod?

    • Yes, I want to participate in playtesting.
      0
    • Generally I'd like a Beta version, but if it's really so unfinished yet, you should work on it a little bit more first.
      1
    • No, don't publish until it's perfect.
      0


Recommended Posts

Quick info: it is possible to create new images and assign them to FX.

fx_inq_vergeltung.particle uses flare5.jpg by default. Initially I recolorized that image because there was no flare with the color I wanted. Now I tried to create a new flare7.jpg and assign it to the particle script, it worked perfectly fine, no need to recolorize.

Link to comment
  • Lindor changed the title to Lindor's Alternate Spells Module for Sacred 2 EE development Thread

Okay I'm quite unsure about publishing an early test version.

Generally I'm not a very fast modder, I tend to make lots and lots of small changes even to the tiniest part of the project. There's some little improvement every day, small changes every day has a cumulative effect, but if I'd update my mod every time I make a change I'd flood the forum servers. Not an issue per se, I spoke with gogo about that and he offered me to delete my old mod versions every time I upload a new one (Thank you again!:)), but I think that is a little bit unfair to him, I cannot expect him to keep track of my mod every day. So the Beta would probably stay in a very unfinished state for a long time.

I have a hard time deciding what to do, generally I want to publish it but I also know the mod's not quite there yet. That's why I made a public poll for it with this thread. Please vote and help me making a decision. Thank you!:)

Link to comment
On 4/11/2022 at 12:52 AM, Lindor said:

Quick info: it is possible to create new images and assign them to FX.

fx_inq_vergeltung.particle uses flare5.jpg by default. Initially I recolorized that image because there was no flare with the color I wanted. Now I tried to create a new flare7.jpg and assign it to the particle script, it worked perfectly fine, no need to recolorize.

Just noticed: EE 3.1 does this too, so I'm gonna go with flare8.jpg then.

Link to comment
  • 2 months later...

Quick info: I have a really bad bug atm with Sacred 2, it's mostly visual but can also lead to character freezes / game crashes. The visual part of the bug symptoms is that Deylen's shoulder item does not get rendered correctly and the glow channel is just outright red while diffuse is just a little bit red-er than normal.

I have tried everything I know to get rid of this bug, from steam file validation over re-installation up to registy cleansing, I simply can't get rid of it so I don't know when I'll be able to continue my shader project.

 

If anyone has experience with such a thing and/or knows a possible solution, pls let me know.

Link to comment

The poll is interesting!
The question is, which approach is the most reasonable.

Work silently and unleash the whole shebang as a whole:
+ Calm and relaxed working
+ Far less pressure on the modder due to the lack of a demanding community
+ Strong focus on the project since distractions are missing
- Community looses interest and moves on, or has never heard of it.
- No checks and balances from a third side.
- No feedback, input, or morale boost, since the community is not involved in the making.

Step-by-step release with fequent updates:
+ Mod gests constantly checked by the community, feeback is coming in all the time.
+ More players become interested and want to play the new mod.
- People go easily into the but-it-is-not-exactly-like-I-want-it mode and start calling your mod cheap trash and cr!p.
- High pressure on the modder to deliver all the time can lead to frustration and finally burnout.

Share with other modders only until the mod is ready:
+ Give and take. You help fellow modders, they help you.
+ Qualified ideas and input are coming in.
+ Expertise is exchanged.
+ Make some friends in the best case
+ Relaxed working withing a circle of people, who know how much work it is to get things done.
- People dislike each other, maybe even start fighting
- You (might) get ripped

 

Sorry for being off topic a bit.

Edited by Dax
Link to comment
2 hours ago, Dax said:

Sorry for being off topic a bit.

No problem, thx for your thoughts on this topic!

2 hours ago, Dax said:

Step-by-step release with fequent updates:

-I would flood the darkmatters servers since there is very tiny improvement every day

2 hours ago, Dax said:

- People dislike each other, maybe even start fighting
- You get ripped

Doubt that would happen, esp. in this community. But I also doubt that other modders have a lot of interest into my unfinished mod either.

So for now I'm going with this option:

2 hours ago, Dax said:

Work silently and unleash the whole shebang in a whole:

The whole loose interest thing is not that bad, the interest will probably come up again once it's released. What is really a problem though is the no feedback thing. That's why I'm trying to keep you up to date whenever I'm working on something new and big, like the fur shader and the galaxy shader.

There will probably be a beta version once I've completed all the main goals on my list.

 

----------

On 6/16/2022 at 9:26 AM, Lindor said:

I have a really bad bug atm

I have defeated the bug. It was definitely a texture but I'm not 100% sure what exactly it was, either it was a single texture somehow becoming corrupt or it was that there were too many unzipped/uncompressed textures present at once. One of the two.

  • Like! 1
Link to comment

As for Sacred 2 it all goes well I think. Overlookers got ripped very early. There is a guy who has uploaded the new versions of Reborn immediately after release and revealed years later, that he is not part of Overlookers Klan. Such things are always painful for the makers. Maybe that was the reason they have switched to bit.ly Look here: https://www.moddb.com/downloads/sacred-reborn-v321

Speaking of missing feedback, it is a well known problem here. Work in the first line for yourself. Thats the best way to deal with the issue.

  • zomgod! 1
Link to comment
On 6/18/2022 at 12:33 PM, gogoblender said:

Early morning hug

for defeating the bug

:hooyaah: @ :spock:

gogo

Haha thx. It was 12:33 PM for me when you sent this though :)

On 6/18/2022 at 6:06 PM, Dax said:

As for Sacred 2 it all goes well I think. Overlookers got ripped very early. There is a guy who has uploaded the new versions of Reborn immediately after release and revealed years later, that he is not part of Overlookers Klan. Such things are always painful for the makers. Maybe that was the reason they have switched to bit.ly Look here: https://www.moddb.com/downloads/sacred-reborn-v321

Aw man that sucks.

  • Like! 1
Link to comment
1 hour ago, Lindor said:

Initially I wanted it to make earth spikes with DM wall FX, but these FX don't behave as I want them to, I couldn't find a spellclass which would make them like a circle of earth spikes. Also I don't know wether they're resizable.
@Flix @dimitrius154 maybe you know some more about these FX? The dream of earthspikes is weakened but not dead yet.

It was a stroke of luck to discover that the Radiant Pillar spellclass turned Magic Wall into a single damaging spike.  I feel like I ran through every single spellclass and never got a better result than that.  That was 5 years ago though, maybe something slipped by me.

The only non-code thing I can think of is editing the model and animations of the earthen spikes.

Link to comment
On 6/23/2022 at 4:15 AM, Flix said:

It was a stroke of luck to discover that the Radiant Pillar spellclass turned Magic Wall into a single damaging spike.  I feel like I ran through every single spellclass and never got a better result than that.  That was 5 years ago though, maybe something slipped by me.

The only non-code thing I can think of is editing the model and animations of the earthen spikes.

I haven't been much more successfull since then, sadly. There are a couple of other spellclasses which do the same as Radiant Pillar, but couldn't find one which behaves the way I wish. But I'll see if I can get the modelling to work.

 

---------------

 

I have set up a tool to calculate the distribution of different bonus tiers around items of different tiers via the normal distribution function:
https://www.desmos.com/calculator/dojibnc9zd
You can play around with it as you like, just need min and max item tier, min and max bonus tier and min and max amount of boni. Then you'll need to adjust j for the current item tier input as stated in the description and it'll give you the distribution of the boni.

I used the tool to get this:

Spoiler

image.png.7aa23519d94f1f0a05a5b112a74f24fd.png

EDIT: I have set up the option to widen the range of the distribution, although sometimes on very low values it might not work anymore because of the rounding used. Here is what the same distribution as above looks with double the range (well not exactly the same, increased the number of max slots from 3 to 4):

Spoiler

image.png.86ad117e7dbc2c917be6bd7d7fc53027.png

EDIT2: I made it so that the range linearly increases from normal range at min item tier to whatever you set the max value to at max item tier to avoid the breakage at low item tiers caused by the rounding. It works, but the j-value may need very sensitive adjustments at low item tiers. I've had it down all the way to 10^-8 so far. Link has been updated.

It produces following distribution for max range of 2:

Spoiler

image.png.9c994517f9124d3ba738ba5006fac45d.png

A little bit less spread out, but more mathematically founded with less manual correction.

 

Sooo... which one of the three distributions you like the most?:lindor:

Edited by Lindor
Link to comment

I have written a lua script which does everything from above automatically so you don't have to do it all manually.

Spoiler
local itemtiers = {1, 15}
local bonustiers = {1, 15}
local amounts = {0, 8}
local range = 4

function dist(x, T, p)
    local e = 2.71828183
    local A = ((amounts[2] - amounts[1]) * T + amounts[1] * itemtiers[2] - amounts[2] * itemtiers[1]) / (itemtiers[2] - itemtiers[1])
    local M = ((bonustiers[2] - bonustiers[1]) * T + bonustiers[1] * itemtiers[2] - bonustiers[2] * itemtiers[1]) / (itemtiers[2] - itemtiers[1])
    local R = ((range - 1) * T + itemtiers[2] - range * itemtiers[1]) / (itemtiers[2] - itemtiers[1])
    local retval = (A / R) * e^(-0.5*((p*(x-M))^2))
    do return retval end
end

function createset(T, p)
    local set = {}
    for n = bonustiers[1], bonustiers[2] do
        do set[n] = math.floor(dist(n, T, p) + 0.5) end
    end
    do return set end
end

function sum(a)
    local val = 0
    for k = 1, #a do
        do val = val + a[k] end
    end
    do return val end
end

function check(T)
    local s = math.floor(((amounts[2] - amounts[1]) * T + amounts[1] * itemtiers[2] - amounts[2] * itemtiers[1]) / (itemtiers[2] - itemtiers[1]) + 0.5)
    do return s end
end

function adjust(T)
    local k = 0.5
    local j = 1
    ::loop::
    while (sum(createset(T, j)) > check(T)) do
        do j = j + k end
    end
    if (k > 0.000000001) then
        do k = k / 2 end
    else
        do return createset(T, j) end
    end
    while (sum(createset(T, j)) < check(T)) and (j > k) do
        do j = j - k end
    end
    if (sum(createset(T, j)) == check(T)) then
        do return createset(T, j) end
    else
        do k = k / 2 end
        goto loop
    end
end

for I = itemtiers[1], itemtiers[2] do
    do print(table.concat(adjust(I))) end
end

 

You can copy-and-paste it into here and run it:

https://www.lua.org/cgi-bin/demo

The first four lines of the script are the parameters you can adjust. the first number is always the minimum value, the second the maximum value.
Keep in mind that the output is concatenated together, so if an item can have more than 9 boni you must keep an eye for numbers with more than one digit.

Edited by Lindor
Link to comment
34 minutes ago, Lindor said:

there is a semicolon ";"

My honest assumption - it's a psychological matter, the person coding the stuff used to work with C++. You know, we have a popular joke about the Tiger tank transmission solution and rows of plates.

Link to comment

@Flix @dimitrius154

I'm currently writing the program with which you can updates my exported files with your blueprint.txt. The program is pretty much finished if I decide to keep the current syntax of these 16 files, but I may use original blueprint.txt's syntax. Haven't decided yet.

This is what the syntax of the files currently looks like:

Spoiler
--id, name, dmgvariation, tier, allotment_pmfpi, bonusgroup0-8, itemtypes, weargroups

local armor = {
{2003, "_hero_cloth_leg_ornamented_junk", 0, 0, {1000, 0, 0, 0, 0}, {614, 750, 1, 9, 0}, {613, 750, 1, 5, 0}, {612, 750, 1, 2, 0}, {10757}, {"WEARGROUP_INQUISITOR"}},
{1332, "_hero_helmet_mutze_fight_junk", 0, 0, {1000, 0, 0, 0, 0}, {298, 750, 1, 9, 0}, {297, 750, 1, 5, 0}, {295, 750, 1, 2, 0}, {5633}, {"WEARGROUP_DRYADIN"}},
{1252, "_hero_helmet_mutze_fight_normal", 0, 1, {1000, 0, 0, 0, 0}, {298, 900, 1, 9, 0}, {297, 900, 1, 5, 0}, {295, 900, 1, 2, 0}, {5633}, {"WEARGROUP_DRYADIN"}},
{2223, "_hero_helmet_reif_fight_magic", 0, 5, {1000, 0, 0, 0, 0}, {298, 1100, 1, 9, 0}, {297, 1100, 1, 5, 0}, {295, 1100, 1, 2, 0}, {10137}, {"WEARGROUP_DRYADIN"}},
{2222, "_hero_helmet_reif_fight_normal", 0, 2, {1000, 0, 0, 0, 0}, {298, 1100, 1, 9, 0}, {297, 1100, 1, 5, 0}, {295, 1100, 1, 2, 0}, {10137, 10444}, {"WEARGROUP_DRYADIN", "WEARGROUP_HIGHELVE"}},
{1515, "amulet_bg_magic_rare", 0, 9, {1000, 0, 0, 0, 0}, {774, 750, 1, 9, 0}, {773, 750, 1, 5, 0}, {7165, 7166, 7167, 7169, 7170, 7173, 7177, 7179, 7180, 7181, 7182, 7190}, {"WEARGROUP_DEFAULT"}},
{1514, "amulet_bg_std", 0, 4, {1000, 0, 0, 0, 0}, {773, 500, 1, 2, 0}, {7164, 7165, 7166, 7167, 7168, 7169, 7170, 7171}, {"WEARGROUP_DEFAULT"}},
{1516, "amulet_bg_std_magic", 0, 5, {1000, 0, 0, 0, 0}, {773, 600, 1, 9, 0}, {772, 600, 1, 5, 0}, {7165, 7169, 7170, 7171, 7172, 7173, 7174}, {"WEARGROUP_DEFAULT"}},
{1517, "amulet_bg_std_rare", 0, 7, {1000, 0, 0, 0, 0}, {774, 700, 1, 9, 0}, {773, 650, 1, 5, 0}, {7165, 7173, 7174, 7175, 7176, 7177, 7178, 7179, 7180, 7181, 7182, 7183, 7184, 7185, 7186, 7187, 7188, 7189, 7190, 7191, 7192}, {"WEARGROUP_DEFAULT"}},
{1978, "artefact_single_fire_magic", 0, 5, {0, 0, 0, 0, 0}, {646, 900, 1, 5, 0}, {10904}, {"WEARGROUP_DEFAULT"}},

 

etc.

Pretty much all unnecessary data stripped off, just that armor still has dmgvariation which I would be able to strip away as well, but it would be a lot of work so it stays for now. The bonus IDs will get replaced with the bonus name later, my scripts will automatically link them to the correct IDs.

 

 

Sooo what do you think? New syntax okay or better keep old syntax where each item takes multiple lines?

Link to comment

@Flix @dimitrius154
Okay I have decided to keep old scheme and it works. Next question:

Theoretically I could get rid of the concept of 'hard-assigned' blueprint IDs. The IDs would get automatically generated by the order the items are loaded in, and I could easily write a function which inputs the item name and outputs the ID. One item property less to care about, especially useful when creating new items.

However this would require me to also implement the get-ID-by-name-function into all the other scripts which need the ID, like questscripts.txt. I would make blueprint.txt to save all the name-ID-relations in a file calles IDs.lua and then load that file as a module for all scripts which require item IDs. Items would no longer get chosen by their ID but by their name. Also it would become important to make sure that no two items share the same name.

 

What you think? You have some pro or contra arguments?

Link to comment

How would you handle the item name text? Random items could still use the csv files in the locale folder*, but unique, set, and legendary still need static names in global.res.

 

* I assume, but given that modifiers determine the item names and bonus behavior is changing, that may change as well.

  • Thanks! 1
Link to comment
30 minutes ago, Flix said:

How would you handle the item name text? Random items could still use the csv files in the locale folder*, but unique, set, and legendary still need static names in global.res.

 

* I assume, but given that modifiers determine the item names and bonus behavior is changing, that may change as well.

oh that's true I didn't think about that hashes are generated by IDs. Hmm if I knew how the hash generation and the global.res encoding works I could do something here, but Pesmontis was the only one who ever figured that out.

 

EDIT: okay this is a wierd idea, but I think it may be possible to use ItemnamesMaterial.csv. for each item with a fixed name it would be required to duplicate the material used in material.txt, then name the material by some scheme and then manipulate itemnamesMaterial.csv to assign the name as scripted in the files to the item which uses said material. And that all needs to be automated. But how on earth can be made sure that the name is assigned by the material and not by the boni?

Edited by Lindor
Link to comment

I have done some hash generation analyzing.

The sequence:
a, aa, aaa, aaaa....
Is outputting (65 / 112) * ((113 ^ n) - 1) as a hash, but only the last 32 bits of the number in binary.

Also for this sequence:
a, b, d, e, f, g....
it's outputting 65, 66, 67, 68, 69......

and for this:
a1, a2, a3, a4, a5....
it's outputting 7394, 7395, 7396, 7397...

I think I might be able to figure out the full formula. But what scares me is global.res de- and encoding which will be required in order for this to work.

Link to comment

and bing bing bing bing we got a winner!

for b, bb, bbb, bbbb... it's indeed outputting (66 / 112) * ((113 ^ n) - 1).

So if v is the value of the input key at position 1, and n is the position of the key, then the formula for the final value of the key is:

(v / 112) * ((113 ^ n) - 1) - (v / 112) * ((113 ^ (n-1)) - 1)

which is equal to

(113^(n-1))*v

It would be simpler if we start counting from 0 instead of 1, like a real informatician, so the formula would be even more simplified to v*113^n.

Then this process is repeated for each key, all the values are added together and the last 32 bits of the value in binary are our output hash.

One could also say that the hash is the value of the input in base 113.

What is important to note is that, despite being unlikely, it is possible for two distinct inputs to produce the same hash because only the last 32 bits are taken. If the full value was taken, then it would be impossible for two inputs to produce the same hash.

I will provide an example for this in the next post.

Edited by Lindor
Link to comment

An example is insanely hard to construct. Since the base value is determined by ASCII code and some keys are not present at the keyboard. The whole thing gets complicated by the fact that it doesn't care for big or small letters and reads everything as small big letters.

E.G. "aaaaa" would produce the same hash as 12 101 36 79 33.
The ascii values 36, 79 and 33 would correspond to the keys "$", "O" and "!"
But 101 would correspond to "e", which Sacred 2 would read as "E".
Also 12 would correspond to something which is called a control character which is not present at the keyboard.

So yes, while technically two inputs can produce the same hash, it's nearly impossible to construct something like that since the only chance is pure guessing and then hoping, that all the resulting values are in the acceptable range.

EDIT: and yes, practical examples do exist. The system can hold a max of 2^32 different hashes. Given that there are 26 letters, there don't need to be duplicates with a 6-letter-word, but already a 7-letter-word needs to hold at least 3.736.842.880 duplicates. And that doesn't even count numbers and all the other symbols.

Edited by Lindor
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...
Please Sign In or Sign Up