I haven't downloaded Vetyst's new Dev rev 5 server yet but I'm hearing a lot of good things about it.
Some new ways to handle MySQL and threads that means we no longer need to use --lpthreads library and so on.
It is, however not much more than a shell right now. I look forward to seeing how he fills in all the details. Should be a fun project.
Now back to the subject on hand. Server/client hierarchy for beginners.
Ok so you surmised correctly that the client is the part of the setup that renders all the stuff into a visual format while the server is the part that handles interactions between players and monsters and does all the nitty gritty stuff involved with data handling of all types.
So basically we have two completely different parts here. The server is the central program that runs everything for all the players. it handles login, database access for loading saved character data, movement, combat and lots more for ALL players simultaneously.
It also sets up "sockets" which are portals to the internet. Other internet entities can lock onto these sockets if they have the right port number and IP address
The client can be physically located anywhere on the internet. Each player needs their own copy of it in order to play. To successfully play, a client needs to log into the server (servers actually but we will get to that later) using the port and IP address of the server.
There are actually 3 connections involved in all this.
Login Server port 29000. This is the first one that the client encounters while logging in. It establishes a temporary socket connection. It verifies account details then sends a message to the CharServer containing the client's details.
The CharServer then contacts the client via port 29100 and sends a string of data containing it's own contact information which the client echoes back to establish a permanent connection (socket). The connection to the login server is severed at this point.
The CharServer loads in a lot of information (from MySQL) related to your account then assigns an account ID internally. It allows the client to select one of the characters within that account. After selection it passes the character data on to the WorldServer.
The WorldServer then assigns an ID to the character and sends a packet of information to the client on port 29200 and the client echoes it back to establish a permanent connection (socket)
Both CharServer and WorldServer sockets remain open after this. Information can be passed along these connections in both directions
All three servers are typically located on the same machine but they actually don't have to be.
The client is typically on a different machine entirely but it is possible to run it on the same machine as the servers by using the Localhost IP (127.0.0.1) in the batch file that launches the client.
If you run the client and server on different machines then you would use the LAN IP of your server PC in the batch file launcher. An example would be 192.167.0.100
The batch launcher itself is very easy to make. Just open notepad and type or paste in the following text
Code:
TRose.exe @TriGGer_SOFT@ _server 127.0.0.1
then save it as something like "KTRose launcher.bat"
Just change the IP to the LAN IP of your server PC and you should be able to join from any PC on your LAN
The important bit is that it must end in .bat That makes it into an executable shell command that you just double click to start the game
MYSQL would be emulating a server like TitanRose and it loads the data... and some how communicates with the client.
Navicat I'm guessing works like some sort of link between the client and the server. Or builds the link.
Yup, still haven't gotten my head wrapped around it all the way.
You have this a bit confused.
MySQL is a database. It's basically a completely static storage device.It doesn't emulate anything.
It does, however, require an active manager to look after reading and writing to it and that is what Navicat does.
The server will use a line of code such as this
Code:
MYSQL_RES *result = DB->QStore("SELECT type,map,dir,x,y,dialogid FROM list_npcs");
DB->QStore is a command that is sent to the database manager which then returns a 'dataset' containing the requested information, in this case a list of NPCs, their locations, facing direction and dialog IDs
Personally I don't like to use Navicat.
I use PHPMyAdmin which comes free with Xampp. For me it works a lot better. You just run Xampp to handle all your socket connections and stuff then use a browser (firefox, IE or whatever) to access it. Just type in localhost\phpmyadmin in the browser bar to open it.
Xampp already includes a database manager so Navicat is entirely unnecessary
Database access is only required for the Server. The client does not use it. It get's all its information in data packets from the server.
So in short this is what you do.
1. Choose a server PC. Run all 3 servers on it using the conf file setting that match your LAN subnet mask and stuff.
2. Install copies of the client onto each PC that you intend to play the game from.
3. Make batch launcher files as described above and save them into the client root folder (the folder that contains the file Trose.exe) of each client. If you run one client on the server PC then use 127.0.0.1 as the IP for that one.