• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

OTClient 1.0

What amazes me the most is that Renato started this with little knowledge on cpp, he was struggling to understand some functions and choose to re-write then instead. There's a lot of people who fix things in OTC without 0 knowledge in cpp, perhaps it's time they back Renato repo's so we can try to finally drop cipsoft client for good.
 
Nice to see git done right - a proper fork!
But since your commits go straight into master, you should consider having another branch that represents upstream edubart/otclient master. Which shows where you are (in terms of being in sync with edubart) and has no changes.

So when you sync with another repo in the otclient network:
mehah/upstream -> merge edubart/master (fast forward)
mehah/master -> merge mehah/upstream (resolve potential git conflicts etc and keep your optimizations up to date with edubart)

You can also do cool stuff like
git checkout mehah/upstream (point your fork at "base")
git checkout -b single_optimization_update (take this base and make a new branch)
git cherry-pick <commit# single optimization update from mehah/master> (add selected updates to this branch)

git push mehah single_optimization_update (push this branch to github)

And send PR's by visiting edubart/otclient

Also some github tips, you can go into settings and enable issue tracker and wiki. So people can report bugs directly to your repo, write custom wiki guides etc.
 
Last edited:
Very nice, keep it up.

Btw, this my friend would make my day: 3- Possible True OTML, using HTML and CSS writing. (Maybe I won't have time for this)

Also I really like initiative,

it is possible, it will only be boring to do, because there are many rules.

With his skill, speed and knowledge, soon this will be better than paid to otcv8 🥳 🚀

With the community united, helping, for sure.

Nice to see git done right - a proper fork!
But since your commits go straight into master, you should consider having another branch that represents upstream edubart/otclient master. Which shows where you are (in terms of being in sync with edubart) and has no changes.

So when you sync with another repo in the otclient network:
mehah/upstream -> merge edubart/master (fast forward)
mehah/master -> merge mehah/upstream (resolve potential git conflicts etc and keep your optimizations up to date with edubart)

You can also do cool stuff like
git checkout mehah/upstream (point your fork at "base")
git checkout -b single_optimization_update (take this base and make a new branch)
git cherry-pick <commit# single optimization update from mehah/master> (add selected updates to this branch)

git push mehah single_optimization_update (push this branch to github)

And send PR's by visiting edubart/otclient

Also some github tips, you can go into settings and enable issue tracker and wiki. So people can report bugs directly to your repo, write custom wiki guides etc.

Thanks for the tips.
 
There's an issue that I think is the most critical in otclient and even otcv8 has it. There's something wrong in the logic if an item should be reachable or not based on if it's covered or not. I'm currently at work right now but I can show you more details later.

I doubt this is related to OTClient in general, I mean it could behave differently, but that wouldn't solve the core issue. That being said, there is a function within OTServ and TFS I wrote about 10 years ago and it wasn't changed since then. That function is Map::checkSightLine and its part of going through floors:


If a tile contains any item (e.g. border) it simply returns false. The solution here is rather simple - iterate through all items on that tile and check if this object can be ignored (e.g. border) and if so, just continue and let it return true.

Guys, I have great news, I just made a change to take advantage of the rendering cache, the tiles and lights will only be recalculated if there is a change in the screen, there was an increase of more than 400% of fps depending on the situation, of course it still needs to be improved , if put too many monsters on the screen, doing too many actions, the fps will drop a lot.

It is still far from good, but it is a start.

As much as I admire people attempt to optimize stuff, this is not a correct way and you have already noticed it (quote: if put too many monsters on the screen, doing too many actions, the fps will drop a lot.). You are basically disguising fps numbers when player stands still and nothing is happening on the screen. The moment anything happens it drops back to real value when the framebuffer is being re-drawn. Having countless of fps in a truly static environment (no animations, no movement, no nothing) is meaningless. The whole game experience might be even worse with those changes due to all the jittering going on as it is much better to have stable 60 fps than jumping between 600-60 all the time.

That being said, there is much more advanced technique to approach this problem and that's dirty rectangles, but it is also quite difficult to implement. You basically re-drawn only parts of the screen which did change. For example UI can be optimized much with such approach as it is rarely being re-drawn and is mostly taking more space that the game's framebuffer. The framebuffer itself can be even further optimized with dirty rectangles and scrolling technique (as walking is just area scrolling and we rarely need to re-drawn any part of the current framebuffer).

You can read about it here:

 
I doubt this is related to OTClient in general, I mean it could behave differently, but that wouldn't solve the core issue. That being said, there is a function within OTServ and TFS I wrote about 10 years ago and it wasn't changed since then. That function is Map::checkSightLine and its part of going through floors:


If a tile contains any item (e.g. border) it simply returns false. The solution here is rather simple - iterate through all items on that tile and check if this object can be ignored (e.g. border) and if so, just continue and let it return true.



As much as I admire people attempt to optimize stuff, this is not a correct way and you have already noticed it (quote: if put too many monsters on the screen, doing too many actions, the fps will drop a lot.). You are basically disguising fps numbers when player stands still and nothing is happening on the screen. The moment anything happens it drops back to real value when the framebuffer is being re-drawn. Having countless of fps in a truly static environment (no animations, no movement, no nothing) is meaningless. The whole game experience might be even worse with those changes due to all the jittering going on as it is much better to have stable 60 fps than jumping between 600-60 all the time.

That being said, there is much more advanced technique to approach this problem and that's dirty rectangles, but it is also quite difficult to implement. You basically re-drawn only parts of the screen which did change. For example UI can be optimized much with such approach as it is rarely being re-drawn and is mostly taking more space that the game's framebuffer. The framebuffer itself can be even further optimized with dirty rectangles and scrolling technique (as walking is just area scrolling and we rarely need to re-drawn any part of the current framebuffer).

You can read about it here:


as you already noticed, basically i am reducing the redrawing of the tiles, and yes, i intend to improve by putting to draw only what has been modified, but the question, what is causing the fps to drop so much, are creatures names and lifebar , which are redraw all time.

this is what happens when you turn off, along with the changes I made.:

With names and life bar:
names.png

Old version:
names2.png
 
Last edited:
From what I coul test, this only applies for this particular border so I don't know what is that it has of difference (perhaps the BLOCK_PROJECTILE part?)
I'm not saying this impact every otclient out of nowhere, I have tested it extensively. In fact I could only reproduce in this particular area of my map, but there could be way more bordes with that same problem. I wouldn't assume this is one time thing.

If a tile contains any item (e.g. border) it simply returns false. The solution here is rather simple - iterate through all items on that tile and check if this object can be ignored (e.g. border) and if so, just continue and let it return true.

It's strange, because even in Cip's client you have some "not standard behaviors", when an item it's partially hidden by the vision of a house second floor, for instance, it can be clicked without problems but there are situations where it cannot and I wasn't been able to make a connection to which defines being clickable or not.
 
@Iryont I am currently testing Mehah solutions. At the moment, I think that this optimization of drawing request is worth attention, because even if these "real" FPSs will not jump up, there is a reduction in CPU consumption at the same amount of FPS so for the machine it seems like a reasonable solution unless we set FPS without limit.
 
as you already noticed, basically i am reducing the redrawing of the tiles, and yes, i intend to improve by putting to draw only what has been modified, but the question, what is causing the fps to drop so much, are creatures names and lifebar , which are redraw all time.

this is what happens when you turn off, along with the changes I made.:

I was only referring to that specific flag which allows the game's framebuffer to be re-drawn. I was not referring to any of your other changes for that matter as I didn't go through them, so I cannot tell how much impact they had on your end results. I just took a peek regarding re-draw of the framebuffer. However, I definitely wish you good luck with all of it, it's really nice to see someone actually doing something rather than seeing never ending complaints ;)

#Edit

However, seeing some of your other commits I just realized you did perform your "tests" in a very specific case when you do not draw any lights from all the effects due to ambient lighting being at full power. In such case I can only assume that the performance will drop a lot when lights will be actually drawn like in 95% cases during playtime.

From what I coul test, this only applies for this particular border so I don't know what is that it has of difference (perhaps the BLOCK_PROJECTILE part?)
I'm not saying this impact every otclient out of nowhere, I have tested it extensively. In fact I could only reproduce in this particular area of my map, but there could be way more bordes with that same problem. I wouldn't assume this is one time thing.

It's strange, because even in Cip's client you have some "not standard behaviors", when an item it's partially hidden by the vision of a house second floor, for instance, it can be clicked without problems but there are situations where it cannot and I wasn't been able to make a connection to which defines being clickable or not.

I believe it is top order 1 flag. I cannot say how it looks in Tibia nowadays because I don't know, but from what I remember top order 1 is used for borders, so anything with top order 1 should be ignored in that function.

Anyway, I just realized - my bad actually, at first I thought you were referring to the throwing ability which is blocked by borders, too, so you cannot throw anything if a border is blocking the view and that function is responsible for that. However, I suppose you were referring to "use" mechanism.

@Iryont I am currently testing Mehah solutions. At the moment, I think that this optimization of drawing request is worth attention, because even if these "real" FPSs will not jump up, there is a reduction in CPU consumption at the same amount of FPS so for the machine it seems like a reasonable solution unless we set FPS without limit.

That is quite cool for sure. There are a lot of ideas which could be implemented to mitigate performance issues with drawing too much. I think in general it is worth to investigate the impact of the UI elements, too.
 
Last edited:
@Mehah
Might be a little offtop, but have you thought about looking into path-finding and moving in general in terms of ping/packets?
 
#Edit

However, seeing some of your other commits I just realized you did perform your "tests" in a very specific case when you do not draw any lights from all the effects due to ambient lighting being at full power. In such case I can only assume that the performance will drop a lot when lights will be actually drawn like in 95% cases during playtime.

I gave a slight improvement, the ideal would be to rewrite the entire light system, but I have no knowledge in openGL, but it is possible to improve even more, is that I did not stop to focus on that, first I need to correct name and life bar.

New otClient (for now I think it's good, in the "real world" there won't be that many effects.)

Old otClient

@Mehah
Might be a little offtop, but have you thought about looking into path-finding and moving in general in terms of ping/packets?

No, as I said at the beginning of the topic, I'm going to stay for a short time, that's why I need everyone's help so that the project doesn't die and keeps evolving. My suggestion is to open the doors and transform otClient and TFS into an engine 2D apart from tibia.

Impossible otcv8 is a really ahead so much there is no reason to use his otc at this point

That shouldnt be discussed, otv8 is much better, it's been in development for a long time, this one, only 5 days.

I would buy otv8, but 5k for us Brazilians, it's 28k.
 
Last edited:
I'm not sure if it is my fault, but when going up I have bad drawing:

1593017593785.png
and good when going down:
1593017650051.png

Not sure if fragment below should be changed in order to recover proper drawing:
1593018434133.png
to
1593018705280.png
 
Last edited:
I'm not sure if it is my fault, but when going up I have bad drawing:

View attachment 46825
and good when going down:
View attachment 46826

Not sure if fragment below should be changed in order to recover proper drawing:
View attachment 46827

remove line 129 in "mapview.cpp", and see if it solves your problem.

this
Lua:
if (!viewport.isValid(tile, cameraPosition)) continue;

mehah/otclient (https://github.com/mehah/otclient/blob/62e2ae8d00ff05029d340118eba4745910d025ef/src/client/mapview.cpp#L129)
 
Back
Top