otland / forgottenserver

A free and open-source MMORPG server emulator written in C++
https://otland.net
GNU General Public License v2.0
1.59k stars 1.06k forks source link

Graphics Stalling #2287

Closed Codinablack closed 7 years ago

Codinablack commented 7 years ago

Before creating an issue, please ensure:

Steps to reproduce (include any configuration/script required to reproduce)

  1. Login on any player type and proceed to area with no light and variable ground tiles.
  2. Walk around with a torch or light spell active to fill entire screen. No problems, expected behavior.
  3. Disable all light sources and walk around. Be amazed at the sudden stalling and freezing of the graphics.

Expected behaviour

Graphics transition should be same as with light.

Actual behaviour

Graphic environment stalls, even freezes at times (usually when walking over a patch of ground that is slower than the rest or has a rock or something on it).

Environment

Stock. I used most recent nightly (I still call them that), also cloned master branch and did fresh compile on my computer, debug, release doesn't matter it still happens.

ranisalt commented 7 years ago

Weird. Isn't that related to the client instead? Are you using Tibia Client or OTClient?

WibbenZ commented 7 years ago

Highly doubt this is related to TFS, graphics is handeld by the client especially since it happens when you disable something with the client.

But for the lols give it a try with a diffrent TFS version and or Tibia version.

Codinablack commented 7 years ago

I was using a tibia client, but I guess if you guys really think that the freezing is on the client side I will test with OTclient, if the problem still persists I will start downloading the nightlies I suppose and go back far as I can till it stops

ranisalt commented 7 years ago

Please do. If you remember any version that works (or if you don't, try older tag releases), mark it as working and go bisecting until you find which update breaks.

If you can't do it, I'll try locally, but different machines yield different results with graphic stuff.

Codinablack commented 7 years ago

I was unable to get OTclient to compile for 10.98. I highly doubt it's tibia's client that is at fault here, but I would much appreciate anyone who could confirm it does this with otclient.

I have went back to the AppVeyor build on may 15 2017 and still the same.

I'll keep trying as well..

Codinablack commented 7 years ago

Alright well I guess I admit defeat on this one. I downloaded the release of 1.2 because I wasn't making any headway on downloading nightly after nightly, and tried with 1.2 it still does the same thing, so I guess it is the client, I just can't seem to solve all the b/s problems of compiling otclient to confirm.

Can anyone else who uses otclient plz just test this?

WibbenZ commented 7 years ago

Well I havn't tested but I always disable lights and have never seen this happen with TFS nor the Tibia client. Where did you download the client? Could it be that they noticed and fixed the bug without updating the client version? Try to download 10.98 from another source and see if you still have the same problem, but if 1.2 works you could try an old version of OTC and see if it works.

Codinablack commented 7 years ago

The last release of OTC was 0.6.6 from 2014. I keep running into problems trying to compile the source from the main branch and I am done trying. I have confirmed tho that it isn't "my" version of 10.98 I have 3 sources of which provided 10.98 version of the client and all three same result.

http://ots-list.org/assets/download/client/tibia1098.exe http://tibia-clients.com/clients/download/1098/zip/windows https://drive.google.com/open?id=0B2-sMQkWYzhGQno3MUsxMXNqQ28

Codinablack commented 7 years ago

I also changed various graphic settings in the clients and the only thing that works is having ambient light above 50% or just having some other source of light fill the screen, otherwise constant stalling.

Kamenuvol commented 7 years ago

Test it on vanilla servers. Perhaps it is a problem on protocol.

Codinablack commented 7 years ago

I did.

ranisalt commented 7 years ago

And what happens?

Codinablack commented 7 years ago

That was how the initial issue was started, I was using a custom branch for my server and once I noticed I immediately cloned master branch, compiled, tested. Tried latest AppVeyor build debug same result. Then I created this issue. Since then I have tried 2 other sources of the client and same result, no matter if using default drx9 or switching to the other two options, the only fix is to fill the screen with light. This completely takes away from the rpg nature that is tibia or the possibilities already programmed into the game so we have that functionality. I have no real way to prove its the client yet, I have asked for help because I am failing at getting a working otclient for 10.98 working.

nekiro commented 7 years ago

I could not reproduce this with Tibia Client 10. Using tfs 1.3

Codinablack commented 7 years ago

Tibia client 10?

I swear I am using vanilla, immediately go from forgotten temple forward into the sewer. Had to find a corner with no light.

May I ask, did you have any alterations in the graphics settings, what is your ambient light setting?

I couldn't find much in protocolgame that looked suspicious except for this line here

https://github.com/otland/forgottenserver/blob/master/src/protocolgame.cpp#L2796

Other than that I am currently waiting for nightfall in server as I realized to further narrow it down I should be on floor 7 or above. It could very well be a problem with the handling of the floors underground.

Codinablack commented 7 years ago

Ahah! I have now confirmed it is definitely not the client! It does do it in OTclient too, although it is no where near as bad ad OTC has a small default light that glows from the player. Still does it tho

nekiro commented 7 years ago

Isnt it your graphic card or something with missing drivers?

How can be client graphic related to server itself?

Codinablack commented 7 years ago

Do you know of a program that will display all my graphics information, because I am running a geforce 710 and the very next thing I did after confirming bug ALSO exists in OTC, I updated my graphics drivers to the most up to date game driver for windows 10. 2 Reboots later I checked again and still the bug exists

Codinablack commented 7 years ago

As to answer your question, how can the server be related, well because the server is the one that decides how the information is sent to the client. I mean really, take for instance our perspective on floors above and below ground floor, how we see those floors is decided by the server!

I have never hear of a single person ever having this type of lag in ANY tibia client. Not once has someone had that problem in tibia, and I have tested and confirmed it still happens with OTC. No I don't have any missing drivers and I am certain my rig is more than qualified to handle tibia lighting. I can play LOL all day with 80fps and no loss on quality

jo3bingham commented 7 years ago

I know you want to believe this is a server issue, and you have a great argument for it, but it's definitely a client-side issue. It's probably not the client, nor your computer, but a combination of the two. However, short of doing a fresh install of the Windows OS, I'm not sure what to tell you that you haven't already done.

I also changed various graphic settings in the clients and the only thing that works is having ambient light above 50% or just having some other source of light fill the screen, otherwise constant stalling.

This is the main giveaway. When you change the ambient light settings in your client, the server has no knowledge of it. Even when you use an in-game light source (e.g., a torch), the only thing the server does is confirm that you can use that item, then decide whether or not you're turning it on or off, then tells the client to set the light values of your player to a certain value. Even then, the client handles the actual lighting.

I attempted to recreate this with a current build of master, and older builds, using the Tibia 10.98 client, and a build of OTC, and was unable to.

My only guess is, maybe the fact that you're running the server on your machine along with the Tibia 10 client is too much for your CPU. Don't ask me why, though. However, I do know that the CPU usage of the Tibia 10 client is horrendous. My suggestion would be to either have a friend host the server on their machine or connect to an existing 10.98 OT, and see if the problem persists.

ranisalt commented 7 years ago

It's not that you could have missing drivers, it's that proprietary drivers are unfortunately shit.

Tibia clients are also not great and they make my GPU coil whine a lot if I let the FPS loose. Did you try locking the FPS at ~60 to see if that happens? I remember having some lag spikes when the CPU usage hit 100% when the FPS was >300, even though I had a beefy CPU and GPU.

Codinablack commented 7 years ago

My fps on the client was always avraging, 40-42fps. Its not my graphics setup man, I just don't understand how I followed procedure and protocol to a tee and Im still being questioned as tho this isnt an actual bug. It is! A very serious one!

Codinablack commented 7 years ago

Done! Now I have tested with tibia linux client from another desktop running ubuntu 16.04. Vanilla server! Only thing that changed was config.lua to make the damn thing connect to a database server. I also monitored the CPU usage, it spiked on startup of server, it doesnt spike or go above 20% while running the client or server, until there is the lag. Cpu then spikes even with the client being on anoyher machine!

WibbenZ commented 7 years ago

Can you test it on an offical Tibia server? If the bug is still there it's for 100% the computer(s), something like this would have been reported and fixed right away since most ppl disable the light effects.

jo3bingham commented 7 years ago

Its not my graphics setup man, I just don't understand how I followed procedure and protocol to a tee and Im still being questioned as tho this isnt an actual bug. It is! A very serious one!

We believe that you're experiencing an issue, however, if the lag is reproducible just by adjusting the ambient light levels in the client's settings then there's no way it could be caused by the server. It's impossible. Another test is to have someone else connect to your server and see if they can reproduce it from their machine.

Codinablack commented 7 years ago

@jo3bingham I was feeling pretty frustrated because people I guess tend to not read all of what it is I typed out and explained here. Such as being asked what happened when trying on vanilla server, or even you asking me to basically just connect to the server from another computer which I already did.

However you made a very valid point about the ambient light level control not corresponding to the server at all. So I tried doing a fresh install, using windows display drivers, same result, I was going mad trying to figure this out, the only conclusion I could come to is that it has to be the server but it can't be if the ambient light gets rid of the bug. So I decided to test again! I was again mistaken. The ambient light did NOT fix the problem, just made it harder to notice! See Screenshot, not the best but it was hard to capture this bug with the screen sharing software I have but I did manage to capture it!

http://i.imgur.com/7jJvr2F.gifv

Please note it doesn't show it at the very beginning, but keep watching, and also that my ambient light setting is 100% as you can see there are no other light sources

The area to watch is where the mouse keeps circling, the outside wall/dirt of the cave.

ranisalt commented 7 years ago

Your wording is not the clearest I've seen, too. I was getting frustrated because I couldn't understand where you were trying to get. Don't assume people aren't trying to help.

First of all, we were trying to isolate the problem you are facing. Rule out the server, the machine, the client you are using to track down specifically what happens, as apparently nobody could reproduce. Keep in mind it does not make the minimal sense to blame the server for a client rendering issue.

Watching your recording I did not notice anything wrong with the graphics. I think you were expecting some kind of motion blur and Tibia does not have it, thus the frames seem a little choppy, but no problem at all. Another problem that could happen is tearing, when the frames do not sync correctly with the display and it feels like half of the screen is delayed.

Also if you feel it freezing try monitoring the FPS, you can press Alt+F8 with the Tibia Client to show it.

Codinablack commented 7 years ago

Alright well by this point the only reason you guys could say it wasn't the client for sure was that ambient light fix which wasn't a fix. I did all I can do, even tested it from the external machine, and if you guys can't see the freezing done by those tiles in that gif, then that would explain why no one else has confirmed this bug!

I guess this bug will remain in this repository for a very long time. You guys can blame the client till you are blue in the face but it doesn't change the fact I have used 5 different clients, 2 different machines, and numerous graphical settings! I debunked my own myth that it was fixed with ambient light, and I am certain that the problem is only for tiles under the 7th floor. But hey it's probably just my graphics (on both machines).

kornholi commented 7 years ago

I don't know why it is so hard for you to accept that it is a client issue. Since when have any of the clients had good performance? You said it yourself that you only get 40-42 fps, and having framerates below the monitor refresh (typically 60hz) can cause all kinds of tearing and stuttering (even with vsync on).

You notice it under the 7th floor because the client has to render all of underground floors, and there are a lot more objects rendered than on the ground floor.

WibbenZ commented 7 years ago

Well no one here has been able to reproduce it and since we can't do that how are we supposed to find the bug? I could change the exp stages and say it's fixed, because I have never experienced anything like this.

Codinablack commented 7 years ago

@kornholi No no no bro, I said I am only running 40-42 because that's what it was set at, I can run it all the way, same with otclient, and any other time there is no problem. I can run LOL capped at 80 with max quality settings and it won't drop below 80. As for since when has tibia had good performance??? Well I don't know about you but I seen tibia run fine without lag on a windows 2000 computer!

I understand you wibbenz and kornholi, if no one else can confirm the bug then logically it is either me or no one is even trying. Mkalo did try! So it must be me. Seeing as how I have now used 2 machines and multiple clients we know for a fact it can't be the client. So I will just concede to defeat and chalk it up as my problem and just deal with it.

I apologize for my sh*tty attitude as well.

jo3bingham commented 7 years ago

You notice it under the 7th floor because the client has to render all of underground floors, and there are a lot more objects rendered than on the ground floor.

Actually, when you're underground, the client only renders five floors (your character's floor and two floors above, and below, you) compared to eight floors (ground floor and up) when you're above ground. However, in general, there's more likely to be more ground tiles, and items, that need to be rendered when underground as opposed to above ground where there's more empty tiles.

I understand you wibbenz and kornholi, if no one else can confirm the bug then logically it is either me or no one is even trying. Mkalo did try!

I tried as well... Here's how it works at the company I work for: when an issue is reported, the first thing myself, or another developer, does is attempt to recreate the issue locally using the information the reporter supplies. If we can't reproduce it (which rarely happens if the issue isn't a user error), then we ask the reporter to try different configurations to see if they can consistently reproduce it under different conditions. This is the exact same thing I've done here. I can't reproduce it, so I've asked you to try different scenarios to try and rule out whether or not this is actually a server issue, a client issue, a machine issue, or possibly a combination of these.

The reason everyone here is saying it's not a server issue is because there's no substantial evidence to back that up. I can't reproduce it, @Mkalo can't reproduce it, and you're the first, and only, person to report it. Listen, I believe you that you're experience lag, I can see it in the gif you linked, but without repeatable reproduction by at least one other person, then it's really hard to blame the server. And, in this case, the next obvious answer is that it's either the client, the machine, or a combination of both.

This is also why I suggested having someone else test by connecting to your server, though you haven't mentioned anything about doing that. Better yet, see if @Mkalo, or someone else here, would connect to your server and test.

As for since when has tibia had good performance??? Well I don't know about you but I seen tibia run fine without lag on a windows 2000 computer!

It's a well known fact that the graphics rendering loop of the Tibia client is highly inefficient (I'm not sure if the same can be said of the new Tibia 11 client). I won't get too into it, but there are two tools out right now (one I made) that allows you to disable the (Windows) client's redraw method when it's not in the foreground which DRASTICALLY reduces it's CPU cost (yes, it's mainly used by botters who have multiple clients running at a time, but that's beside the point).

Codinablack commented 7 years ago

Last time I will make a comment here for the sake of discussing my problem and not wanting to pollute the main branch and everyone subscribed to it with spam.

@jo3bingham I had not realized that you did actually test it. Seeing as how no one here besides mkalo said they were unable to reproduce it, I assumed no one else had tried. Thank you and everyone else for having more patience with me than I have ever had. As for the suggesting someone else connect to the server, I honestly don't see the point in having someone outside my network connect when essentially it should be the same as me walking over to my other computer and connecting like I have said that I did do in Ubuntu.

offtopic, these tools you speak of anyway you could send me some links? If not here, my name is the same on otland.

nekiro commented 7 years ago

I can't see mkalo here, where is he? (sorry for noticing you guys, but I had to.)

Codinablack commented 7 years ago

@thexamx I'm very sorry, I must have been confused from avatars I think?

jo3bingham commented 7 years ago

@thexamx my bad, haha.

As for the suggesting someone else connect to the server, I honestly don't see the point in having someone outside my network connect when essentially it should be the same as me walking over to my other computer and connecting like I have said that I did do in Ubuntu.

It's always best to test every possibility. Theoretically, yes, it should be the same, but there's a chance it won't be, and you should always eliminate that chance by testing it.

offtopic, these tools you speak of anyway you could send me some links? If not here, my name is the same on otland.

I will message you on OTLand when I am home from work.

Codinablack commented 7 years ago

I guess my graphical setup is garbage, the card and chipset both, no matter what drivers. I have recently discovered this problem for me happens from anything dark on the screen. Thus it is indeed a problem with my setup and not for tfs.

ranisalt commented 7 years ago

What are your processor, motherboard and graphics card? Maybe we can talk with the manufacturer and see if there is a fix.