HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Is this possible?

04-11-2007, 09:05 PM#1
Tastingo
Warning: I'm sorry if this has an answer and has been posted already, I wasn't sure what to search for :/.

I know with mirror image this is possible, the tint of a unit is blue for the owner and full tint for an enemy. Now I think I heard someone saying that it was and I wanted to know how I would replicate it. Also I would like to know about anything that I have to watch out for while doing this, like if any bugs or something; such as the bug with glitching Crow Form. Thank you I could really use the help.

Also what is a desync or however you spell it. From the context im reading they are bad and would like to know how to avoid it. Sorry I am new to JASS.
04-11-2007, 09:14 PM#2
blu_da_noob
This is completely possible, without any risk of desync as long as you don't do something stupid. Basically what you do is:
Collapse JASS:
if GetLocalPlayer() == ownerofmirrorimageunit then //if player on local machine if the owner of the unit we will do the following action
    call SetUnitVertexColor(whatevervalues) //tint unit blue
endif
04-11-2007, 09:20 PM#3
Tastingo
Now what do you mean by doing something stupid, I'm not trying to be a smartass or anything. I just want to get an idea of what a desync is and how they happen. I also wanted to know if you could just check this call for me since it seems that the unit seems to turn invisible, instead of blue. This isn't for the same trigger as the tinting for 1 player.
Collapse JASS:
call SetUnitVertexColor(UFrozen, 0, 0, 255, 0)
04-11-2007, 09:32 PM#4
Anitarf
0, 0, 255, 255
04-11-2007, 09:43 PM#5
SFilip
> what a desync is
A desync would mean that one of the players in a multiplayer game has a different state than others. This can easily lead to that player being disconnected or even a server split.
For example creating a unit for a single player will make that unit only exist on one PC and that would be a desync. But creating one unit for everyone and then changing its colors so that it would appear invisible is fine.
Generally creating any handle-derived type for one player is not safe and that's more or less the only thing you have to worry about.
04-11-2007, 10:40 PM#6
Hydrolisk
Wouldn't that mean that if I created a dummy for a player, then it would be a disconnect/server split?
04-11-2007, 11:25 PM#7
Rising_Dusk
Only if you created it in a GetLocalPlayer() block.
Creating units normally is fine because it's created in all players' memory.
But if you created it locally for one player, it would desync.
04-12-2007, 12:07 PM#8
Pyrogasm
Is it possible to create different units for each player by changing the rawcode of the unit locally? Example:
Collapse JASS:
local integer UID = 'hkni'
//...
if GetLocalPlayer() == Player(0) then
    set UID = 'hfoo'
endif
call CreateUnit(Player(0), UID, SomeX, SomeY, 0)
Which would essentially create the unit as a footman for player 1, but a knight for all others?
04-12-2007, 12:43 PM#9
Earth-Fury
Quote:
Originally Posted by Pyrogasm
Is it possible to create different units for each player by changing the rawcode of the unit locally? Example:
Collapse JASS:
local integer UID = 'hkni'
//...
if GetLocalPlayer() == Player(0) then
    set UID = 'hfoo'
endif
call CreateUnit(Player(0), UID, SomeX, SomeY, 0)
Which would essentially create the unit as a footman for player 1, but a knight for all others?

Yes, but it has issues which would cause splits. Like the unit dying is one, IIRC. there was a thread about it a bit ago.
04-12-2007, 12:51 PM#10
Rising_Dusk
Yeah, because units die differently.
They have different death times, some might decay, some might not, some might leave corpses.
Lots of things in that idea would desync.
04-12-2007, 01:15 PM#11
Toink
Umm, I think Jazradel's Rally Point Sys creates local units for only one player, so I think this is possible.
04-12-2007, 01:17 PM#12
Rising_Dusk
If they dont have pathing and dont die then yes.
You have to remove the units locally too, otherwise it will desync.
04-12-2007, 02:23 PM#13
Daelin
In the case of different units, I can make a blind guess and say that desyncs are really easy to determine (though I do not have experience with them). In the case of creating different units for different players, I could take the following problems:

Life - if the units do not have the same life, there would be a certain problem when it comes to the death of the unit. Can't tell if it doesn't cause a desync immediately, but it is definitely a problem. Maximum/Current life should be the same at the moment of spawning.
Abilities - This is another obvious problem. If the unit attempts to cast Faerie fire let's say for player 1, but the ability does not exist for player 2, we have a desync.
Food Cost - I wonder if this is a problem or not, because I believe the food cost is only used by the local player in the case of gold mining (upkeep) and unit production.
Movement Speed - the moment the unit has different movement speed, and it changes position, we have a desync, as we have the same unit, in two different positions for two different players. Big mistake!

So what I can assume that does not cause a problem is the graphical aspect, as it does not influence the multiplayer game in any way. I mean, if the properties of the unit are identical for both the players, except that in one case its appearance is that of a footman and in the second it's that of a banshee. I don't see the problem, as logically, the unit maintains its stats globally! Same goes for vertex coloring, shadow... maybe even ingame icon!

Hope I'm not saying some bullshit though. I am making logical assumptions.

-Daelin
04-12-2007, 02:30 PM#14
Toink
Oh, so if two different units for two different players are created, 1 is a footy and another is a ghoul, and they both have the same stats they don't desync? Interesting.. Very very interesting..
04-12-2007, 03:14 PM#15
Mystic Prophet
Keep in mind he hasn't tested those assumptions. So make sure to test it out before trying it.