Mirage Engine
On event module/sub ? - Printable Version

+- Mirage Engine (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17)
+---- Thread: On event module/sub ? (/showthread.php?tid=807)



On event module/sub ? - Coke - 08-03-2007

Well i was thinking, everyone here seems to be using complex timers, checks etc blah to send updates on things like experience, skills all that stuff...

Would it be plausable to simply go through the source and avoiding timers etc simply add a call to an 'on event' module. In this module it would basically resend all the players information like exp, hp, skills etc etc. Surely this way your only calling the information when its needed.. i.e. you kill a monster, the server goes yay call on event and sends you your info.

Surely this would eliminate packet spamming.. and even though it is one hell of a tedious job tracking down every single part of code where something related to the player changes wouldnt it be massively beneficial?

Just wondering since i am thinking of going through a version of ms and doing it... the theory sounds perfect to me but i might be being a total retard and barking up the wrong tree... :roll:.


- William - 08-03-2007

Not sure it will help that much. I made something similar for my buff spells. In:
Code:
Sub GameAI()
This will eliminate the possible timers you have, for example:
At the top add:
Code:
Dim XTickCount as Long, XFirst as Byte
Then at the bottom add:
Code:
If XFirst = 0 Then
  XTickCount = GetTickCount
  XFirst = 1
End if

' Make sure we reset the timer for door closing
If GetTickCount > XTickCount + 1000 Then
  Call CheckSpawnMapItems
  XFirst = 0
End If
That will replace the tmrSpawnMapItems. But it wont make much difference. Could you give an example of a sub that you mean can be done this way? I know you mean a check if something is changed, thats just a matter of adding to the Rec.


- Coke - 09-03-2007

Well, for example a problem i have had in the past is totally live stats and a working live experience bar, the experience bar is easy to make live by just flooding the client with experience update packets but thats such a shite way of doing it, if there was a sub/mod like this when you killed a monster, server side where it achnowledges that you just hit a killing blow you call this sub which sends a packet to the client to update all the stats, the exp, tnl bar whatever~


- William - 09-03-2007

[cleared: noticed that MSE was more primitive than I thought..just spent time writing something that wont work]

You must add this tutorial:
http://www.key2heaven.net/ms/forums/vie ... php?t=1315

That should solve that problem.

For the live stats, that should work as my buffs. Kinda as I did with the timer thingy. Just copy all the stats as they are now, and in the GameAI serverside, add the action that should happen when the time has past. For example hunger, decrease it each 1 minute. What live stats are you thinking about?


- Coke - 09-03-2007

Well it was basically just for the experience bar, i am going to split strength into sword, club and axe but that shouldnt be much of a problem.

Literaly i just havent seen a very efficient way of updating an experience bar on the spot with 1 packet exactly when its needed, just thought perhaps a sub that sends all your players current info would be handy ^^


- William - 09-03-2007

Thats exactly what the tutorial will do, it will create a SendTNL sub that will send when needed.


- Coke - 09-03-2007

-bows-