[BETA] Easy Turrent Ship Editor


#1

---- Update (10-2) ------------
DONE! Well, buggy. I got the major ones out so it can read weapons platform txt files easier. To be honest, till I get home in an hour I am not sure it will work. However, since the ship hull files I take apart and put back together equal one another I am going to say “sure”.

How to use: Basically, you click on open (ignore the two buttons down there) and it will ask for the hull file to open. (data\ships\hulls\race\file.txt) and then it will ask for the graphic file (data\bitmaps\ships(race)(ship dir)\file.dds) then it will load a picture of where the hard points are located and any sub Turret it might have. You can then click and drag any of the hard points anywhere you want. To add a hard point, right click where you want to add and select “Add->” and the type. You can also delete by hovering over a hard point or change its type.

To add a sub Turret, be sure its a Turret and right click, then select “Add Sub Turret”, It will create one a bit above where the turret is, just click and drag it to the place you want. On the left it will tell the true X, Y position of the mouse, and when your over a turret its “Virtual” x,y. (I am assuming ALL ships use a 256,256. If not I think I found a bug:P)

Give it a shot. Be sure to back up your data directory first though. The whole program processes all the numbers as ints so if things are slightly off I can fix that too. Enjoy!

(Note: Be SURE to get .NET 3.5 from the Microsoft update site. I COULD program this thing in C++, but then I COULD spend another month on it:P)

----Update (9-30)-----
Man, some big updates too. Now you can move around the turrets and place them anywhere you want. You can now add turrets, delete them and change the type. I don’t like how I am handling the context menu, but I realize this is a “tool” It might be a hack job, but its going to work decent enough for a normal person.

Things I will finish up tomorrow on is adding the “extra” turret emplacements (When one turret really puts more than one down, like on some cruisers) and, er, saving. Yea I know, the whole PURPOSE is to save the damn data, and it IS being updated in the correct structure so saving will be fairly easy. Its just close to 6:30 now and I am wanting to go home from work so neyh.

The “new” Context menu, I think, requires .NET 3.0. I can go to the old type so if anyone has any problems just post:)

Also, NO error checking, its going to spew if you pick any other text file other than the one in hulls\race\ship.txt structure.

----Update (9-29)--------
Didn’t want to keep filling the forms with new posts so I thought I keep editing this one.

Big milestone today. It now reads ship files, parses them (well, just the header and the slot section) draws the bitmap, then draws where all the turrets go. I even have it draw lines to the other spots
if there are more than one turret that is place per turret placement. Next on the list I am going to add a drag/add turret function (or delete). I figure if I do just one part of the editing a time I can make it more functional over time.

To use, just open the program, and pick “Open” in the menu. It will ask you to open the txt file of the ship first. Then it will ask you to open the DDS file of the bitmap of the ship and poof.

Seems to work, so far, with a bunch of the random ships in the main data directory, but I haven’t fully tested it on other mods. Don’t open other than txt and dds files as there is NO error checking so it will just cut off.

Ok, its not much at all to be honest. All it can do now is open a dds file, properly parse the heading and display it on the screen. In fact most of the code that reads the file is incredibly inefficent, but it took me dang near 5 hours of my life so here it is.

Alright, conversion to C# is complete and its a HECK of alot faster. It reads DDS files in a blink of an eye, compressed or not. Still have some alpha problems with DXT3 and DTX5 but going to let them slide for now. Still, 14k for a file is fairly nifty.


#2

Ugh. Scratch it being easy. I didn’t have a way to get the install from work so I didn’t have the uncompressed DDS files to work with. Not worries! Let me download the new star wars mod!

Compressed with DXT5:P ARG. I figure this isn’t the only release that will use compression, so I am implementing a DXT1-5 decompression schema. Since this program narrow function is to just assign hard points and damage points and saving it to the text file format, it needs to be able to display the bitmaps. Luckily DXTn compression is kind of easy and I ‘might’ be able to skip the alpha channel calculations.

I do have one question, will there ever be any other format other than 512x512 or 256x256?


#3

Wow, great idea! Thanks for putting in the work so the rest of us can benefit.

The game’s base graphic files are all 512x512, except for fighter sprites which are 128x64 (1 to 64 undamaged sprite, 65 to 128 damaged sprite). The sprites shouldn’t need to be handled since it’s easier to see the fighter’s details working on the 512x512 file. I actually used 1024x1024 for my Star Wars cruiser hull graphics. That’s why I compressed everything - it’s hard to justify 15MB of 2D Star Destroyer, or anything else!

I don’t think you should worry about loading 256, 512, 1024, 2048, 65536, or whatever insanity people mod in. Almost everything defined in the hull file bases its coordinates on a 256x256 grid, except for hulks which are 512x512 for some reason. It’s probably safe to assume 512x512 is enough detail for anyone to work in, and just scale any images that don’t fit.

[code]double scalefactor = image_dimensions / 512.0;

for the height of the image used for editing (say 512)
for the width of the image used for editing
draw the source image pixel from (int)(rowscalefactor),(int)(columnscalefactor) at the current destination pixel (row, column)[/code]

…or something.


#4

Oh I know why he did the 256x265. Its to make it easer to mess with the bitmaps when they scale in DirectX. I just wanted to know if that scale is the same for everything. Even 128x128. But if I am working only in 512x512 I guess its moot.

You know I was looking at that. I took the Alliance Stingray Cruiser (at random) and using gimp converted it to DXT1, 3 and 5 so I can work at work on the sly. I really don’t see a huge difference in graphics quality, between the uncompressed and compressed version. Even using DXT1 it was hard to even see its compressed at these high resolutions.

Though I don’t know if we would like to use DXT1, sure you get 8:1 (171kb vs 1.6megs for this sprite) but only one bit alpha. Still, I haven’t really seen alpha being used in this game. This is just me ranting though.

Oh and this thing is NOT going to be supporting any “save as compression” I took a look at the dds.exe code for gimp. Its like 50 lines for the uncompression, but the rest of it was all the color searching:P

PS - As a side note, I am having more fun programing this right now than playing the game, priority’s eh?:slight_smile:


#5

Drat, file too big, I will post it when I get home as I have a web server I can stick it at.


#6

Bump:P


#7

naw… does the save feature actually work yet? i tried it and nothing changed ingame!!


#8

Damnit I think I know. You might have to run the program “as administrator” if your using Vista. Writing to the Program Files directory directly causes an error. It shows up on my system because I have a debugger but no box will come up. If you don’t want to run it as admin, try saving the file to your desktop or my documents folders first.

Sorry about that. I run XP at work but didn’t notice it till I got home on 7. I can’t find my USB drive to check for the error either so it will be Monday before I can look at it:P


#9

Thank you!!! It works now! damn, this is a nice editor, it would be perfect if u added a mode that one side of the ship would mirror the sub turrtes/ turrets u add. keep it up!!!


#10

Humm. Thats a good idea. Its why I put the X/Y cords so you could make sure its level. But yea, thats a good diea. I will set up a Tools drop down so you can select so kind of locking. But to be honest running lights are next then explosions:P


#11

Wow! lights and explosions? that would be the best!


#12

NOOOOOOO! i just tried my new Valhala hull… and GSB stopped working when i started a challenge!


#13

nevermind!!! there was a problem with my coding… Wow! nice job.


#14

sounds good but it just won’t download. when i click the link, nothing happens. zero. nadda. zip. er, let me explain. It DOES download, but when i use crossover to actually use it, nothing happens.


#15

Everytime I try to open a textfile with this it gives an error message (alot of it is in finnish, so i can’t really copy everything here). The information on the error messge is as follows:

My operating systen is Vista, if that changes anything.


#16

This is a beta, and he basically gave a barebones glitchy version, It can’t read the ship files correctly. Maybe if this person comes back on he will fix it, I like this especially since i hate editing turrets.


#17

this is terrific!
runs fine on my test windows 7 machine.
now i just need to finish some of the hulls im working on and really give it a whirl.


#18

I upgraded to windows 7, but It won’t load anything. (probably because I… edited them myself.)


#19

This is the error that I get.

************** Exception Text ************** System.FormatException: Input string was not in a correct format. at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at DDS_Viewer.HullFile.ParseHeader() at DDS_Viewer.HullFile.ParseData() at DDS_Viewer.Form1.openToolStripMenuItem_Click(Object sender, EventArgs e) at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e) at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e) at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e) at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ToolStrip.WndProc(Message& m) at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


#20

Works very well, except for the Empire fighters. Thanks for this tool !

Error when trying to load any of the 3 empire fighter. On a Vista machine.

[code]See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.FormatException: Input string was not in a correct format.
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at DDS_Viewer.HullFile.ParseHeader()
at DDS_Viewer.HullFile.ParseData()
at DDS_Viewer.HullFile…ctor(String filename)
at DDS_Viewer.Form1.openToolStripMenuItem_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3603 (GDR.050727-3600)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll

DDS Viewer
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files/Positech%20Games/Gratuitous%20Space%20Battles/MODS/NicokoMod/data/bitmaps/ships/DDS%20Viewer.exe

System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll

System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

System.Core
Assembly Version: 3.5.0.0
Win32 Version: 3.5.30729.1 built by: SP
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Core/3.5.0.0__b77a5c561934e089/System.Core.dll

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
[/code]