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)

No comments: