Author Topic: Building a modified server executable  (Read 2252 times)

bac9

  • Full Member
  • ***
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 113
    • View Profile
Building a modified server executable
« on: June 18, 2014, 06:21:50 AM »
Sorry if that was brought up before, but there a page in the documentation or a tutorial available somewhere covering how can you modify the standalone server code and build it? I'm not terribly familiar with this aspect of VS, - I only ever used it to work on the code and never touched the build options and project management options. I imagine there are dozens of tutorials on the subject if I would know what to search for. In particular, I'm wondering about two things:

1. How to get TNetServer project working? I understand that TNet ships with the source code of the server and I see Assets/TNet/TNetServer/TNetTest/ServerMain.cs plus .csproj/.sln in the server archive, but I'm not sure if I'm opening them correctly. I'm not seeing how ServerMain.cs is supposed to work with "using TNet;" when it's classes aren't there in the TNetTest folder. Am I supposed to somehow modify the project settings or move TNet classes from Assets/TNet to Assets/TNet/TNetServer/TNetTest folder?

2. How to build TNetServer project properly? It's probably something straightforward like hitting a hotkey and choosing the name/location of an executable, but there are plenty of branching menus in VS and I'm not yet sure where to look for the build option.

Reason I'm touching the subject in the first place is that I need to implement a simple authentication system. I already have it up and running on a client, and it's possible to leave this way by using very dirty tricks like distributing username/password DB to every single client without ever touching server logic, but it would be nicer to have it in one place. Hence the questions above.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Building a modified server executable
« Reply #1 on: June 18, 2014, 08:29:10 PM »
1. You need to unzip them outside the Assets folder. The project files go beside Assets and ProjectSettings -- same place as your "Assembly-CSharp.csproj" and other project files.

2. Just open the TNServer.sln and hit the Build button. Make sure to do #1 first.

bac9

  • Full Member
  • ***
  • Thank You
  • -Given: 2
  • -Receive: 4
  • Posts: 113
    • View Profile
Re: Building a modified server executable
« Reply #2 on: June 20, 2014, 01:38:53 AM »
Thanks, that works!

One more question: how to add namespaces and individual classes properly? I know about the Add Reference option in the VS solution explorer context menu (but that one only accepts .dll, .exe, .manifest, etc. files) and I know that you can drag individual .cs files into the solution explorer, but I'm not sure the latter is a proper way of doing it, because I'm noticing that changes to a class from that .cs file done through a Unity-generated solution are not replicated when open that class in the server solution (suggesting that drag-and-dropping .cs files into a server solution probably creates duplicate file somewhere and not a reference). Am I missing some obvious third way of adding classes to a solution?

Let's say I want to add SimpleJSON namespace (containing just one small .cs file) into the server project in the very same way you added TNet namespace into it. How do I go about it?

Update: A-ha, looks like I was moving stuff into the solution explorer incorrectly. Instead of using root folder and dragging individual .cs file I wanted, I should have dragged whole Plugins folder into Assets folder already present in the server solution explorer, and then use "Exclude from project" context option to drop every single file but SimpleJSON.cs.
« Last Edit: June 20, 2014, 05:19:55 AM by bac9 »