Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reforged HD: Only <=8 lightning effects correctly rendered #17

Open
Luashine opened this issue Nov 18, 2023 · 1 comment
Open

Reforged HD: Only <=8 lightning effects correctly rendered #17

Luashine opened this issue Nov 18, 2023 · 1 comment

Comments

@Luashine
Copy link

Luashine commented Nov 18, 2023

External URLs

Hive Discord in modding: https://discord.com/channels/178569180625240064/311662737015046144/1174875053385584731

Game Versions

1.36.0 (1.36.0.20144, 1.36.0.20171, 1.36.0.20200, 1.36.0.20210)

Summary

If showing more than 8 lightning effects, it causes them to not render (at all) even those before the limit of 8.

Description

Original issue troubleshooting, courtesy of P4RI4H:

Anyone familiar with lightning effects?

I am looping through a group and creating an anchor point dummy unit and have a target unit, i'm adding a lightning effect connecting this points. If I have >8 units in the group/table it only makes like 1 - 2 effects, the effects print, they're not null, and they are no where else to be seen on the map, but when the unit group is <=8 then all lightning effects seem to spawn and work as intended, I don't see anything wrong with my implementation, but maybe someone has experience with lightning effects?

This is how i'm getting my table of targets made.

// See "code 1"

For Loop Attempt

// See "code 2"

I even tried using ipairs to see if maybe my loop logic was flawed, but both seem to yield identical results.

// basically same as code 2 but ipairs

I need this to be able to work when the unit group is <= 10, and not <= 8


Response by me:

The code looks fine to me. For SD there are lighting (not lightning) bugs in the render engine when you have too many sources a game chunk turns darker. Thats too on the order of 8.
Try in SD rather than HD
Try to create a special effect for visualization instead
Try with a different lightning
Try hiding only the first 5 out of 10 lightnings and see if the latter show up


Author's response:

it's the 8 lightning limit on HD that was the problem.

sd it works perfectly

Additional Information

No response

Expected

Unlimited amount of lightning effects to render correctly

Actual

Inconsistent, broken rendering beyond 8

Reproduction steps

Code 1:

    local x, y = GetUnitX(caster), GetUnitY(caster)
    local group = CreateGroup()

    -- Get all units in the radius
    GroupEnumUnitsInRange(group, x, y, RADIUS, nil)
    targetUnits = {}
    for index = 0, BlzGroupGetSize(group) - 1 do
        local unit = BlzGroupUnitAt(group, index)
        if IsUnitEnemy(unit, GetOwningPlayer(caster)) then
            table.insert(targetUnits, unit)
        end
    end
    DestroyGroup(group)

Code 2:

for i = 1, #targetUnits do
    local target = targetUnits[i]
    local ax, ay = GetUnitX(target) + GetRandomReal(-200, 200), GetUnitY(target) + GetRandomReal(-200, 200)
    local tx, ty = GetUnitX(target), GetUnitY(target)

    -- Create anchor point
    local anchor = CreateUnit(Player(PLAYER_NEUTRAL_PASSIVE), FourCC('h000'), ax, ay, 0)
    table.insert(anchorPoints, {anchor = anchor, target = target, distanceThreshold = 300})

    -- Create lightning effect
    local lightning = AddLightningEx("LEAS", true, ax, ay, GetUnitFlyHeight(anchor) + 50, tx, ty, GetUnitFlyHeight(target) + 50)
    print("Lightning Effect Made")
    table.insert(lightningEffects, {effect = lightning, target = target})
end

Workaround

Play in SD mode. HD mode: none?

Screenshots, test maps, other material

Cannot attach directly in this field, wait a sec

@Luashine
Copy link
Author

VIdeos: 1.2MB for both

HD:

lightning-hd-bug.mp4

SD:

lightning-sd-nobug.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant