Page 1 of 1

Can't erase AI startpoint anymore.

Posted: 08 Nov 2009, 16:42
by zwzsg
I have the following widget:

Code: Select all

function widget:GetInfo()
  return {
    name      = "Start Point Remover",
    desc      = "Deletes your start point once the game begins",
    author    = "TheFatController and jK and zwzsg",
    date      = "Jul 11, 2007",
    license   = "GNU GPL, v2 or later",
    layer     = 0,
    enabled   = true
  }
end

function widget:GameFrame(f)
  if f > 5 then
    for _,t in ipairs(Spring.GetTeamList()) do
      local x,y,z = Spring.GetTeamStartPosition(t)
      Spring.MarkerErasePosition(x or 0, y or 0, z or 0)
    end
    widgetHandler:RemoveWidget()
  end
end
It erases my own startpoint marker, but not the AI startpoint marker anymore (since 0.80.5. or so). Please fix. I want to make a game that looks like a polished product and not like some ugly debugger.

Also: I am blue and the AI is red. The AI startpoint is blue and I can delete it manually.

Using:
Spring.Echo("Deleting ("..(x or "nil")..","..(y or "nil")..","..(z or "nil")..")")
I got:
[ 7] Deleting (1024,100,1024)
[ 7] Deleting (nil,nil,nil)
[ 7] Deleting (nil,nil,nil)
I suppose that means there are three teams (Me, the AI, and I guess Gaia) but that only me got the startpos set.

Re: Can't erase AI startpoint anymore.

Posted: 08 Nov 2009, 17:01
by SirMaverick
rts/Lua/LuaSyncedRead.cpp
line 920:

Code: Select all

if (!IsAlliedTeam(teamID)) {
  return 0;
}
No cheating.

Re: Can't erase AI startpoint anymore.

Posted: 08 Nov 2009, 17:09
by zwzsg
I have tested using both StartPosType=4; ("choose before game") and StartPosType=1 (fixed), in the AI startpoint aren't erased in either case.

But, weirdly enough, when I am speccing AI battles, the startpos marker are erased fine.

You are not being helpful, SirMaverick. Maybe you are telling me players are not allowed to use widget reading the enemy team start pos? If so, that is the most fail fix I have every seen, since the enemy start pos are marked by a giant glowing beacon nevertheless, and that your fix in effect prevents any hope of ever automatically deleting it.

Re: Can't erase AI startpoint anymore.

Posted: 08 Nov 2009, 17:13
by SirMaverick
zwzsg wrote:You are not being helpful, SirMaverick. Maybe you are telling me players are not allowed to use widget reading the enemy team start pos?
Yes.
If so, that is the most fail fix I have every seen, since the enemy start pos are marked by a giant glowing beacon nevertheless, and that your fix in effect prevents any hope of ever automatically deleting it.
The bug is, that it is drawn in the first place.

Re: Can't erase AI startpoint anymore.

Posted: 08 Nov 2009, 17:15
by zwzsg
Also mantised: http://springrts.com/mantis/view.php?id=1722
SirMaverick wrote:The bug is, that it is drawn in the first place.
I would be fine with the marker not being drawn in the first place.

I partially workarounded it by moving the code to a gadget, nevertheless there is a stupid bug in the engine that must be fixed in the engine.

Re: Can't erase AI startpoint anymore.

Posted: 08 Nov 2009, 19:00
by hoijui
i responded in the mantis report.
basically the problem here is (at least i think its that) that springs only allows players to draw. that means, htat AIs, when drawing, have to draw with the color of a player. for Skirmish AIs, thats the host player, for Lua AIs.. i dont know.
the fix is non trivial as explained in one of the related mantis reports, in that it invloves network protocol and a lot of other stuff to be changed.

Re: Can't erase AI startpoint anymore.

Posted: 09 Nov 2009, 01:24
by zwzsg
Then follow SirMaverick suggestion and just don't mark AI startpos in the first place. There are already enough bugs created by trivial fixes, so don't attempt non trivial solutions.

Re: Can't erase AI startpoint anymore.

Posted: 09 Nov 2009, 14:18
by R-TEAM
Hi,
zwzsg wrote:Then follow SirMaverick suggestion and just don't mark AI startpos in the first place. There are already enough bugs created by trivial fixes, so don't attempt non trivial solutions.
agree 101% ;)
have noticed this long ago (0.80.1x or so..) and think only "mmh.. one more widget that is not running 100% under 0.80x", it erases my startpoint so its doing anything ;)

Better -> a server option to draw start points AT ALL (player or AIs)
I realy dont see a "musst have" for startpoints....
(dont understand why it is usefull to see my startpoint or helpfull by a game that hides other players units by LOS/fogofwar and then i see its startpoint ...maybe in special situation ....but then i can this enable server side ..)

Regards
R-TEAM

Re: Can't erase AI startpoint anymore.

Posted: 11 Nov 2009, 06:42
by Argh
1. Why not just delete all the map-marks on frame 1?
2. Why is Spring auto-marking startpoints in the first place? This is something that should be a Widget or Gadget, period.

Oh, and lastly... convert to a Gadget... get the UnitCreated() events, and get the Commanders, since that's the same location XYZ, then pass to unsync to erase. Should work. If you're stuck, let me know, I wrote something like it awhile ago and it still works just fine.

Seriously, though. I just took a look, and it appears that map-marks aren't being stored in a Lua-accessible place. My vote: delete that entire functionality from the engine, we can do everything that we do with map marks with Lua, and then we'll never have this conversation again. Map-marks have been broken and re-fixed, same with this initial-position stuff, more than once, and it shouldn't be in the engine at this point anyhow.

Re: Can't erase AI startpoint anymore.

Posted: 11 Nov 2009, 17:44
by zwzsg
Argh wrote:Oh, and lastly... convert to a Gadget... get the UnitCreated() events, and get the Commanders, since that's the same location XYZ, then pass to unsync to erase. Should work.
I already did. (Your method is way overcomplex btw. Unsynced of gadget can simply read startpos.).

But I should not have to add gadgets to my mod to work around engine bugs. Especially for bugs that concern all and every mods.
If you're stuck, let me know.
I resent that! :evil:

Re: Can't erase AI startpoint anymore.

Posted: 11 Nov 2009, 18:49
by lurker
...submitted to springbash.

Re: Can't erase AI startpoint anymore.

Posted: 12 Nov 2009, 00:55
by Argh
<shrugs> I wrote a solution in about 15 minutes and 15 lines of code. And until Mapmark or the relevant callouts get deprecated, it will just work, regardless of the fix made to Spring.

I guess you don't need it though :roll: