TEdit / Terraria-Map-Editor

TEdit - Terraria Map Editor - TEdit is a stand alone, open source map editor for Terraria. It lets you edit maps just like (almost) paint! It also lets you change world settings (time, bosses downed etc), edit chests and change sign, make epic dungeons, castles, cities, and add rewards for your adventurers!
https://docs.binaryconstruct.com/
Other
1.6k stars 342 forks source link

TConfig World Not Opening #215

Closed DemonMage closed 12 years ago

DemonMage commented 12 years ago

Have a world with a couple of custom items, but only in players inventories, and I can't get the world file to load. It just crashes around the chest loading stage with this error:

01-12-2012 18:55 v3.1.12009.2302 Error - Unable to read beyond the end of the stream.
   at System.IO.BinaryReader.ReadString()
   at TEditXNA.Terraria.World.LoadWorld(String filename) in D:\Dev\_PROJECTS\Terraria\Terraria-Map-Editor\TEditXna\Terraria\World.cs:line 742
   at TEditXna.ViewModel.WorldViewModel.<>c__DisplayClass23.<LoadWorld>b__22() in D:\Dev\_PROJECTS\Terraria\Terraria-Map-Editor\TEditXna\ViewModel\WorldViewModel.cs:line 471
   at System.Threading.Tasks.Task`1.InvokeFuture(Object futureAsObj)
   at System.Threading.Tasks.Task.InnerInvoke()
   at System.Threading.Tasks.Task.Execute() 

You can find a copy of the world file, and the obj file for the mod here: http://demonmage.com/TEdit-DM-ProblemWorld-01.rar

Surfpup commented 12 years ago

I'll be happy to make the simple changes necessary to world and player loading/saving. But I can't load the visual studio solution and run it without some external projects that aren't included here.

BinaryConstruct commented 12 years ago

The extra requirements are XNA game studio and BCCL project, which is also on my github.

BinaryConstruct commented 12 years ago

If you have custom tiles (or replace any tiles), you must add them to the settings.xml file, e.g.

<Tile Id="2" Name="Grass" Color="#FF1CD85E"  Solid="true"/>
<Tile Id="3" Name="Grass Flowers" Color="#FF0D6524" Framed="true" TextureGrid="16,20">
Surfpup commented 12 years ago

I wonder if there's an easy way to choose a color based on the image?

BinaryConstruct commented 12 years ago

If you are referring to the rendered tile color, you can edit the settings.xml file.

Surfpup commented 12 years ago

I'm talking about doing something like this: http://stackoverflow.com/questions/6177499/how-to-determine-the-background-color-of-document-when-there-are-3-options-usin/6185448#6185448

To automatically determine the correct color to use in tools such as yours.

BinaryConstruct commented 12 years ago

Ah, yes this could be done without too much trouble. All of the code for loading the textures and converting them to bitmaps is already in place. It would probably be a one-time generation to update the settings.xml. Most of the current colors are pulled from the other map viewers (Terrafirma,etc) so that they have a similar look and feel. I have some code that extracts tile data for updates and patches, I could add something like this in eventually. However, changing color schemes would break the real-color image schematics.

This is off topic but I'll keep it in this issue for now. Github doesn't have a good way to split issues.

Surfpup commented 12 years ago

Now I've updated the saving method used in tConfig, and I am back to looking at compatibility with tools again. There is an issue: the ID values will vary depending on the world selected. I can't just update settings.xml once with some new info, it has to be updated every single time a world is saved. So, ideally tConfig would write out an XML file (which contains only the new info, but follows your XML structure) where the worlds are saved, and it would be like "world1.wld.TEdit.xml" - and TEdit would read this XML file appropriately if it is available. If you could make this possible, that would be great. If not, I'm open to other ideas.

BinaryConstruct commented 12 years ago

I'm opening a new issue for this, please see #236