mehah / otclient

An alternative tibia client for otserv written in C++20 and Lua, made with a modular system that uses lua scripts for ingame interface and functionality, making otclient flexible and easy to customize
Other
242 stars 177 forks source link

light system bug #764

Closed patrykq112 closed 1 month ago

patrykq112 commented 2 months ago

Priority

Medium

Area

What happened?

this bug has been around for a long time

What OS are you seeing the problem on?

Linux, Windows, MacOS

Code of Conduct

mehah commented 2 months ago

@patrykq112 test plz https://github.com/mehah/otclient/pull/765

patrykq112 commented 1 month ago

@mehah the same bug still occurs

mehah commented 1 month ago

@patrykq112 I can't reproduce this problem, try this here:

replace onCameraMove for

void MapView::onCameraMove(const Point& /*offset*/)
{
    requestUpdateMapPosInfo();
    if (isFollowingCreature()) {
        updateViewport(m_followingCreature->isWalking() ? m_followingCreature->getDirection() : Otc::InvalidDirection);
    }

    g_drawPool.repaint(DrawPoolType::FOREGROUND_MAP);
    g_drawPool.repaint(DrawPoolType::CREATURE_INFORMATION);
    g_drawPool.repaint(DrawPoolType::LIGHT);
}
patrykq112 commented 1 month ago

@mehah it didn't help, still the same bug

mehah commented 1 month ago

@patrykq112 I need a tip on how you are reproducing this, in my environment, which I use Tibia as a base, it doesn't happen.

mehah commented 1 month ago

https://github.com/mehah/otclient/assets/2267386/a033a0a0-0333-42da-b07d-c1f350d7b89a

mehah commented 1 month ago

Are you able to simulate this in Tibia? @patrykq112

mehah commented 1 month ago

I created a method to return to the old algorithm, uncomment this line and test it.

in lightview.cpp image

xrddw126 commented 1 month ago

I will honestly say that I also have huge problems with light on this client. I have the January version and in addition to the problem above, there are some black shadows that have a noticeable delay when walking

Maybe the problem is that I am using the 8.54 server, but from the January version these problems with light started until I turned it off completely

The problem most often occurs when objects that generate light appear on the map while walking

mehah commented 1 month ago

@patrykq112 What is your PC configuration?

This delay is probably occurring because things are running asynchronously and your CPU can't keep up, later I will redo some things to try to solve this problem.

patrykq112 commented 1 month ago

@patrykq112 What is your PC configuration?

This delay is probably occurring because things are running asynchronously and your CPU can't keep up, later I will redo some things to try to solve this problem.

Laptop, AMD Ryzen 5 4500u, 16 GB ram, windows 11.

try replace "g_game.walk(dire, firstStep)" to "g_game.forceWalk(dir)" in function "smartWalk" in file game_inferface/gameinterface.lua

When I did this, the bug occurs every time I walk

mehah commented 1 month ago

@patrykq112

This doesn't happen here, please test with a clean client, without modifications and see if it happens, because honestly, I don't know if your project is 100% updated according to the project found on this github, I've had a lot of problems with that. people reporting problems that simply didn't update or updated everything wrong and I spent hours trying to figure it out and ended up discovering that the problem didn't exist.

So please record a video with this problem occurring in the most recent client and without any modifications, as I am not responsible for customized projects.

patrykq112 commented 1 month ago

@mehah

https://github.com/mehah/otclient/assets/16617982/a8b81ccd-7780-4e12-92c0-bbc96a2dcdee

mehah commented 1 month ago

@patrykq112 ok, I'm going to redo some things to get rid of this problem once and for all.

mehah commented 1 month ago

try again @patrykq112 https://github.com/mehah/otclient/pull/765

patrykq112 commented 1 month ago

@mehah

this bug no longer occurs, but shadows appear in random places when walking around the map and there is a visible drop in fps (in some places even from 500 to 200)

mehah commented 1 month ago

@mehah

this bug no longer occurs, but shadows appear in random places when walking around the map and there is a visible drop in fps (in some places even from 500 to 200)

I'm not finished yet, I just asked you to test to see if you at least fixed the old bug, other bugs may occur, as I'm throwing everything into a separate thread and redoing the logic.

patrykq112 commented 1 month ago

@mehah this bug no longer occurs, but shadows appear in random places when walking around the map and there is a visible drop in fps (in some places even from 500 to 200)

I'm not finished yet, I just asked you to test to see if you at least fixed the old bug, other bugs may occur, as I'm throwing everything into a separate thread and redoing the logic.

This bug no longer occurs after these changes 😊

mehah commented 1 month ago

@patrykq112 test again :)

patrykq112 commented 1 month ago

@mehah It's better, there are no more FPS drops, no shadows appear in random places.

patrykq112 commented 1 month ago

I added if (!tile) continue; after for (const auto& tile : map.shades) { , for (const auto& tile : map.tiles){ and it helped

I noticed that if there are a lot of characters running next to you with lights and they run off the screen, all the lights flash

mehah commented 1 month ago

@patrykq112 test again.

patrykq112 commented 1 month ago

@mehah now it works very well, the light no longer flashes 😊