Index outside bounds Issue

Jun 25, 2011 at 12:36 AM

Upon running my batch file I received the following error, see the batch below for reference. I am running Windows 7 x64 and the world file is a standard (unmodified by anything other than terraria itself) large size world.

I hope someone can help with this. Thanks in advance.

C:\Users\Nate\Downloads\TerrariaMapTool>terrariamaptool.exe -terraria "C:\Progra
m Files (x86)\Steam\steamapps\common\terraria" -world "C:\Users\Nate\Documents\M
y Games\Terraria\Worlds\world1.wld" -output "C:\Users\Nate\Documents\My Games\Te
rraria\MapGen" -blocksize 16,16 -layer drawwalls,drawbackgroundwater,drawforegro
undwater,drawbackgroundtiles,drawforegroundtiles -zoomlevels 0.03125,0.0625,0.12
5,0.25,0.5,1 -mapdata
Loading world
Unhandled exception:

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Terraria.World..ctor(String path)
   at TerrariaMapTool.MapGenerator.Generate(MapGeneratorProgressHandler progress
Handler)
   at TerrariaMapTool.Program.ConsoleMain(String[] args)

Jun 28, 2011 at 12:48 AM

I am having the same issue, same error letter for letter.

Jun 28, 2011 at 5:11 AM

Same issue on two computers now - both Win7, one 32 bit one 64 bit both SP2. I've tried large and small maps, all the options, command line and gui - same error. 

Jul 3, 2011 at 12:44 PM

I believe this could be an issue with the 1.0.5 release adding in new tiles. I'm attempting to debug but working through other peoples code is often tricky ^^.

Jul 3, 2011 at 11:54 PM

developer hasn't been on since june 7 T_T

Coordinator
Jul 13, 2011 at 6:59 AM

Been on hiatus. I'll try to take a look at this this weekend.

Jul 14, 2011 at 2:26 AM

aa

Jul 15, 2011 at 1:57 PM

I believe I've fixed this issue by adding the new tile types - will see about posting the changes on here, or at least an updated EXE later today. Just running it through a large map to test it now.

Jul 15, 2011 at 4:06 PM
Edited Jul 15, 2011 at 4:06 PM

Yep - there we go. Generated just fine. May need some changes to the code regarding block definitions for the new blocks, but it builded the large map perfectly fine.

New source (included pre-built binaries) are available here: http://g0blin.co.uk/terrariamapgenerator-Trunk-1628_Seidr_15072011.zip

Thanks for this cool piece of kit - made a reaaally nice looking map :)

Coordinator
Jul 17, 2011 at 3:49 AM

I just uploaded a new version.

It's mostly what you saw Seidr but this also fixes the rendering of corrupted trees and jungle trees as well as a few other minor fixes.

Jul 24, 2011 at 12:16 AM
Edited Jul 24, 2011 at 12:25 AM

I tryed with the new version (1.0.0.5) and I have the same error. (large map)

Win7 x64

With GUI 

CLR20r3

terrariamaptool.exe

1.0.0.5

4e224480

Terraria

1.0.0.2

4e2242ad

2

0

System.IndexOutOfRangeException

NO GUI

Loading world
Unhandled exception:

System.IndexOutOfRangeException: Index was outside the bounds of the array.
at Terraria.World..ctor(String path)
at TerrariaMapTool.MapGenerator.Generate(MapGeneratorProgressHandler progress
Handler)
at TerrariaMapTool.Program.ConsoleMain(String[] args)

 

EDIT: I upload the world (created in multiplayer)

http://www.megaupload.com/?d=DYBQ77KO

Coordinator
Jul 24, 2011 at 8:49 AM

Thanks for the upload. It helped me find the issue instantly. I uploaded a new version 1.0.0.6 that should address it.

Jul 24, 2011 at 10:00 AM

it's working now..  (1.0.0.6)

 

THX!!

Aug 19, 2011 at 10:59 PM

Even with 1.0.0.6 I am receiving the same error as listed above.

 

I uploaded my map to http://www.megaupload.com/?d=UT8A6ESM .  Any help would be awesome!

Coordinator
Aug 20, 2011 at 3:15 AM

Found the issues with your map. Will have the fixes in the next update.

Coordinator
Aug 20, 2011 at 3:53 AM

New version up. Give it a try.

Aug 20, 2011 at 10:01 AM
Edited Aug 20, 2011 at 10:36 AM

New version crashes while trying to generate map.

Crashes while generating images for zoom 0,0625

My map can be downloaded here: http://terraria.sewers.dk/world4.wld

Aug 20, 2011 at 7:24 PM

Just tested with the commandline parameters to see if that would do the trick. Sadly no.

  Writing Block 1401,798
  Writing Block 1401,799
Unhandled exception:

System.AggregateException: Der opstod en eller flere fejl. ---> System.IndexOutOfRangeException: Indekset lå uden for arrayets grænser.
   ved TerrariaMapTool.MapGenerator.DrawWalls(World world, Rectangle region, Graphics g, TextureSet textures)
   ved TerrariaMapTool.MapGenerator.CreateBlockImage(World world, Rectangle region, Point offset, Single zoomLevel, MapGeneratorLayerOptions layer)
   ved TerrariaMapTool.MapGenerator.CreateBlockImages(World world, Int32 blockX, Int32 blockY, Int32 blockWidth, Int32 blockHeight, Single zoomLevel)
   ved TerrariaMapTool.MapGenerator.<>c__DisplayClassd.<Generate>b__7(Int32 i)
   ved System.Threading.Tasks.Parallel.<>c__DisplayClassf`1.<ForWorker>b__c()
   ved System.Threading.Tasks.Task.InnerInvoke()
   ved System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   ved System.Threading.Tasks.Task.<>c__DisplayClass7.<ExecuteSelfReplicating>b__6(Object )
   --- Slut på staksporing af indre undtagelser ---
   ved System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   ved System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   ved System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWi
thState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
   ved System.Threading.Tasks.Parallel.For(Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body)
   ved TerrariaMapTool.MapGenerator.Generate(MapGeneratorProgressHandler progressHandler)
   ved TerrariaMapTool.Program.ConsoleMain(String[] args)
---> (Indre undtagelse #0) System.IndexOutOfRangeException: Indekset lå uden for arrayets grænser.
   ved TerrariaMapTool.MapGenerator.DrawWalls(World world, Rectangle region, Graphics g, TextureSet textures)
   ved TerrariaMapTool.MapGenerator.CreateBlockImage(World world, Rectangle region, Point offset, Single zoomLevel, MapGeneratorLayerOptions layer)
   ved TerrariaMapTool.MapGenerator.CreateBlockImages(World world, Int32 blockX, Int32 blockY, Int32 blockWidth, Int32 blockHeight, Single zoomLevel)
   ved TerrariaMapTool.MapGenerator.<>c__DisplayClassd.<Generate>b__7(Int32 i)
   ved System.Threading.Tasks.Parallel.<>c__DisplayClassf`1.<ForWorker>b__c()
   ved System.Threading.Tasks.Task.InnerInvoke()
   ved System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
   ved System.Threading.Tasks.Task.<>c__DisplayClass7.<ExecuteSelfReplicating>b__6(Object )<---

 

I know that some of the above is in Danish, but that's just because I'm running a Danish Windows

Coordinator
Aug 20, 2011 at 10:02 PM

Downloading and I'll give it a test.

Coordinator
Aug 20, 2011 at 11:35 PM

I ran your map using the gui generating all zoom 1 and below and had no crash.

Aug 21, 2011 at 9:00 AM
Edited Aug 21, 2011 at 10:05 AM

Weird.

My Terraria Map Generator config file: http://terraria.sewers.dk/TerrariaMapGenerator.xml

Hope that helps.

I tried redownloading the tool, but that gave the same crash.

I have the tool located the same place as the older version, so I don't really see why it should crash because of the location on my disc.

Could it have anything to do with my system using , (comma) as a decimal seperator and . (dot) as a thousand seperator? Don't know if you changed any code to handle that.

Tried running the Tool as Admin, still no good :-(

Aug 21, 2011 at 10:18 AM
rpowers3 wrote:

I ran your map using the gui generating all zoom 1 and below and had no crash.

Normally I use the GUI when i generate, but that didn't give any clear message as to why it crashed. That's why I ran it as commandline to see, and so i could paste the crash in here.

I'll try to step through your code when I get home, just so I can give you a better error description.

Aug 21, 2011 at 1:57 PM
Edited Aug 21, 2011 at 1:59 PM

Okay, so I did some digging in your code and the tool crashes when it reaches line 729 which is this line

g.DrawImage(textures.tileTexture[world.tile[x, y].Type], (x - region.Left) * 16 - (width - 16) / 2, (y - region.Top) * 16 + num9, new RectangleF(world.tile[x, y].FrameX, world.tile[x, y].FrameY, width, height), GraphicsUnit.Pixel);

I hope this helps so that we can resolve this problem and I can get this awesome tool working again.

Coordinator
Aug 22, 2011 at 1:13 AM

Crashing at that line would suggest that the world tile is out of the bounds of the tile set that was found in the Terraria content folder.

The issue could be that the Terraria path specified points to an old location of an unpatched Terraria install or something like that. The tool uses the Contents/Images/Tiles_#.xnb files to generate the tileTexture array. There should be 106 elements in it with the current release. If you can debug, try checking the value of world.tile[x, y].Type and see what index it is requesting then check the size of textures.tileTexture.

Aug 22, 2011 at 8:31 AM
Edited Aug 22, 2011 at 12:17 PM

Major error on my part.

I had a copy of Terraria on my HDD that wasn't updated to the newest version and I just now realized that that was the version I was using to generate the map from, but that version of Terraria was only 1.0.5 and not 1.0.6+. Whoops.

Everything worked flawless when I chose the Steam version.

Maybe you should incorporate some version check into the tool, that tells the user if it's the wrong version of Terraria they have?