Jump to content

Order of Events / Multi threading


SWIPEE

Recommended Posts

I have a general question on the event flow...

How does the event engine work on the player? Is everything single threaded or multi-threaded or ...?

 

I have following situation in a play anywhere cartridge. The player can select two points in the field. Based on these two points, the playing field will be set-up (a roster of 24 zones; 4 rows by 6 columns). The zones are set-up to leave half the size of the zone as room between zones. (So, if the total distance between the two points is 60 m, a total area of 60 by 40 m is set-up. Each zone is a rectangle of about 7m, with 3.5m as blank room between zones).

 

What I see happening is the following...
User enters zone 5_1 and plays the game there. Then, user enters zone 6_2 and the OnEnter event is triggered. But the Proximity/OnExit event of zone 5_1 is triggered only 6seconds later (in the log I have). This is an issue in my cartridge, because during OnEnter I use the first entry in 'Player.InsideOfZones' to know in which zone the player is located. And in this case, there's two entries: the old zone (5_1) and the new zone (6_2) (and I use the 'wrong' one).

 

I really do not see a solution for this issue (to avoid the 'GPS-jitter'), unless I check if the user is in more than one zone and just 'wait' until the second zone is exited. But, if that takes multiple seconds, that seems as a long wait for the user.

 

Maybe, I can switch on/off events. But I'm afraid that at a certain point in time all events will be switched off (with no possibility for the player to switch them back on).
Linked to this an additional question: if a zone is activated and the player is already in the zone, will this trigger the 'OnEnter' event?

 

 

Below an excerpt of the log file... (on Android/WhereYouGo with battery saving mode on)

10:40:44|51.399|4.5026|63.0|3.0|:: ZONE: inside Zone_5_1                  ====> Enter ZONE 5_1

10:40:44|51.399|4.5026|63.0|3.0|:: EVNT: Zone_5_1.OnEnter

10:40:44|51.399|4.5026|63.0|3.0|:: CALL: MessageBox -                     ====> OnEnter of zone triggers a messagebox
10:40:44|51.399|4.5026|63.0|3.0|:: EEND: Zone_5_1.OnEnter                 ====> End EVENT HANDLER Enter ZONE 5_1
10:40:47|51.399|4.5026|63.0|3.0|:: BTTN: Button1 pressed                  ====> Event handler of the messagebox

10:40:47|51.399|4.5026|63.0|3.0|:: CALL: GetInput - SelectAttacker        ====> Event handler of the messagebox triggers an INPUT
10:40:47|51.399|4.5026|63.0|3.0|:: BTTN END                               ====> End Event handler of the messagebox
10:40:51|51.399|4.5026|62.0|3.0|:: EVNT: SelectAttacker.OnGetInput (Kapitein)    ====> Event handler of the INPUT
             ---- DO SOME STUFF (edited)      
10:40:51|51.399|4.5026|62.0|3.0|:: CALL: MessageBox - Deze slag tegen de bom heb je verloren.    ====>  Part of the INPUT event handler
10:40:51|51.399|4.5026|62.0|3.0|:: EEND: SelectAttacker.OnGetInput        ====> End Event handler of the INPUT
10:41:55|51.399|4.5027|63.0|3.0|:: ZONE: inside Zone_6_2                  ====> Enter ZONE 6_2 (same handling ensues...)
10:41:55|51.399|4.5027|63.0|3.0|:: EVNT: Zone_6_2.OnEnter

10:41:55|51.399|4.5027|63.0|3.0|:: CALL: MessageBox - 
10:41:55|51.399|4.5027|63.0|3.0|:: EEND: Zone_6_2.OnEnter

10:41:57|51.399|4.5027|64.0|3.0|:: BTTN: Button1 pressed

10:41:57|51.399|4.5027|64.0|3.0|:: CALL: GetInput - SelectAttacker

10:41:57|51.399|4.5027|64.0|3.0|:: BTTN END

10:41:59|51.399|4.5027|63.0|3.0|:: EVNT: SelectAttacker.OnGetInput (Maarschalk)

             ---- DO SOME STUFF (edited)      
10:41:59|51.399|4.5027|63.0|3.0|:: CALL: MessageBox - 
10:41:59|51.399|4.5027|63.0|3.0|:: EEND: SelectAttacker.OnGetInput

10:42:1|51.399|4.5027|64.0|3.0|:: ZONE: proximity Zone_5_1                 ===> ONLY HERE there's the proximity and OnExit event of ZONE 5_1
10:42:1|51.399|4.5027|64.0|3.0|:: EVNT: Zone_5_1.OnExit

10:42:1|51.399|4.5027|64.0|3.0|:: STOR: storing game

10:42:1|51.399|4.5027|64.0|3.0|:: STOR: store successful

10:42:1|51.399|4.5027|64.0|3.0|:: EEND: Zone_5_1.OnExit
 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...