event queue full - discarding

Report core bugs regarding the Ultima Online Emulator Core release (version 097). You can attach your Core Dump. One bug per post.

Moderator: POL Developer

Locked
coltain
Grandmaster Poster
Posts: 159
Joined: Tue Mar 20, 2007 7:17 am
Location: Poland

event queue full - discarding

Post by coltain »

I noticed (and tested) that if a mobile has some event enabled but mobile do not wait for event, every event(this enabled type) that affect this mobile makes it event que full.

result:
if my tamed or summoned mobile follows a master and has only speech_event to wait for, any other event (from any mobile) just spams my console - as it does not affect on mobile i dont care about it

so it just spams the console

P.S.
Is there a way to disable showing this info?
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

I am not sure you want to stop showing this on the console as surely you'd want to deal with it in your AI.

Your npcs would read the next event from the queue and if not speech simply ignore it - but in any case the event should be gone from the queue and not fill it up.

Is your AI in a loop at some point that does NOT read the event queue? AI shouldn't be in loops for long without waiting for an event.
coltain
Grandmaster Poster
Posts: 159
Joined: Tue Mar 20, 2007 7:17 am
Location: Poland

Post by coltain »

So You are telling that I should always and often enable/disable events and specify witch are needed at the time??

Any event that is enabled should affect the mobile (as it is) but I dont understand why an event queue is full at the moment.

To test it i wrote a simple AI script .

In short:
Enable event (enetredarea)
while(self())
Say(doing nothing);
wander();
sleep(1);
endwhile

and then spawned 20 mobiles close to eachother

Maby I should clear the event queue in it?
User avatar
ncrsn
Grandmaster Poster
Posts: 255
Joined: Fri Feb 10, 2006 12:15 am

Post by ncrsn »

Your AI should check and react to events every now and then. If it only listens for events it has use for, even better. Some events, like enteredarea, will easily cause the error you mentioned (event queue full) if, say, you happen to have a NPC with other mobiles in a moving boat. And in other situations like that. These are the cases you should carefully consider which events are needed and which are not, to avoid the full queue error.

When appropriate, use Wait_For_Event instead of Sleep. That's, like, almost always.

Clear_Event_Queue is handy if the AI is waiting for some spesific core events at one time, and in a moment, does not need them anymore. E.g. it looks for mobiles coming close to it, and after a few seconds of heavy processing it decides to teleport to someplace else. No need to check whom walked by in the old place, right, so queue clearing could be used.

I still don't recommend relying too heavy on its use: processing unnecessary event is better than skipping important.
User avatar
OldnGrey
POL Expert
Posts: 657
Joined: Sat Feb 04, 2006 6:26 pm

Post by OldnGrey »

Yep, use use Wait_For_Event(n) in the mainloop and make sure the loop is run often.

If you are not expecting events all the time and it can go to sleep, then make 'n' something big. It acts as a sleep statement until there is an event, but the point is that Wait_For_Event removes the event from the queue which is what you want. What you do with the event is up to you.

This would be preferable.

var ev;
Enable event(enteredarea)
while ( self() )
ev := Wait_For_Event(100);
Say("doing nothing");
wander();
//sleep(1);
endwhile
Locked