User talk:Seka/installation

From Avlis Wiki
Revision as of 06:40, 19 August 2017 by Seka (talk | contribs) (Created page with "==Squatting Monk's Testing Ground== ===Two-Column Article Layout=== <div style="min-width: 1000px;"> <div style="width: 300px; float: right; margin: 0 0 15px 30px; border: sol...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Squatting Monk's Testing Ground

Two-Column Article Layout

Sidebar content goes over here. Don't use headings in the sidebar; if you do, the wiki will start acting funky. Instead, mark your headings with bold text:

Resizing the Sidebar

By default, the sidebar is 300px in width. To change this, you need to change both the width property of the sidebar div and the margin-right property of the main column's div. The main column's right margin should always be 50px larger than the sidebar in order to give adequate room for the sidebar's padding and border.

This is an example of a two-column layout. You can use it in an article to show a sidebar with extra information. The sidebar is a fixed width (default: 300px), so it will always be the same size even on smaller screens or when the window is resized. The content in the main column, however, is fluid: its text will wrap based on the size of the reader's screen or window. Both the left and right columns are wrapped by a div element. The wrapper has a minumum width (default: 1000px) in order to ensure there's enough room for the content in the main column. This means the minimum amount of room in the main content area is 650px (1000px - 350px margin = 650px). If your content has images with a greater width than this, you may want to modify it. However, doing so may mean readers using small screens have to scroll to the right to read the sidebar. It is therefore recommended that you keep your main content to < 650px in width.

It is okay to have headings in the main column, just not in the sidebar column:

Standard Two-Column Code

<div style="min-width: 1000px;">
    <div style="width: 300px; float: right; margin: 0 0 15px 30px; border: solid 1px #cccccc; padding: 0 15px;">
        Sidebar content goes here.
    </div>
    <div style="margin-right: 350px;">
        Main content goes here.
        <div style="clear: both;"></div>
    </div>
</div>

Note the final bit of code: <div style="clear: both;"></div> This stops the sidebar from overflowing into the next section if it is longer than the main content area. Only move or remove it if you want following content to start flowing around the right column. As is, text will not wrap around the right column at all (as you can see here). If you do want text wrapping, see the next section.

Wrapping Two-Column Code

Another Sidebar

This is just another sidebar with a little bit of text. Lorem ipsum dolor sit amet.

A variation on this code will let you wrap content in the main column around the sidebar. This can make the article look nicer if the content on the left is much longer than the sidebar on the right.

<div style="min-width: 1000px;">
    <div style="width: 300px; float: right; margin: 0 0 15px 30px; border: solid 1px #cccccc; padding: 0 15px;">
        Sidebar content goes here.
    </div>
    Main content goes here.
    <div style="clear: both;"></div>
</div>

In this variation, there is no <div> element surrounding the main content area. The minimum width concept still applies, but the lack of the additional div means the text will be able to wrap around easily. Note that code blocks may overflow into the sidebar using this method (as seen above). To fix this, add the following style attribute to any <nwscript> or <pre> elements that may overflow into the sidebar: style="margin-right: 350px;", replacing 350 with the width of your sidebar + 50px. Thus, a fixed <nwscript> element would look like this:

<nwscript style="margin-right: 350px;">
void main()
{
    // Do something here...
}
</nwscript>

And its output would be... <nwscript style="margin-right: 350px;"> void main() {

   // Do something here...

} </nwscript>

NWScript Code Formatting

Standard Code Formatting NWScript Syntax Highlighting
// cutscene_1_1
/* multi
  line
  comment! */

#include "nw_i0_plot"

const int MY_CONST = 0x01;

void main()
{
    object oGuard  = OBJECT_SELF;
    object oPC     = GetLastPerceived();
    object oLeader = GetObjectByTag("leader");
    object oDoor   = GetObjectByTag("guard_door");

    if (GetIsPC(oPC))
    {
        SetCommandable(FALSE, oPC);
        DelayCommand(10.0,    SetCommandable(TRUE, oPC));
        AssignCommand(oPC,    SpeakString("Lead the way!"));
        AssignCommand(oPC,    ActionForceFollowObject(oGuard));
        AssignCommand(oGuard, ActionOpenDoor(oDoor));
        AssignCommand(oGuard, ActionForceMoveToObject(oLeader, FALSE));
        AssignCommand(oPC,    ClearAllActions());
    }
}

<nwscript> // cutscene_1_1 /* multi

  line
  comment! */

  1. include "nw_i0_plot"

const int MY_CONST = 0x01;

void main() {

   object oGuard  = OBJECT_SELF;
   object oPC     = GetLastPerceived();
   object oLeader = GetObjectByTag("leader");
   object oDoor   = GetObjectByTag("guard_door");

   if (GetIsPC(oPC))
   {
       SetCommandable(FALSE, oPC);
       DelayCommand(10.0,    SetCommandable(TRUE, oPC));
       AssignCommand(oPC,    SpeakString("Lead the way!"));
       AssignCommand(oPC,    ActionForceFollowObject(oGuard));
       AssignCommand(oGuard, ActionOpenDoor(oDoor));
       AssignCommand(oGuard, ActionForceMoveToObject(oLeader, FALSE));
       AssignCommand(oPC,    ClearAllActions());
   }

} </nwscript>

Sortable Tables

Fruit Price
Apples £0.95
Oranges £0.85
Pears £1.15

Citations

This is a citation. <ref>Whatsit</ref>

NWN Dedicated Server Installation Guide

This will be a tutorial on installing a 1.69 Dedicated Server on Ubuntu 12.04. Yay!

This step-by-step guide to installing the Linux dedicated server is based on Arek75's installation guide as found on the NWN Wiki.

Assumptions

  1. You have a Linux box with a dedicated internet connection. I use Ubuntu 12.04 Server Edition. If you use a different distro, then I assume...
  2. You know how to use basic console commands, use the package manager, etc.
  3. You have physical access to the machine or can remotely access it over SSH (preferred).
  4. You have root access.

Formatting note: when commands appear on two separate lines, they are two separate commands. Enter them individually.

Preparation

Before we install NWN, we want to create an unprivileged user ("nwn") to run the server.

sudo adduser --system --group --shell /bin/bash nwn

We'll add ourselves to nwn's group, ensuring that we can add, remove, and modify all files in our NWN installation. Repeat this step for each user you wish to have access to NWN, replacing "squattingmonk" for the username.

sudo gpasswd -a squattingmonk nwn

Next, we need to ensure we have access to the program needed to unzip the dedicated server archive. Ensure your install is up-to-date, then install unzip.

sudo apt-get update && sudo apt-get upgrade
sudo apt-get install unzip

Next, we make a folder in which to install NWN.

sudo mkdir /opt/nwn

Set the folder's owner to our new nwn user. Set the permissions so as to allow nwn and everyone in its group to read, write, and execute files.

sudo chown nwn:nwn /opt/nwn
sudo chmod ug+rwx /opt/nwn

Now we need to set the Group ID bit on the install directory in order to make sure any new directories or files we create are associated with the nwn group.

sudo chmod g+s /opt/nwn

Next, we need to switch to our nwn user. Note that we never set a password for nwn. Instead, we switch users using sudo:

sudo -i -u nwn

Whenever we log in as nwn, we want to set our umask to 002. This ensures that any files we create will be readable, writable, and executable by anyone in our group.

umask 002

Installation

If you were already logged in as nwn, ensure you are in nwn's home directory:

cd

Otherwise, log in now:

sudo -i -u nwn
umask 002

Download the NWN Dedicated Server 1.69 archive from the BioWare website:

wget http://files.bioware.com/neverwinternights/updates/windows/server/NWNDedicatedServer1.69.zip

Change to your NWN install directory:

cd /opt/nwn

Unzip the Dedicated Server archive into this directory:

unzip ~/NWNDedicatedServer1.69.zip

Remove all the files specific to other operating systems:

rm macdedserver169.zip nwserver.exe nwupdate.exe Patchw32.dll readme.macserver.txt

Next, unpack the Linux dedicated server, overwriting everything:

tar xzvf linuxdedserver169.tar.gz

Now we need to ensure that all files in the NWN install have the correct permissions.

chmod -R ug+w *

Now, set the execute permission on fixinstall and run it.

chmod ug+x fixinstall
./fixinstall

You should see the following output

Checking for required files

PASSED: data directory exists
PASSED: nwm directory exists
PASSED: chitin.key exists
PASSED: dialog.tlk exists
PASSED: nwserver exists

Fixing case

data
................................
dmvault
.
hak
.
localvault
.
override
..........
portraits
.

Checking for problem files


Checking for permissions

PASSED: nwn.ini is writable
PASSED: nwnplayer.ini is writable
PASSED: saves is writable
PASSED: localvault is writable
PASSED: dmvault is writable
PASSED: /opt/nwn is writable

You are ready to run Neverwinter Nights.

Now we need to create a script to start the nwserver process:

nano start

In nano, enter the following:

#!/bin/bash
umask 002
cd /opt/nwn
./nwserver $@

Save by pressing CTRL+O and pressing ENTER. Exit by pressing CTRL+X.

Make the startup script executable:

chmod ug+x start

Next we need to set the SUID (Set User ID) and SGID (Set Group ID) bits on nwserver. This will make sure nwserver always runs as nwn, rather than the user that started it (which would probably be root if it's run at system startup).

chmod ug+s nwserver

Switch back to your regular user:

exit

Hosting Your First Game

Now it's time to host a test module to ensure everything works correctly.

Ensure you're not logged in as nwn. This is important because we need to make sure the server process will run as nwn even when executed as another user. Next, execute the startup script we made earlier:

/opt/nwn/start

If all goes well, you should see the following messages:

Neverwinter Nights Server
Build:8109
Copyright BioWare Corp 1998-2004

Server: Loading...
Server: Running...

Now we need to load our test module. We'll use Chapter 1 of the OC:

module Chapter1

You shold see the following output:

Neverwinter Nights Server
Build:8109
Copyright BioWare Corp 1998-2004

Server: Loading...
Server: Running...

module Chapter1
Server: Loading module "Chapter1"...................................................................................................................
Server: Module loaded

Now, run NWN on your gaming machine and connect to the server. There are two possibilities here:

  1. Your server is connected to the same local network as your gaming machine. In this case, just use "Join LAN game" and select your server from the list (it should be the only one there).
  2. Your server is hosted somewhere else, in which case you need to Direct Connect to it using its IP address.

If you can't connect, make sure that your host has his firewall/router settings set correctly and is forwarding all the correct ports. If you got this far and you're on the same local network as your server, you should have no problems connecting - check your Windows firewall settings, and check the firewall settings on the server box if you've messed with them.

Congratulations! You're hosting your first game. You can play for a few minutes if you want, but I'd recommend shutting down the server and taking a break for a while. To do so, first exit NWN on your gaming machine, then shut down the server by typing the following command at the console:

exit

That'll get you back to the command prompt. Now just check one little thing before going on:

ls -lR /opt/nwn | grep -v nwn\ nwn

If this returns anything besides blank lines, directory names, and totals, check that you set the suid/sgid bits on nwserver correctly and that nwserver belongs to the nwn user/group. Please re-read all the instructions for installing NWN and NWServer and make sure you followed them correctly.

Note: If you're hosted and couldn't get a special nwn user (and probably had to install to somewhere in your home directory), the above command is meaningless. If this is the case and you were able to get NWServer to run and were able to log in, everything's OK.

Automatically Starting NWServer On System Boot

Eh, it's coming.

NWNX Tutorial

This will be my attempt at a complete NWNX installation tutorial for Linux (using Ubuntu 14.04). I'm putting it on my user page until it's ready to see the daylight.

This guide assumes you know the basics of the Linux command line interface. It assumes you're using Ubuntu 14.04 (Trusty Tahr) 32-bit. Your mileage may vary if you use other distros. It also assumes you've already installed NWN and have located your install at /opt/nwn.

We'll need a few packages in order to build NWNX:

sudo apt-get install build-essential cmake gperf zlib1g-dev libmysqlclient18 libmysqlclient-dev

Now we need to install Git so we can download the necessary files:

sudo apt-get install git-core

Template:Messagebox Download the NWNX files to your home directory:

git clone https://github.com/NWNX/nwnx2-linux.git

You should now have a folder in your home directory called nwnx2-linux. Navigate to it:

cd nwnx2-linux

Now compile!

./compile.sh

You may need to install additional libraries for some of the plugins. Check the output of compile.sh and make sure that you have the necessary packages for any of the plugins you need. The library listed may not actually be the package name as it's shipped under Ubuntu, so use some Google-fu if you need.

The installation will take about five minutes, during which you should see lots of compiler messages going by on the screen. When compilation finishes, you should see the following message:

NWNX has been compiled successfully. 

- Look in the 'compiled' directory for the libraries. 
- Copy those that you want to use into your NWN server directory. 

IMPORTANT: 
- In the case of multiple so files and/or dynamic and static 
  variants (for example, the odmbc plugin), choose only one. 
  If you're running wserver the same host that you are compiling on, 
  the dynamic one is recommended. 
  static binaries include the database connector linked in. 

- Read & change nwnx2.ini carefully. 
- Edit nwnstartup.sh to match your desired server settings. 

Have fun!

Hooray! Now we need to copy our compiled plugins to our NWN install directory:

cp compiled/* /opt/nwn

Now we need to limit ourselves to one of the MySQL plugins. Navigate to the NWN install directory, rename your desired ODBC plugin to nwnx_odbc.so and remove the other one.

cd /opt/nwn 
mv nwnx_odmbc_mysql.so nwnx_odbc.so 
rm nwnx_odmbc_*.so

Now edit your nwnx2.ini file to use the correct login information for your database:

nano nwnx2.ini

Note: semicolons are comment characters: make sure to use these to comment out all information about database types you don't wish to use:

[ODBC2]
; for sqlite3
;source=SQLITE
;file=./test.sqlite3

; for mysql
source=MYSQL
server=localhost
user=myuser
pass=mypassword
db=mydatabase

; for postgre
;source=PGSQL
;server=localhost
;user=username
;pass=password
;db=database

; Set hookscorco to false if you want to disable hooking of
; StoreCampaignObject and RetrieveCampaignObject entirely
hookscorco=true

Now edit your startup script to pass the settings you wish nwserver to use, making sure that any multi-word server or module names are encapsulated in double quotes ("):

nano nwnstartup.sh

Template:Messagebox When you're done, run the startup script:

./nwnstartup.sh

You should see output similar to the following. Check to make sure all plugins initialize correctly:

NWNX2lib: Init
NWNX2lib: org SetString() at 81f41b4, new SetString() at b77a436d
NWNX2lib: org GetObj() at 81f40bc, new GetObj() at b77a4394
* Parsing configuration...
NWN Extender v2.8-dev
(c) 2004 by the APS/NWNX Linux Conversion Group
(c) 2007-2010 by virusman and Acaos
Based on the Win32 version (c) 2003 by Ingmar Stieger (Papillon)
and Jeroen Broekhuizen
visit us at http://www.avlis.org

* Searching for signatures...
* Loading modules...
SPELLS plugin registered.
STRUCTS plugin registered.
DEFENSES plugin registered.
RESET plugin registered.
PROFILER plugin registered.
DMACTIONS plugin registered.
TWEAKS plugin registered.
FUNCS plugin registered.
RESMAN plugin registered.
VISIBILITY plugin registered.
WEAPONS plugin registered.
FUNCSEXT plugin registered.
TMI plugin registered.
FIXES plugin registered.
SYSTEM plugin registered.
ODBC plugin registered.
CHAT plugin registered.
EVENTS plugin registered.
MNX plugin registered.
EXTEND plugin registered.
AREAS plugin registered.
HASHSET plugin registered.
FUNCTIONS plugin registered.
NAMES plugin registered.
* NWNX2 activated.
Neverwinter Nights Server
Build:8109
Copyright BioWare Corp 1998-2004

Server: Loading...
Server: Running...

Server: Loading module "My Module".....
Server: Module loaded
NWNX!INIT enforcement disabled, using 0x082041ec
INIT(S): reset ignored ret=0x082041ec
INIT(O): valid ret=0x08203e79

That's all there is to it, folks!

<references />