FOnline Development > General Discussion

FOnlineServer with Mono

(1/11) > >>

Bartosz:
Hello,

As of rev383 of the SDK I decided to commit the files of the (rather big) functionality I've been working on lately: embedding Mono runtime in the server to allow write scripts in .NET languages.

The files are placed under Server/mono directory and do not affect the current state of SDK. They're meant for testing purposes (the work done was rather large, and sometimes tedious, many bugs could slipped in).

Instructions

To try it out, follow the steps:
1. Replace your FOnlineServer.exe and FOnlineServer.pdb files with the one from mono directory.
2. Check the mono/FOnlineServer.cfg file and copy the lines from # Mono runtime section, most importantly:

--- Code: ---MonoEnabled=1
MonoLibDir=mono/lib

--- End code ---
  The rest is optional.
3. Use either Visual Studio or MonoDevelop to build the provided solution file: mono/FOnline.Mono.sln. The resulting files will be copied to Server directory.
4. Run the server, you should see some mono related messages, most notably 'Initializing mono' and 'Init from mono!' that will tell you everything is OK.

Debugging
There are several ways you can debug your code (and even aid in debugging AS code).

REPL console:

It's possible to start server with console that is evaluating C# statements on the fly. Just add -mono_repl to your server command line.


Line-by-line debugging with MonoDevelop' Soft Debugger:

1. Fetch mono runtime (latest version is 3.0.2, the server currently is integrated with 3.0.1, it should work fine) from their download page.
2. Install it.
3. Fetch MonoDevelop, install it, and before starting, set MONODEVELOP_SDB_TEST environment variable to 1.
4. Now, start MonoDevelop, go to Tools->Options->.NET runtimes and add the one you've installed in step 2. Mark it as default.
5. Open FOnline.Mono.sln, place some breakpoint and choose Run->Run with...->Custom Command Mono Soft Debugger and enter the path to FOnlineServer.exe in Command textbox
6. Choose whatever command line you wish, and add -mono_debug
7. Click listen, and wait for server to be started and your breakpoint hit.
8. Enjoy:


More info
The project contains few scripts that mimic few scripts from Den location, this is to show briefly how writing scripts in C# looks like. For more information refer to: wiki page on our trac.

Gob:
So what? Instead of AngelScript I can now do VB.NET or C# or C++?

Bartosz:
...or F#.

And not really 'instead', rather 'additionally'.

Gob:
F# huh? I might give it a try. This sure is good news.

Bartosz:
Added info about debugging.

Navigation

[0] Message Index

[#] Next page

Go to full version