Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a trait PlayerRadarTerrain to track explored terrain #17076

Merged
merged 1 commit into from Nov 20, 2019

Conversation

@teinarss
Copy link
Contributor

teinarss commented Sep 10, 2019

Closes #5908

Copy link
Member

RoosterDragon left a comment

Neat!

OpenRA.Mods.Common/Widgets/RadarWidget.cs Outdated Show resolved Hide resolved
@teinarss teinarss force-pushed the teinarss:fix_res_radar_fog branch from 33f5d52 to 02cc0aa Sep 13, 2019
@teinarss

This comment has been minimized.

Copy link
Contributor Author

teinarss commented Sep 13, 2019

Updated

@teinarss teinarss force-pushed the teinarss:fix_res_radar_fog branch from 02cc0aa to a2e25c1 Sep 13, 2019
@teinarss teinarss force-pushed the teinarss:fix_res_radar_fog branch from a2e25c1 to 2567f7d Sep 15, 2019
@teinarss

This comment has been minimized.

Copy link
Contributor Author

teinarss commented Sep 15, 2019

Updated

OpenRA.Mods.Common/Widgets/RadarWidget.cs Outdated Show resolved Hide resolved
{
foreach (var puv in puvs)
{
foreach (var uv in world.Map.Unproject(puv))

This comment has been minimized.

Copy link
@pchote

pchote Sep 15, 2019

Member

This may be a dumb question, but I wanted to get a quick review off before I disappear: why are we using Unproject etc here when I don't see a similar removal from RadarWidget`?

This comment has been minimized.

Copy link
@teinarss

teinarss Sep 15, 2019

Author Contributor

Because we still handle the Shroud in the RadarWidget (for drawing the shroud) so this method is based on RadarWidget.UpdateShroudCell()

@teinarss teinarss force-pushed the teinarss:fix_res_radar_fog branch from 2567f7d to 80fef2f Sep 15, 2019
@teinarss

This comment has been minimized.

Copy link
Contributor Author

teinarss commented Sep 15, 2019

Updated

Copy link
Member

abcdefg30 left a comment

This crashes immediately for me when opening a replay with a player and a few bots:

OpenRA engine version {DEV_VERSION}
Red Alert mod version {DEV_VERSION}
on map 60f8d3210da1ea785f4436ecf26507044b55c605 (Tainted Peak by Nuke'm Bro.).
Date: 2019-09-15 21:09:49Z
Operating System: Windows (Microsoft Windows NT 6.2.9200.0)
Runtime Version: .NET CLR 4.0.30319.42000
Exception of type `System.Reflection.TargetInvocationException`: Exception has been thrown by the target of an invocation.
Inner
  Exception of type `System.Reflection.TargetInvocationException`: Exception has been thrown by the target of an invocation
  Inner
    Exception of type `System.NullReferenceException`: Object reference not set to an instance of an object.
       at OpenRA.Mods.Common.Widgets.RadarWidget.UpdateTerrainColor(MPos uv)
   at OpenRA.Mods.Common.Widgets.RadarWidget.WorldOnRenderPlayerChanged(Player player)
   at OpenRA.World.set_RenderPlayer(Player value)
   at OpenRA.Mods.Common.Widgets.Logic.ObserverShroudSelectorLogic.CameraOption.<>c__DisplayClass7_0.<.ctor>b__1()
   at OpenRA.Mods.Common.Widgets.Logic.ObserverShroudSelectorLogic..ctor(Widget widget, ModData modData, World world, Dictionary`2 logicArgs)
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at OpenRA.ObjectCreator.CreateUsingArgs(ConstructorInfo ctor, Dictionary`2 args)
   at OpenRA.ObjectCreator.CreateObject[T](String className, Dictionary`2 args)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at OpenRA.Widgets.Widget.PostInit(WidgetArgs args)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, String w)
   at OpenRA.Mods.Common.Widgets.Logic.LoadIngamePlayerOrObserverUILogic..ctor(Widget widget, World world)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at OpenRA.ObjectCreator.CreateUsingArgs(ConstructorInfo ctor, Dictionary`2 args)
   at OpenRA.ObjectCreator.CreateObject[T](String className, Dictionary`2 args)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at OpenRA.Widgets.Widget.PostInit(WidgetArgs args)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, String w)
   at OpenRA.Mods.Common.Traits.LoadWidgetAtGameStart.OpenRA.Traits.IWorldLoaded.WorldLoaded(World world, WorldRenderer wr)
   at OpenRA.World.LoadComplete(WorldRenderer wr)
   at OpenRA.Game.StartGame(String mapUID, WorldType type)
   at OpenRA.Network.UnitOrders.ProcessOrder(OrderManager orderManager, World world, Int32 clientId, Order order)
   at OpenRA.Network.OrderManager.TickImmediate()
   at OpenRA.Sync.<>c__DisplayClass13_0.<RunUnsynced>b__0()
   at OpenRA.Game.InnerLogicTick(OrderManager orderManager)
   at OpenRA.Game.LogicTick()
   at OpenRA.Game.Loop()
   at OpenRA.Game.Run()
   at OpenRA.Game.InitializeAndRun(String[] args)
   at OpenRA.Program.Main(String[] args)
Copy link
Member

abcdefg30 left a comment

This does appear to regress the minimap in the map editor as well.

@teinarss teinarss force-pushed the teinarss:fix_res_radar_fog branch 2 times, most recently from bb40faa to 05689cb Sep 16, 2019
@teinarss

This comment has been minimized.

Copy link
Contributor Author

teinarss commented Sep 16, 2019

Updated, having problems reproducing the crash. Does this also happen when restarting the game between playing and then watching the replay?

@teinarss teinarss force-pushed the teinarss:fix_res_radar_fog branch from 05689cb to f7a1067 Sep 17, 2019
@teinarss

This comment has been minimized.

Copy link
Contributor Author

teinarss commented Sep 23, 2019

This crashes immediately for me when opening a replay with a player and a few bots:

OpenRA engine version {DEV_VERSION}
Red Alert mod version {DEV_VERSION}
on map 60f8d3210da1ea785f4436ecf26507044b55c605 (Tainted Peak by Nuke'm Bro.).
Date: 2019-09-15 21:09:49Z
Operating System: Windows (Microsoft Windows NT 6.2.9200.0)
Runtime Version: .NET CLR 4.0.30319.42000
Exception of type `System.Reflection.TargetInvocationException`: Exception has been thrown by the target of an invocation.
Inner
  Exception of type `System.Reflection.TargetInvocationException`: Exception has been thrown by the target of an invocation
  Inner
    Exception of type `System.NullReferenceException`: Object reference not set to an instance of an object.
       at OpenRA.Mods.Common.Widgets.RadarWidget.UpdateTerrainColor(MPos uv)
   at OpenRA.Mods.Common.Widgets.RadarWidget.WorldOnRenderPlayerChanged(Player player)
   at OpenRA.World.set_RenderPlayer(Player value)
   at OpenRA.Mods.Common.Widgets.Logic.ObserverShroudSelectorLogic.CameraOption.<>c__DisplayClass7_0.<.ctor>b__1()
   at OpenRA.Mods.Common.Widgets.Logic.ObserverShroudSelectorLogic..ctor(Widget widget, ModData modData, World world, Dictionary`2 logicArgs)
     at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at OpenRA.ObjectCreator.CreateUsingArgs(ConstructorInfo ctor, Dictionary`2 args)
   at OpenRA.ObjectCreator.CreateObject[T](String className, Dictionary`2 args)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at OpenRA.Widgets.Widget.PostInit(WidgetArgs args)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, String w)
   at OpenRA.Mods.Common.Widgets.Logic.LoadIngamePlayerOrObserverUILogic..ctor(Widget widget, World world)
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
   at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at OpenRA.ObjectCreator.CreateUsingArgs(ConstructorInfo ctor, Dictionary`2 args)
   at OpenRA.ObjectCreator.CreateObject[T](String className, Dictionary`2 args)
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
   at OpenRA.Widgets.Widget.PostInit(WidgetArgs args)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, MiniYamlNode node)
   at OpenRA.WidgetLoader.LoadWidget(WidgetArgs args, Widget parent, String w)
   at OpenRA.Mods.Common.Traits.LoadWidgetAtGameStart.OpenRA.Traits.IWorldLoaded.WorldLoaded(World world, WorldRenderer wr)
   at OpenRA.World.LoadComplete(WorldRenderer wr)
   at OpenRA.Game.StartGame(String mapUID, WorldType type)
   at OpenRA.Network.UnitOrders.ProcessOrder(OrderManager orderManager, World world, Int32 clientId, Order order)
   at OpenRA.Network.OrderManager.TickImmediate()
   at OpenRA.Sync.<>c__DisplayClass13_0.<RunUnsynced>b__0()
   at OpenRA.Game.InnerLogicTick(OrderManager orderManager)
   at OpenRA.Game.LogicTick()
   at OpenRA.Game.Loop()
   at OpenRA.Game.Run()
   at OpenRA.Game.InitializeAndRun(String[] args)
   at OpenRA.Program.Main(String[] args)

Updated
This is caused by ObserverShroudSelectorLogic is issuing a click on the Everyone player, and updating the RenderPlayer which causes a access to PlayerRadarTerrain.terrainColor which hasent been initialized yet.

@teinarss teinarss force-pushed the teinarss:fix_res_radar_fog branch from f7a1067 to 74e457b Sep 23, 2019
@reaperrr reaperrr mentioned this pull request Nov 17, 2019
@ghost

This comment has been minimized.

Copy link

ghost commented Nov 17, 2019

Looks really good and i couldn't find any issues. However, while testing this after a rebase on f39b688, the game crashed with

Loading mod: d2k
Exception of type `System.InvalidOperationException`: Attempted to get trait from destroyed object (harvester 781 (not in world))
  at OpenRA.TraitDictionary.CheckDestroyed (OpenRA.Actor actor) [0x0001c] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.TraitDictionary.Get[T] (OpenRA.Actor actor) [0x00000] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Actor.Trait[T] () [0x00000] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Mods.Common.Activities.PickupUnit..ctor (OpenRA.Actor self, OpenRA.Actor cargo, System.Int32 delay) [0x00020] in <a2f4b025ffb543059a49b0deff4b3e10>:0 
  at OpenRA.Mods.Common.Traits.AutoCarryall+FerryUnit.OnFirstRun (OpenRA.Actor self) [0x00000] in <a2f4b025ffb543059a49b0deff4b3e10>:0 
  at OpenRA.Activities.Activity.TickOuter (OpenRA.Actor self) [0x00034] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Traits.ActivityUtils.RunActivity (OpenRA.Actor self, OpenRA.Activities.Activity act) [0x00015] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Actor.Tick () [0x0000f] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.World.Tick () [0x00123] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Game.InnerLogicTick (OpenRA.Network.OrderManager orderManager) [0x001bc] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Game.LogicTick () [0x0003e] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Game.Loop () [0x000e3] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Game.Run () [0x0003c] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Game.InitializeAndRun (System.String[] args) [0x00010] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Program.Main (System.String[] args) [0x00044] in <8c0c700c15e64f03be770340c483dfeb>:0 

This seems unrelated though, but I can't be sure so commenting here.

OpenRA-2019-11-17T212419Z.zip

Crash happens at around 8-9 minutes.

👍 from me if somebody can confirm that this is unrelated.

@teinarss

This comment has been minimized.

Copy link
Contributor Author

teinarss commented Nov 18, 2019

Looks really good and i couldn't find any issues. However, while testing this after a rebase on f39b688, the game crashed with

Loading mod: d2k
Exception of type `System.InvalidOperationException`: Attempted to get trait from destroyed object (harvester 781 (not in world))
  at OpenRA.TraitDictionary.CheckDestroyed (OpenRA.Actor actor) [0x0001c] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.TraitDictionary.Get[T] (OpenRA.Actor actor) [0x00000] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Actor.Trait[T] () [0x00000] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Mods.Common.Activities.PickupUnit..ctor (OpenRA.Actor self, OpenRA.Actor cargo, System.Int32 delay) [0x00020] in <a2f4b025ffb543059a49b0deff4b3e10>:0 
  at OpenRA.Mods.Common.Traits.AutoCarryall+FerryUnit.OnFirstRun (OpenRA.Actor self) [0x00000] in <a2f4b025ffb543059a49b0deff4b3e10>:0 
  at OpenRA.Activities.Activity.TickOuter (OpenRA.Actor self) [0x00034] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Traits.ActivityUtils.RunActivity (OpenRA.Actor self, OpenRA.Activities.Activity act) [0x00015] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Actor.Tick () [0x0000f] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.World.Tick () [0x00123] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Game.InnerLogicTick (OpenRA.Network.OrderManager orderManager) [0x001bc] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Game.LogicTick () [0x0003e] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Game.Loop () [0x000e3] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Game.Run () [0x0003c] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Game.InitializeAndRun (System.String[] args) [0x00010] in <8c0c700c15e64f03be770340c483dfeb>:0 
  at OpenRA.Program.Main (System.String[] args) [0x00044] in <8c0c700c15e64f03be770340c483dfeb>:0 

This seems unrelated though, but I can't be sure so commenting here.

OpenRA-2019-11-17T212419Z.zip

Crash happens at around 8-9 minutes.

👍 from me if somebody can confirm that this is unrelated.

Its unrelated, filed another PR to fix this.

@ghost
ghost approved these changes Nov 18, 2019
@reaperrr reaperrr merged commit a47f60d into OpenRA:bleed Nov 20, 2019
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.