October 31, 2013

Shawn Guce: Take Two

I read an article on Kotaku today about a pirate who sounded a little familiar.

Back in 2008, Activision went after some pirates.  Shawn Guce settled out of court for $100,000, and then went out trying to expunge records of this settlement from the net.

Some people never learn...

October 27, 2013

Coders: TerrariaServer without XNA?

I think it's possible to get TerrariaServer running without XNA without rewriting the code, which would be the first step in getting Terraria servers able to be hosted on Linux.

I was using Mono.Cecil to try to modify Terraria on the fly.  My hope was to make it so that I could inject hooks directly into the Terraria executable to allow things like replacement UI layers or modifying certain constant values, and while I was doing it, I found that I could replace all of the XNA assembly references with references to an assembly under my control.

I was then able to write stubs and mocks for all of the XNA objects needed on the critical path and get it to the point where Terraria wouldn't crash on connect.  It won't accept the connection, but it isn't crashing.

Even if this doesn't get out to Linux, there would be some extremely minor benefits getting this going anyway.   The mocked version uses 6MB less memory and doesn't require an XNA-compatible video card on the server.

Now, there's nothing here that's usable by a standard end user at the moment, but here's a source release for people who are interested in this problem space and want to take it and run with it.

http://www.romsteady.net/Projects/DasmAsm-20131027.zip (VS2010 solution)

October 26, 2013

Terraria Server on Linux?

This isn't directly RomTerraria related, but could be related to how RomTerraria is going to be working going forward.

The biggest problem with making a non-source mod like RomTerraria is that every time the game changes, even if your code wouldn't normally be affected, your app completely breaks because the binding changes.  There's no way to ensure a consistent experience for your code.

With early versions of RomTerraria, I took advantage of the XNA component framework.  That gave me a perfect place to inject my code where it would work nicely with all of the code that already exists in the game.  However, with v1.2, the call to base.Draw() removed my ability to easily inject rendering calls for things like the minimap and HUD updates I had put in before.  In addition, since Terraria uses some Win32 calls internally, you can't really use Terraria in a non-Windows environment.

What would work out well was if I could take an arbitrary Terraria executable and inject code without distributing Terraria's code.  Fortunately, a tool set does exist for doing this: ildasm and ilasm. You run ildasm against Terraria.exe or TerrariaServer.exe and you get the MSIL for the executable.  You apply your patches, then run ilasm to recreate your executable.

Example disassembly:
ildasm TerrariaServer.exe /out=TerrariaServer.il

Example reassembly:
ilasm /32bitpreferred /output:TerrariaServerRecompile.exe TerrariaServer.il

Then you can just run TerrariaServerRecompile.exe and have a round-tripped server executable.

So what I was thinking of doing was writing dummy stubs for most of the interop code (NATUPNPLib.UPnPNAT, etc.) and trying to get TerrariaServer.exe able to run on Linux as an experiment.  If I can get this to work, I can then make the next step for RomTerraria: inject entry points directly into the Terraria executable without redistributing any Terraria code.


October 14, 2013

No Updates This Week

I'm flying to San Jose/Cupertino/Sunnyvale tomorrow and won't be back until next week.

Work on RomTerraria will resume then.

October 4, 2013

RomTerraria 3.0 Feature Request Post

[Update 11/9 1:25p] The preview release is over here.

Okay, after looking at the massive amount of change in Terraria, looks like I'm going to have to completely rewrite RomTerraria.

Functionality mods can still use the Component architecture in XNA, but visual mods can't due to changes made in how Terraria works.

So, consider this a complete startover.  I'll be using no code from the previous versions of RomTerraria.  If you have any requests for features to be added to RomTerraria 3.0, consider this your place to request them.  I'll also add in updates on requests as they come in.

Request #1: Make it Linux compatible.  That's not something I'll be able to do.  Terraria is tightly bound to XNA and Windows at the moment.  Redigit did say that he was looking at a port to MonoGame, but was having too many problems and Terraria 1 probably will never come to Linux[11/3: I did manage to get the server running without XNA, which is promising.]

Request #2: Key re-binding.  Already exists.  Settings -> Controls

Request #3: PoniesThread for reference.  Will bring back the pony.

Request #4: Save map as PNG.  Okay, I can do this one.  Should even be able to hotkey it.  One key for a 1px-per-tile version, one key for a full-size version.  [10/5: 50% done. 11/3: Complete, but unstable, so not ready for release.]

Request #5: Allow inventory to be moved.  This would be really tricky, but not impossible.  The only downside is that you wouldn't be able to use the default inventory key, unfortunately.  I'll look at it for vNext.

Request #6: Have wings and rocket boots consume mana.  Working on it.

Request #7: No shadows.  Not sure I can do this one easily, but I'll see what I can do.

Request #8: Full map reveal.  Should be easy.

Request #9: Invulnerability.  Can't do that, but I might be able to make it so enemies die when they get within a certain range of you.

Request #10: Server support for mods.  Will look into this one.  [11/3: Doable. I've got code that will allow me to inject hooks anywhere...and I do mean ANYWHERE.]

Request #11: Smooth lighting and Eyefinity.  What's wrong with it?  I'm running an nVidia card on a single monitor, so I need clarification on this one so I know what I'm looking for. [11/3: Complete, released.]

Request #12: Add the bunny from the collector's edition for Steam copies without registry mucking.  [11/6: Completed, but removed from the mod because it would result in the mod being banned from the official forums for the game.]