RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Setting up Runuo for Visual c# Express 2005, creating a .exe and library

Jareish

Wanderer
Visual C# Express 2005 - Compiling RUNUO SVN into a .exe and a Script Library

Maybe a bit to soon to say it, but I got it working under Vista now! See the 2nd post for the Files. If someone else gets this working to, please PM me, so I know for sure! Im not sure what the solution is, because I did several things at once (m$ visual c# 2005 update, new rev and edited the serverlist.cs). Please check if you can.

There are tons of questions referring to setting up a Runuo Server once they got the SVN. I've been struggling with it myself, so here is the solution.

What's in this tutorial?
-Setting up a clean and neat folder overview
-Setting up Visual C# Express 2005
-Creating a Class Library containing your scripts (scripts.dll)
-Creating a Console Application containing the core. (Server.exe)
-Editing the scriptcompiler.cs to link the exe with the dll.

So before we get started, I like to say I'm kinda a clean and tidy person. Project folders are clean and neat. So I always know what's happening in a folder. So some of you people, who don't need the whole folder-creating-thing, can skip the 2nd part. The 2nd thing, I'm not a native English speaking person, so bare the grammar and spelling.

First things First

Download:
-.net 2.0 Framework
-Microsoft Visual C# Express 2005
-TortoiseSVN

Notice:
-I Haven't got this Runuo Server working under Windows Vista (Compiling will work, so you can upload it to your windows xp server).
-I Got it working under Vista, I cant guarantee you can too
-In this guide I'll be using .net 2.0, I couldn't get .net 3.5 Framework to work successfully
-I couldn't get Visual C# Express 2008 to work successfully.

Other stuff to know about:
From now on ShardName = The name of your shard.
A name between brackets like: [blabla], means a folder with the name blabla

Creating the folders and setting up the SVN
These steps are not necessary, but it helps keeping things neat.

Let's start creating a folder called [ShardName] on your desktop. Within this folder Create a folder called [Shard Server]. This is your main folder where all the things will happen. Usually I create another folder, like [Website] with all website related stuff or [Articles] folder with written essays and articles concerning my shard. This way, all files concerning my Shard are in 1 folder.

Within [Shard Server] create 4 folders; [Runuo SVN], [Export], [Output] and [Server].

If you succesfully installed TortoiseSVN, use this helpfull guide:
HowTo: Use Tortoise SVN (Credits to Varchild.)

to install the latest Runuo revision in [Runuo SVN] (Currently @ 269). Then Export it to [Export]. This will ensure you always got the latest revision in [Runuo SVN], which you can update using Turtoise SVN. Alsoo the folder [Export] will not contain the [.svn] folders TurtoiseSVN creates automatically.

So your folder set up should look something like this:
[Shardname]
------[Website]
------[Articles]
------[Shard Server]
------------[Runuo SVN] (With the latest SVN gotten by TurtoiseSVN)
------------[Export] With the exported Runuo version
------------[Output] Here you will save the files you going to copy to your server
------------[Server] Here you will save your Visual Express stuff
------------------[ShardScripts] the scripts for the shard
------------------[ServerCore] Core stuff, discussed next topic

Starting up Visual C# Express 2005

Server Core Files
Start Visual c# Express 2005 and choose File => new project.
Create a new project, select Console Application and call it ServerCore.

It will automatically open Program.cs. To the left you see the code, to the right the folder structure.
Within the folder structure delete program.cs and under the header "properties" the assemblyinfo.cs
Drag from [Export] the folders [Data] and [Server] onto the ServerCore. It starts adding the files to the Project.

Rightclick on ServerCore ==> Properties
Application Tab:
Assembly name: ServerCore
Default Namespace: Server
Startup object: Server.Core
Icon: Server\runuo.ico

Build Tab:
turn "Allow unsafe code" on
Output path: [shard name]-[shard server]-[output]
Save the solution into the [Server] folder. IMPORTANT, SAVE NOW You need to reference some files later on.

Sidenote you can skip the whole section below this if you are just interested in compiling a exe and dont care in creating a Scripts Library.Just add the scripts folder from [Export] onto the ServerCore and add the references mentioned below. Save, Build and then have upload the whole scripts folder, server.exe, data folder and zlib dlls to your server. If you're interested in creating a Scripts Library with all scripts in 1 dll, then continue to read on.

Once its done saving, create a new project by rightclicking into the Solution, add.. new project. This time Click Class Library, call it ShardScripts. You now have 2 projects within 1 solution.

Richtclick ShardsScripts and choose add references:
system.web
system.drawing
system.windows.forms
system.runtime.remoting

Drag from [Export] the [Scripts] onto ShardScripts.

Rightclick on ShardScripts==> Properties
Application Tab:
Assembly name: ShardScripts
Default Namespace: Server

Build Tab:
turn "Allow unsafe code" on
Output path: [shard name]-[shard server]-[output]

You're almost done and now should have something like this (Take notice of the folders on the right):


Within Server in Project Server Core there is a file called ScriptCompiler.cs. Edit it by doubleclicking it, it will open to the left.

Around line 541
Replace:
Code:
			EnsureDirectory( "Scripts/" );
			EnsureDirectory( "Scripts/Output/" );

			if( m_AdditionalReferences.Count > 0 )
				m_AdditionalReferences.Clear();

			List<Assembly> assemblies = new List<Assembly>();

			Assembly assembly;
With:
Code:
            bool HaveCoreScriptsDll = true;//needed for project
			EnsureDirectory( "Scripts/" );
			EnsureDirectory( "Scripts/Output/" );

			if( m_AdditionalReferences.Count > 0 )
				m_AdditionalReferences.Clear();

			List<Assembly> assemblies = new List<Assembly>();

            Assembly assembly = null;//needed for project

            try
            {
                assembly = Assembly.LoadFrom("ShardScripts.dll");
            }
            catch (Exception e)
            {
                Console.WriteLine(String.Format("ShardScripts.DLL: {0}", e.Message));
                Console.WriteLine("Can't load script library, ShardScripts.DLL!  Proceeding without it.");
                HaveCoreScriptsDll = false;
            }

            if (HaveCoreScriptsDll)
            {
                if (!m_AdditionalReferences.Contains(assembly.Location))
                {
                    m_AdditionalReferences.Add(assembly.Location);
                }
                assemblies.Add(assembly);

                Version CSversion = assembly.GetName().Version;
                Console.WriteLine("Using: [{0}] Version {1}.{2}.{3}.{4}", assembly.GetName().Name, CSversion.Major, CSversion.Minor, CSversion.Build, CSversion.Revision);
            }

Save the file and complete solution. Almost there now. Rightclick on Server Core. Choose Build. It will now only build the ServerCore.exe

rightclick on ShardScripts and choose add reference. This time choose browse. Go to the [ServerCore]-[bin]-[Release] and choose the ServerCore.exe. Click OK, now rightclick on the solution, choose project dependencies, select from the dropdown menu: "Shardscripts" and enable the Server Core. (Notice don't turn this around, making Server Core dependent of the Scripts.)

Now open Scripts\Misc\ServerList.cs
Change
Code:
public static readonly string Address = null;
to
Code:
public static readonly string Address = "127.0.0.1";
or whatever your ip adress is. This is important to get it to work in Vista

Again SAVE NOW!!
Ok you're done! You can now build the entire solution (You probably need to build twice in a row, the .exe cant find the dll cause it doesn't exist yet, the 2nd time it does).

Now copy ServerCore.exe, ShardScripts.dll, the [Data] folder (from export) and the zlib32.dll/zlib64.dll to your server, Run ServerCore.exe and presto.

[FAQ]
Q: Why do you choose to follow this complicated way of creating a Class Libriray Who not just copy the scripts folder with the .exe?
A: Well, the answer is quite simple. 2 Reasons, I hate uploading over 3k of files. Its slow and unmanageable ("which files did I change again?"). Its easier to upload a file of a couple of megabytes. The second reason is, the server doesn't have to compile the scripts. The compiling happens beforehand from my own pc, 1 time. And not with every server reboot, crash. This saves lots of irritation. Instead of waiting minutes, its just seconds. The third reason is that its easier to spot the latest version. It happens alot that when making a quick edit (changing the fcr) on the server side, you forgot to copy the latest version to your own project and vica versa. The only con I see, is that you can't make a quick adjustment in the cs, server side.

Q: I get all kinds of Socket Errors
A: You cant run the server on Vista yet. You can compile on Vista but you can't run it.

Q: I get a zlib error
A: You need Zlib32 (or zlib64.dll) in your ServerCore.exe folder.

Q: It cant find the scripts when I run the server
A: You did something wrong, either your made a mistake with the scriptcompiler.cs or you got the dependencies wrong.

Q: Within Visual Express I get mass error (over 25k errors)
A: You missed a reference, alsoo make sure the default namespace = Server.

Q: The Server runs but when I login the server crashes
A: Check if you have zlib32.dll in your folder.

Q: The server runs but I cant open my paperdoll and lots of gumps dont work
A: Make sure you have the data folder in your folder where the server resides.

Q: When I login, I get a client error and it keeps verifying. Server says: "Encrypted client detected"
A: Don't go beyond client version 6.1.1.0 Mondains Legcay (If you download ML from the official website, DON'T patch, its already @ 6.1.1.0. Just download the setup and install, nothing more!) Beyond it, will result in errors and you can't login.

[Attachments]
I've added my own Scriptcompiler if people have a problem compiling with there copy.
Added zlib32 and zlib64.dll
Shard Release.rar contains ServerCore.exe and Shardscripts.dll
RunuoRev269_Compiled_by_Jareish.rar contains the projectfolder with visual express project and output folder.

For those interested in the complete projectfolder containing:
-Export - exported svn
-Output - with the ouputfiles from visual express
-Server - with all the projectfiles
-SVN - the latest svn (if you have tortoise svn installed you only need to update
-Shard Release - A folder with data, zlib, the latest build files you can just drag and drop to your server to create a empty clean server.

you can download it at: CLICK
password = "http://www.uo-nextchapter.com"

Edits:

Changed Server Core to ServerCore. Visual express has some problems with spaces.
Updated Scriptcompiler.cs with the latest one from rev 269
Removed some grammar errors, explained some stuff in more detail, updated the FAQ.
The 2nd post contains rev 279 which i got working under vista.

If you have any question concerning this guide, don't hesitate to PM me. I'm not always online, but Ill try and answer your question and maybe add it to the FAQ. I hope this Guide will answer all the questions concerning setting up a running clean shard from scratch.
 

Attachments

  • zlib.rar
    62.8 KB · Views: 76
  • ScriptCompiler.cs
    20.9 KB · Views: 30
  • Shard Release.rar
    1.6 MB · Views: 43
  • RunuoRev269_Compiled_by_Jareish.part1.rar
    4.5 MB · Views: 41
  • RunuoRev269_Compiled_by_Jareish.part2.rar
    2.3 MB · Views: 33

Jareish

Wanderer
And because Christmas has passed, New year is coming, here is the Latest Revision 279, working with Vista!

You need to download both rar files to get it to work (forum has a limit for uploading, 5mb max).

It contains:
-Output folder (a clean runuo executeable, drag and drop the folder to your server to have a clean server)
-ServerCore (Open servercore.sln for the m$ visual express project, completely preset and done)

I adjusted 2 things
Server/Scriptcompiler.cs added the script like above
Scripts/Misc/ServerList.cs changed null ip adress to 127.0.0.1 (default network adress)

To my suprise It runs on Vista. Maybe the ip did the trick, or a visual express update i did recently or maybe the svn fixed it. Anyhow, enjoy this!

Screenshot

btw the warnings in the screenshot are because i didnt copy the data folder to the server.exe folder
 

Attachments

  • rev279.part1.rar
    4.5 MB · Views: 49
  • rev279.part2.rar
    1.3 MB · Views: 34
Top