New to Modding OpenRA - Crash becuase of new unit

crash when clicing on new building options

Information and discussion for custom maps and mods.
scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

New to Modding OpenRA - Crash becuase of new unit

Post by scorp »

Hi everybody

Pretty amazed about OpenRA, i tried my hands at modding it a bit. Now i followed some turorials to create a new unit

https://github.com/OpenRA/OpenRA/wiki/C ... a-new-unit

i added a .shp file for it, an Icon shp file as well as the yaml rules in vehicles.yaml

Thing is however, once i build the war factory and the tanks become avaialble for building, i click on the Tab in the buildings Options to try to select the new unit - the game freezes and then crashes.

I suspect there's an issue with the Icon/cameo, but i used a placeholder from an existing tank for that... so does anybdy know/remember this crash from his own early modding days?

thanks for any help ;)

Matt
Posts: 1144
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt »

Read the log files https://github.com/OpenRA/OpenRA/wiki/F ... st-crashed to find out what you did wrong. You can also type `make test` on Linux to automatically check for YAML errors.

scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

Post by scorp »

excerpt from exception log

Red Alert Mod at Version release-20131223
Operating System: Windows (Microsoft Windows NT 6.1.7601 Service Pack 1)
Runtime Version: .NET CLR 2.0.50727.5477
Exception of type `System.InvalidOperationException`: TypeDictionary does not contain instance of type `OpenRA.Traits.RenderSpritesInfo`
bei OpenRA.FileFormats.TypeDictionary.Get[T]()
bei OpenRA.Traits.RenderSprites.GetImage(ActorInfo actor)
bei OpenRA.Mods.RA.Widgets.BuildPaletteWidget.DrawPalette(ProductionQueue queue)
bei OpenRA.Mods.RA.Widgets.BuildPaletteWidget.Draw()
bei OpenRA.Widgets.Widget.DrawOuter()
bei OpenRA.Widgets.Widget.DrawOuter()
bei OpenRA.Widgets.Widget.DrawOuter()
bei OpenRA.Widgets.Widget.DrawOuter()
bei OpenRA.Widgets.Widget.DrawOuter()
bei OpenRA.Game.Tick(OrderManager orderManager)
bei OpenRA.Game.Run()
bei OpenRA.Program.Run(String[] args)
bei OpenRA.Program.Main(String[] args)

so it might be an issue with the unit's palette? does every unit require a palette and Palette index of its own or can i use the palette from an existing unit?

*edit

fyi i'm trying to use a unit that comes with the OpenRA install itself, ftnk.shp as found in conquer.mix.

scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

Post by scorp »

hmm okay the new unit doesn't seem to render. First mistake was in rules, now the mistakes are in sequences. gonna try to figure this out. not easy for Starters :oops:

for some reason, renderunit: was missing from the rules file. Now the i added it, but the game fails to load the sprite

Red Alert Mod at Version release-20131223
Operating System: Windows (Microsoft Windows NT 6.1.7601 Service Pack 1)
Runtime Version: .NET CLR 2.0.50727.5477
Exception of type `System.IO.InvalidDataException`: ftnk is not a valid sprite file
bei OpenRA.FileFormats.SpriteSource.LoadSpriteSource(Stream s, String filename)
bei OpenRA.Graphics.SpriteLoader.CacheSpriteFrames(String filename)
bei OpenRA.FileFormats.Cache`2.get_Item(T key)
bei OpenRA.Graphics.Sequence..ctor(String unit, String name, MiniYaml info)
bei OpenRA.Graphics.SequenceProvider.<LoadSequencesForUnit>c__AnonStorey8D.<>m__1BD(KeyValuePair`2 x)
bei System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
bei System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
bei OpenRA.Graphics.SequenceProvider.LoadSequencesForUnit(String unit, MiniYaml sequences)
bei OpenRA.Graphics.SequenceProvider.Initialize(String[] sequenceFiles, List`1 sequenceNodes)
bei OpenRA.ModData.PrepareMap(String uid)
bei OpenRA.Game.StartGame(String mapUID, Boolean isShellmap)
bei OpenRA.Game.LoadShellMap()
bei OpenRA.Mods.RA.DefaultLoadScreen.TestAndContinue()
bei OpenRA.Mods.RA.DefaultLoadScreen.StartGame()
bei OpenRA.Game.InitializeWithMod(String mod)
bei OpenRA.Game.Initialize(Arguments args)
bei OpenRA.Program.Run(String[] args)
bei OpenRA.Program.Main(String[] args)

i added the .shp file that came with the .mix Archive in pretty much any thinkable Folder and placed ftnkicon.shp files as well... according to the tutorial, These two files should be in the bits Folder and referenced in rules and requences, right?

Remuneration
Posts: 52
Joined: Sun Mar 09, 2014 3:49 pm

Post by Remuneration »

same problem, i can't even replace d2k harvester shp files to ra harvester shp files...

this problem is not happening in original RA2 game modification process.

scorp
Posts: 96
Joined: Sat Mar 08, 2014 9:35 pm

Post by scorp »

yeah. it appears both changes to the YAML files as well as the use of custom .shp's is very sensitive to Errors.

for example simply copy-pasting a property from one infantry unit to a vehicle unit also caused a Crash at Startup for me. So the yaml-reading code at game start seems to quit easily. Might be a design choice for Debugging purposes or something :?

i guess those copy-pasting mechanics shown in the walkthroughs/ modding tutorials don't apply for my Version. Simply rendering a different unit as the custom unit (as shown in tutorial) also crashed the game.

I dunno. Maybe i'll have to try future Versions. No idea :\

hmmm converting the .shp in xcc mixer seems to have ultimately fixed it and my unit works fine. Gonna have to make a proper cameo for it instead of a placeholder, though. also twaek and Balance the ftnk.

Remuneration
Posts: 52
Joined: Sun Mar 09, 2014 3:49 pm

Post by Remuneration »

scorp wrote: hmmm converting the .shp in xcc mixer seems to have ultimately fixed it and my unit works fine.
I also use xcc mixer, BUT:

Maybe I 'm doing something wrong?

Objective: To replace the view from the Ordos Construction Yard (if you can call it that) . SHP is taken from here : http://openra.ppmsite.com/d2k-complete-packages.zip

Changes that I brought :

1) I renamed the file conyardo.shp --> test.shp

2) placed test.shp in folder: mods \ d2k \ bits

3) then, in the file: mods \ d2k \ rules \ ordos.yaml , I added code:
------------------------------------------------------------
CONYARDO:
Inherits: ^CONYARD
RenderUnit:
Image: TEST

------------------------------------------------------------
Result: Game crashes during deployment mcv:

Dune 2000 Mod at Version release- 20131223
Operating System: Windows (Microsoft Windows NT 6.2.9200.0)
Runtime Version:. NET CLR 2.0.50727.8000
Exception of type `System.InvalidOperationException`: Trait prerequisites not satisfied (or prerequisite loop) Actor = conyardo Unresolved = RenderUnitInfo Missing = IFacingInfo
in OpenRA.ActorInfo.TraitsInConstructOrder ()
in OpenRA.Actor .. ctor (World world, String name, TypeDictionary initDict)
in OpenRA.World.CreateActor (Boolean addToWorld, String name, TypeDictionary initDict)
in OpenRA.World.CreateActor (String name, TypeDictionary initDict)
in OpenRA.Mods.RA.Activities.Transform. <Tick> c__AnonStoreyFC. <> m__231 (World w)
in OpenRA.World.Tick ()
in OpenRA.Game.TickInner (OrderManager orderManager)
in OpenRA.Game.Tick (OrderManager orderManager)
in OpenRA.Game.Run ()
in OpenRA.Program.Run (String [] args)
in OpenRA.Program.Main (String [] args)

What is my mistake ?

Angusm3
Posts: 33
Joined: Fri Oct 18, 2013 2:00 am

Post by Angusm3 »

are you able to post the modified section of yaml from your rules and sequences vehicles.yaml files? Also a copy of the SHP that you are trying to add? The fact that it crashes when you try to look at it narrows it down, probably to the icon SHP though.

Matt
Posts: 1144
Joined: Tue May 01, 2012 12:21 pm
Location: Germany

Post by Matt »

You can't mix two incompatible render traits like RenderBuilding (inherited from ^CONYARD) and RenderUnit which is for mobile things. They need sprites for every direction (facings).

Remuneration
Posts: 52
Joined: Sun Mar 09, 2014 3:49 pm

Post by Remuneration »

Cmd. Matt wrote: You can't mix two incompatible render traits like RenderBuilding (inherited from ^CONYARD) and RenderUnit which is for mobile things. They need sprites for every direction (facings).
If RenderBuilding inherited from ^ CONYARD then why every House has a different view of the construction yard?
Angusm3 wrote: are you able to post the modified section of yaml from your rules and sequences vehicles.yaml files? Also a copy of the SHP that you are trying to add? The fact that it crashes when you try to look at it narrows it down, probably to the icon SHP though.
attached the SHP and modified section of yaml.

And I did not edit sequences vehicles.yaml
Attachments
test.shp
(24.43 KiB) Downloaded 543 times

Remuneration
Posts: 52
Joined: Sun Mar 09, 2014 3:49 pm

Post by Remuneration »

yaml
Attachments
ordos.rar
(132 Bytes) Downloaded 605 times

Sircrashalot
Posts: 52
Joined: Fri Feb 28, 2014 2:08 pm

Post by Sircrashalot »

Having a similar problem here. I tried to modify the ra flame thrower to be used as a harkonnen flame thrower for d2k. I get this error message at start:

`System.IndexOutOfRangeException`: Der Index war außerhalb des Arraybereichs.
bei OpenRA.FileFormats.Format80.DecodeInto(Byte[] src, Byte[] dest)
bei OpenRA.FileFormats.ShpReader.Decompress(Stream stream, ImageHeader h)
bei OpenRA.FileFormats.ShpReader..ctor(Stream stream)
bei OpenRA.FileFormats.SpriteSource.LoadSpriteSource(Stream s, String filename)
bei OpenRA.Graphics.SpriteLoader.CacheSpriteFrames(String filename)
bei OpenRA.FileFormats.Cache`2.get_Item(T key)
bei OpenRA.Graphics.Sequence..ctor(String unit, String name, MiniYaml info)
bei OpenRA.Graphics.SequenceProvider.<LoadSequencesForUnit>c__AnonStorey8D.<>m__1BD(KeyValuePair`2 x)
bei System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
bei System.Linq.Enumerable.ToDictionary[TSource,TKey,TElement](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector)
bei OpenRA.Graphics.SequenceProvider.LoadSequencesForUnit(String unit, MiniYaml sequences)
bei OpenRA.Graphics.SequenceProvider.Initialize(String[] sequenceFiles, List`1 sequenceNodes)
bei OpenRA.ModData.PrepareMap(String uid)
bei OpenRA.Game.StartGame(String mapUID, Boolean isShellmap)
bei OpenRA.Game.LoadShellMap()
bei OpenRA.Mods.RA.DefaultLoadScreen.TestAndContinue()
bei OpenRA.Mods.RA.DefaultLoadScreen.StartGame()
bei OpenRA.Game.InitializeWithMod(String mod)
bei OpenRA.Game.Initialize(Arguments args)
bei OpenRA.Program.Run(String[] args)
bei OpenRA.Program.Main(String[] args)
Attachments
fhark.shp
(72.44 KiB) Downloaded 527 times

Sircrashalot
Posts: 52
Joined: Fri Feb 28, 2014 2:08 pm

Post by Sircrashalot »

Ok seems like i can not use td shps for d2k. I tried TS shps and it worked but i am having a problem with the facing. My Chem Trooper walks in circles... and when i open the TS shp in OS shp builder there is a problem starting from frame 89. The TD shp version works fine in OS shp builder.

PS: attached the Chem trooper (still WIP though)

sequence yaml:

ochemtrooper:
stand:
Start: 0
Facings: -8
Transpose: true
stand2:
Start: 0
Facings: -8
Transpose: true
stand3:
Start: 0
Facings: -8
Transpose: true
run:
Start: 9
Length: 6
Facings: -8
Tick: 110
Transpose: true
shoot:
Start: 57
Length: 6
Facings: -8
Transpose: true
prone-stand:
Start: 97
Facings: -8
Transpose: true
prone-run:
Start: 105
Length: 3
Facings: -8
Transpose: true
Tick: 110
standup-0:
Start: 96
Facings: -8
Transpose: true
Tick: 120
prone-shoot:
Start: 128
Length: 6
Facings: -8
Transpose: true
die1: DATA
Start: 382
Length: 5
die2: DATA
Start: 387
Length: 7
Tick: 80
die3: DATA
Start: 394
Length: 7
die4: DATA
Start: 401
Length: 7
die5: DATA
Start: 408
Length: 7
die6: DATA
Start: 415
Length: 12
die-crushed: DATA
Start: 430
Length: 12
Tick: 1600
icon: DATA
Start: 4011
Offset: -30,-24



EDIT: Might there be a problem how the frames are arranged inside the shp?
Attachments
ochemtrooper.shp
(32.84 KiB) Downloaded 515 times

User avatar
Sleipnir
Posts: 878
Joined: Wed Apr 10, 2002 11:52 pm
Contact:

Post by Sleipnir »

The D2K sprites are ordered differently to TD/RA, which is why they use negative facings and define Transpose: true. If you are using TD shps, then you need to remove Transpose and use positive facings.

Sircrashalot
Posts: 52
Joined: Fri Feb 28, 2014 2:08 pm

Post by Sircrashalot »

Sleipnir wrote: The D2K sprites are ordered differently to TD/RA, which is why they use negative facings and define Transpose: true. If you are using TD shps, then you need to remove Transpose and use positive facings.
Thanks! It works now!

Post Reply