• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Snippet] Game Start

Level 31
Joined
Jul 10, 2007
Messages
6,306
It should still run properly : o.

Also, this could possibly be optimized a bit, I'll have to check ^)^. A sync thread for each player would likely be ideal.

Right now players don't send syncs until they see all of the other players in the game, but they can probably just send sync requests as soon as they are in the game : ).
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
I know quite nothing about that, i'm just asking.

So using a Timer(0) is not enough ?

About the loading screen, what's happening with it ?

Does the game start only when all players have finished the loading, and then it never starts if not every players have sucessfully loaded the map ?
Or is there a max time, and then if it's reached the game starts anyway ?
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Does the game start only when all players have finished the loading, and then it never starts if not every players have sucessfully loaded the map ?
Or is there a max time, and then if it's reached the game starts anyway ?

When I was working with data syncing, at t = 0, I found that the host would send its packet to the other players, but the packets from the other players wouldn't read the host. What I also found was that the other computers entered the game at a delay relative to the host (the loading screen going away). Furthermore, slower computers entered the game at a delay compared to faster computers.

What I found was that packets would not be sent from a machine until the game was loaded. They'd be queued etc, but would not be sent until after the computer was in the game. What this meant was that my syncs wouldn't work until after all players were in the game and could see each other ; o.

So, I created this script. When a player finishes loading, then send a value to the other players saying that they finished loading. When a player sees every other player in the game, they send thread sync request, saying that they now see all of the players in the game. When all players have sent the sync request, the game is considered started as all players are verified to see each other : ).
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
And if you select one unit with GetLocalPlayer, player events can fire while the player is not already in game ?

The big problem was that the select unit wasn't guaranteed to fire after all of the data was synchronized because the first player to finish loading send in the select unit thing before the other players even send the data.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
The first ok, but let's say we have X players and you don't remove the unit, or even try to deselect, so it will fire X events.
Then when all of the X player events have trigger the trigger, it's still possible that all players have not completely loaded the game ?
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
The first ok, but let's say we have X players and you don't remove the unit, or even try to deselect, so it will fire X events.
Then when all of the X player events have trigger the trigger, it's still possible that all players have not completely loaded the game ?

Quit trying to make up impossible scenarios. One unit is created for each player.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
It is possible, i'm just trying to get a better solution and this could work, and no i'm not saying it will work, it's just a possibility.

Now ofc instead of not deselect at all just deselect for the triggering player with GetLocalPlayer.

I have no made any test about that, so i could be wrong or miss something, i'm just asking, and you're supposed to be the guy which has tested it, nothing else.
 
Level 17
Joined
Apr 27, 2008
Messages
2,455
More, you could even use only one "static" dummy unit for your thread thing.
Now frankly if i would do a map and care about this event, i would just use a selection on my dummy caster with GetLocalPlayer and check the player select events.

Anyway the loading screen should be the best option if you care about that event (only if you like the hardcoded behavior of it)
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
Hm, i was thinking, could this same method also be used to detect when a player is lagging?

Lets say if a player was lagging for 5 seconds the game would automatically save for that player so if he drops than his code is given to him
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
Hm.... you could continue to ping players, and if their ping times out above 50% of the avg, they are likely lagging, so you could do an autosave.

edit
@Troll

Upon further evaluation, your idea is no different from how I'm currently doing it -.-, so I'll pass.

You are just obsessed with using unit selection events over the gamecache. I'm just using your current exact idea, but with the gamecache instead.

Using unit selection events instead would require an entirely new library or a new unit as Thread doesn't support it, so I'm not even going to bother.

This library's just staying as is.

edit
updated library to make it easier to use ; )
 
Last edited:
Level 17
Joined
Apr 27, 2008
Messages
2,455
Well, since an unit is the most interactive thing ever, if i can only use one "static" unit, then it's definetely worth it.
Now maybe it can be applied in a public resource, but in any real map that should be fine.

I just feel that there your library requirements are overkill, and even less accurate than the "easy way", but yes don't worry i know your point of view about it.
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
How can I implement your Game Start System ?
Im noob in Jass, Im Gui user.
I got desync 1 or 2 sec after my map start, want to try your code.
Should I paste it into Custom Script Code window?
Do I need to copy other Snippets? (Thread snipped?)
thanks, Zibi

Custom Script : call WaitForGameToStart()
 
Level 31
Joined
Jul 10, 2007
Messages
6,306
I was actually able to list out the players still loading the map to the loaded players with this, sooo ; p, but removed the feature as the time between loading was so small that the info just flashed

edit
Oh, and all players have not finished loading when the game all players loaded flag or w/e is false, soooo ;P
 
Last edited:
Top