So apparently when adding a who is online demo to my game it doesnt seem to work properly where it wont show me ingame but when i kick a npc itll then add me to the list of people on. yet even if i refresh the list via verb or w/e it still wont add me. my game uses panes to go from the title screen pane to character creation pane and then finally the map pane how can i fix this i think its due to me havign panes that it liek bugs out the login or sumthing
well i used a demo and the demow orked fine and i put it in the game perfectly fine but it jsut doesnt work so maybe ill see if i can inject this and itll work
|
yep it worked kinda bizarre how it worked without the login factor in the demo alone
|
I'm guessing the method you were using before was to search through the entire world to find the players currently in it, which is terribly inefficient compared to this method. You should always try to avoid code that works in "aggressive" ways, because it will tend to be inefficient, and use a lot of CPU.
|
Do this in client/New() and client/Del(), and save the client objects instead of the mobs. You can still get to the mob, but this way you don't manipulate the list any until you either need to add or remove an object.
The other way, if you switch mobs mid-game it adds extra processing that can be avoided 8) |
I think the best way to determine who is online is to maintain a list that updates whenever someone logs in or logs out.
Here is an example:
Now all you should have to do is loop through that list whenever you want to know who is online. This is simple stuff.