Closed yannsucc closed 8 years ago
Hmm, this change doesn't look bad, but I have a few questions. First, you don't go into to much detail about why this change would be important, but I gather it's to add function calls prior to server updates. I've always done this a different way, without start()
. Instead I would have my own function code and call server.update()
from there, along side any other code. That's because once a servers start
method is called, the while loop stops the code from continuing. If you call update by yourself, without using start
you can call update frequently along with your other code. You can kind of see what I mean here. I never call start
I make my own while loop, in which I call update as well as my own update
I can see having to write your own update a little confusing to beginners (you have to call server.listen as well), so perhaps this change would be worthwhile.
Secondly, is there a reason this is only shown with flash, and not all servers implementations? I have very little experience with flash, so there could be a genuine reason that I'm not picking up on. If this change was to go through, I think applying it to all server implementations is the most consistent approach.
Thanks!
It's just a suggest. Your exemple is more logical. :).
I don't know if this feature is important, but sometimes (in my project) i need to check some data before the server update (if the server is on maintenance by checking on a database for exemple) That's why i don't go into to much detail because i think it's specific to the project. I only try to set it generic :)
I use Flash on my own project so i put this code, it's not flash specific, I try to don't change mphx core if i can. This exemple can be extended to all servers implementations.
Going to close this because I don't think the library needs this, at least not yet. I don't want it to become cluttered.
As of now, the best way of doing this is to create your own update method instead of using start()
, which calls methods before/after server.update()
.
Hi there !
I had to add some 'update function' on the main loop on server side. So i made this :
Only a simple list of callback Float->Void call before the Main update of mphx. We can add these CB before server.start() with server.add(CB);
I put an operation for the dtime for update(dtime) parameters too.
(don't know why "super.update(timeout);" have an ugly indent here)