Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

PT Source x64 + DX11 + SLikeNet + RmlUI

Moderator
Staff member
Moderator
Joined
Feb 22, 2008
Messages
2,404
Reaction score
723
Makes sense to me. Well, I'll wait for someone to try this too. I'm too rusty for this. But its a nice codebase.
If the community worked together we might pull something off. But you know how it works, right? Whoever fix anything is not likely going to share. Which I hardly do NOT encourage.
 
Junior Spellweaver
Joined
May 30, 2009
Messages
190
Reaction score
61
Makes sense to me. Well, I'll wait for someone to try this too. I'm too rusty for this. But its a nice codebase.
If the community worked together we might pull something off. But you know how it works, right? Whoever fix anything is not likely going to share. Which I hardly do NOT encourage.

Would be interesting to have this source in some Git repo to everyone be able to help.. but the PT community hasn't been active for a long time, so would have more leeches than contributors for sure hahaha. So I hope this can be useful for study and get some knowledge (mainly on graphics and networking).
 
Moderator
Staff member
Moderator
Joined
Feb 22, 2008
Messages
2,404
Reaction score
723
When I logged in, I didn't see any monsters. Is this expected behaviour? I had char/field in the server files, just as you provided.

I can setup a public github repo, but I'm not sure how I would go to allow others to commit into it.. Lol Need those merge and pull requests right.. I'm really dumb in this, never done it before.
 
Moderator
Staff member
Moderator
Joined
Feb 22, 2008
Messages
2,404
Reaction score
723
Discussions should be made in forums only, no Discord information, that is against RZ rules.Sorry

As for the dataserver, maybe it is not necessary at the moment, since we can already login. Maybe fixing visual bugs like I already mentioned and restoring removed systems would be number 1 priority. But if you want to code dataserver, go for it!

Try to setup a public github so others can collaborate.

Try to login and verify that you don't see any monsters, maybe we can start from there! xD
 
Initiate Mage
Joined
Jul 28, 2020
Messages
3
Reaction score
0
I just mentioned what I can help with, which is the connection/database part. storage etc. About graphics I'm still very beginnerI apologize for the mistake made by sharing my discord!github would be a good idea, but something more controlled would be nice. Because 4 programming and 30 waiting to use, this subject is a little complicated but I'm available if anyone is interested
 
Last edited:
Newbie Spellweaver
Joined
Feb 5, 2013
Messages
13
Reaction score
5
That srAutoPlayCount is really confusing. If it only executes each 63 additions to that variable, meaning each addition is 100ms, why didn't they just use sleep method or something?
Many pristons tick rates are not the same, so it is not possible to rely on sleep. Also, the sleep method is not accurate enough to provide that kind of mechanism as it does give its time slice (Threading).
 
Moderator
Staff member
Moderator
Joined
Feb 22, 2008
Messages
2,404
Reaction score
723
Many pristons tick rates are not the same, so it is not possible to rely on sleep. Also, the sleep method is not accurate enough to provide that kind of mechanism as it does give its time slice (Threading).

I see, makes sense. Never thought of it as "ticks". =D

It's amazing to see how much you improved in coding over these years. Congratulations man!!
 
Newbie Spellweaver
Joined
Feb 5, 2013
Messages
13
Reaction score
5
Loop inside that array is only executed when srAutoPlayCount & 0x3F == 0 for example. Wtf is going on here, I don't know xD Math is not my strong subject. I know each call should be at 100ms since the SetTimer function, so I assume every +1 in srAutoPlayCount means 100ms. 0x3F = 63d. So, does it mean that this bitwise if is just a sleep for 63 * 100ms -> 6,3 seconds? Does not make any sense because packet 0x48470014 is sent something like each second, and it does have a similar logic to control the timing.

Okay, lets do the math: Every 100ms the function srPlayMain() gets called, but it is not important at all, because it has a fixed time step of 70 ticks per second, you can see by the variable called "Fps". Sooo, every (0x3F + 1) tick counter the condition will succeed, and so on... This means, the calling rate of this function will be every (0x3F + 1) / 70 seconds, which results in about: 0.85 seconds.

I see, makes sense. Never thought of it as "ticks". =D It's amazing to see how much you improved in coding over these years. Congratulations man!!

Thanks!
 
Moderator
Staff member
Moderator
Joined
Feb 22, 2008
Messages
2,404
Reaction score
723
Awesome explanation, this is what was causing my mind to go nuts when I was trying to convert server to C# just for fun.


-- Edit
Cainan bocadecao

Why can I only use power of two numbers - 1 to make this delay?

If I try with 63 I get rouglhy one second. 63 / 70 = Almost one, all right.

140 / 70 = 2. I want a two second delay. If I try 140 it seems like it executes every tick and then sleeps for 2 seconds lol, opposite behaviour. However, with 511 is good, executes about 7.3 seconds.

I didn't understand why it has to be -1. If I put 64 for example it goes crazy.
 
Last edited:
Newbie Spellweaver
Joined
Feb 5, 2013
Messages
13
Reaction score
5
Awesome explanation, this is what was causing my mind to go nuts when I was trying to convert server to C# just for fun.


-- Edit
@Cainan @bocadecao

Why can I only use power of two numbers - 1 to make this delay?

If I try with 63 I get rouglhy one second. 63 / 70 = Almost one, all right.

140 / 70 = 2. I want a two second delay. If I try 140 it seems like it executes every tick and then sleeps for 2 seconds lol, opposite behaviour. However, with 511 is good, executes about 7.3 seconds.

I didn't understand why it has to be -1. If I put 64 for example it goes crazy.

Bitwise And operator works like that. I would say that it is not supposed to be used as a tick rate management, instead use the module operator % for other cases. Bitwise And operator is just faster, does not use any division nor multiply.
 
Moderator
Staff member
Moderator
Joined
Feb 22, 2008
Messages
2,404
Reaction score
723
Bitwise And operator works like that. I would say that it is not supposed to be used as a tick rate management, instead use the module operator % for other cases. Bitwise And operator is just faster, does not use any division nor multiply.

So with this current implementation of tick rate, we are bound to use only power of two numbers to create delay? In other words, I can't choose any delay I want, it must be one of those that power of two numbers - 1 gives. Is that correct?
 
Newbie Spellweaver
Joined
Feb 5, 2013
Messages
13
Reaction score
5
So with this current implementation of tick rate, we are bound to use only power of two numbers to create delay? In other words, I can't choose any delay I want, it must be one of those that power of two numbers - 1 gives. Is that correct?

As I was saying, just use the module operator (%) for any other case you want.

// Every 4 ticks, the condition will succeed.
if ((MyTickCounter % 4) == 0)
{
Do_Something();
}

// Every 187 ticks, the condition will succeed.
if ((MyTickCounter % 187) == 0)
{
Do_SomethingElse();
}
 
Junior Spellweaver
Joined
May 30, 2009
Messages
190
Reaction score
61
@SheenBR about ur question regarding that number used on tick rate be power of two numbers.

The remainder operator (%) returns the remainder left over when one operand is divided by a second operand. It always takes the sign of the dividend.

As PT do x % y == 0, the condition will be truthy when the division remainder is equal to 0.
 
Moderator
Staff member
Moderator
Joined
Feb 22, 2008
Messages
2,404
Reaction score
723
@bocadecao @Cainan

I think I understand.

0x3F -> It will only succeed when anded with 0x3F.

0011 1111 (Mask -> This will determine the "frequency")
0100 0000 (64 - Value checked against)
------
0000 0000 (And Result)

So, the next number from "0100 0000" to return 0 from anding with 0x3F:

0011 1111 (Mask -> This will determine the "frequency")
1000 0000 (Next possible value to expected and result 0) -> 128
-----
0000 0000 (And Result)

It can only go in batches of 64 numbers. Not really power of two after all, was totally wrong about that.

What I still find hard to understand is when Cainan said Fps = 70. That variable along with that

if (cnt > 70 * 2 ) and FrameSkipTimer stuff... Maybe if I understand what that is for I could come up with my own mask to do any delay I wanted. Like, batches of 35, batches of whatever, and get the timing correct.

Btw, I've found this heartbeat class from an mmorpg emulator in github.


Do you think server needs to match exactly how long this tick rate is originally implemented in C++? Or lets assume, as long as I sent more or less each second the 0x48470014 packet game will be fine?
 
Last edited:
Newbie Spellweaver
Joined
Feb 5, 2013
Messages
13
Reaction score
5
@bocadecao @Cainan

I think I understand.

0x3F -> It will only succeed when anded with 0x3F.

0011 1111 (Mask -> This will determine the "frequency")
0100 0000 (64 - Value checked against)
------
0000 0000 (And Result)

So, the next number from "0100 0000" to return 0 from anding with 0x3F:

0011 1111 (Mask -> This will determine the "frequency")
1000 0000 (Next possible value to expected and result 0) -> 128
-----
0000 0000 (And Result)

It can only go in batches of 64 numbers. Not really power of two after all, was totally wrong about that.

What I still find hard to understand is when Cainan said Fps = 70. That variable along with that

if (cnt > 70 * 2 ) and FrameSkipTimer stuff... Maybe if I understand what that is for I could come up with my own mask to do any delay I wanted. Like, batches of 35, batches of whatever, and get the timing correct.

Btw, I've found this heartbeat class from an mmorpg emulator in github.


Do you think server needs to match exactly how long this tick rate is originally implemented in C++? Or lets assume, as long as I sent more or less each second the 0x48470014 packet game will be fine?

Okay, the maths behind the operations you really don't need to understand. Just put in your mind, And (&) works with (power of two) tick rates, just test it with -1 and it is done, but the module operator (%) works with anything you want, the difference is just performance.

The if(cnt > 70 * 2) and FrameSkipTimer is not a big deal, it will only run if for some reason, the server cannot process stuff fast enough so that when it hits the function (srplaymain) again, it will just ignore the lagged time. In another words, it wont make the client go "Fast Forward Mode" when the server is too busy processing other things.

About the packet 0x48470014, you define the interval, there is no condition that needs to be meet, just be aware that the longer you wait, the bigger it gets (Packet Size), and, it can make you a little laggier (Delay).
 
Moderator
Staff member
Moderator
Joined
Feb 22, 2008
Messages
2,404
Reaction score
723
Okay, the maths behind the operations you really don't need to understand. Just put in your mind, And (&) works with (power of two) tick rates, just test it with -1 and it is done, but the module operator (%) works with anything you want, the difference is just performance.

The if(cnt > 70 * 2) and FrameSkipTimer is not a big deal, it will only run if for some reason, the server cannot process stuff fast enough so that when it hits the function (srplaymain) again, it will just ignore the lagged time. In another words, it wont make the client go "Fast Forward Mode" when the server is too busy processing other things.

About the packet 0x48470014, you define the interval, there is no condition that needs to be meet, just be aware that the longer you wait, the bigger it gets (Packet Size), and, it can make you a little laggier (Delay).

Well, its not really power of two numbers,



In this case, it goes in batches of 64 numbers, because of flag chosen to and: 0x3F . After 128, we should get 192 as the next tick, and not 256 that is the next in the power of two. I think maybe it really mean batches. There is another loop for instance which uses 0x3FF. So each 0x3FF adition, it will return 0 when anding.

What I would like to understand better is how/why, technically, they made this algorithm. The 100ms timer, the fact you said something about limiting 70 ticks per second. This 64 must have been thought on purpose, they can't simply try ranndom masks until they say: "Hey this seems like it takes as long as I want"

I found this article too, if anyone likes this stuff:

I will try to read your posts again to see if it clarifies anything. But if you'd like to get more technical xD I know it may sound a stupid subject about priston tale but I find it interesting to me. Its the server core, basically.

I wouldn't want to use C++ server so I'm trying to convert it to C# for fun and knoledge its been a while now but I stopped because this tick stuff was boring the hell out of me. lol
 
Last edited:
Newbie Spellweaver
Joined
Feb 5, 2013
Messages
13
Reaction score
5
Well, its not really power of two numbers,



In this case, it goes in batches of 64 numbers, because of flag chosen to and: 0x3F . After 128, we should get 192 as the next tick, and not 256 that is the next in the power of two. I think maybe it really mean batches. There is another loop for instance which uses 0x3FF. So each 0x3FF adition, it will return 0 when anding.

What I would like to understand better is how/why, technically, they made this algorithm. The 100ms timer, the fact you said something about limiting 70 ticks per second. This 64 must have been thought on purpose, they can't simply try ranndom masks until they say: "Hey this seems like it takes as long as I want"

I found this article too, if anyone likes this stuff:

I will try to read your posts again to see if it clarifies anything. But if you'd like to get more technical xD I know it may sound a stupid subject about priston tale but I find it interesting to me. Its the server core, basically.

I wouldn't want to use C++ server so I'm trying to convert it to C# for fun and knoledge its been a while now but I stopped because this tick stuff was boring the hell out of me. lol

... You really don't get it, do you? What im saying is that, the & just accepts power of two tick rating... Is that really hard to understand?
If I do something like: if ( (Tick & 3) == 0 ), Every 4 ticks will succeed. And that's it, the same as 0x3F (every 64 ticks), the same as 0x3FF (Every 1024 ticks) but we cannot do, using & operator a tick rate of non power of two, like, what if I wanted to run a function every 40 ticks? Unless we use module operator, the & operator wont work.

And yes, they just wanted something below 1 second, that is it, who cares? Seems to me just so normal: "Eeehh, I want to replicate this data every 1 second, ohhh, nah, better yet, something below it will be fine, not so much delay, and not so much power processing as well, cool, we good to go!"
 
Moderator
Staff member
Moderator
Joined
Feb 22, 2008
Messages
2,404
Reaction score
723
So & is intrinsic with powerr of two. I see now. sorry if I'm too dumb, bitwise operations is not something I need to understand 100%. I never needed it in my professinonal life. Of course it has nothing to do with game development though xD

But I get it now, we don't need to rely on this algorithm, we can make our own tick manager.
 
Back
Top