userMM / openhelbreath

Automatically exported from code.google.com/p/openhelbreath
0 stars 0 forks source link

GameServer - IDE, coding, ideas, etc. #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hello, long time no see. I had no time to contribute. Today I was playing
with C++ IDEs and some ideas came. So here it is so far:

1. The IDE I will use will be most propably Eclipse. It is cross platform,
but I think some one could commit Visual Studio workspace file. But Eclipse
is crossplatform and everything will work on windows. (I am using Linux)
2. For Linux there will be nice things like ncurses gui. For Windows there
is no ncurses so windows exe will be just ugly console window.
3. TCP server will be multi-threaded. This means only 1024 (I dont know if
windows and linux have same limits) clients per server. Why this? When any
client makes access violation or any error will ocur, the client is
disconnected and main server and other threads will go on.

4. Network code in Game Server will be 99% struct based. Writing and
reading data from Login Server should be slighty faster and easier to read
and make changes. I mean:

struct {
char cKey;
word wSize;
int iMsgID;
word wMsgType;
} packet_HEADER;
5. This means architecture of game server will change. Most of player
function will be called from child threads, and server functions such as
map data, storing items etc will be called from main thread. 
6. Every map grid will have FIFO list and pointer to Owner. This could help
to make some real item disappearing or increasing depth of items. Also set
of visible players/object will be found faster. No need to:
if wObjectID > 10000 then Object is NPC else Object is Player.
7. NPC AI most propably will be increased a bit. A* algorithm to find a way
will be implemented. No more NPCs that could not find a way to get through
buildings and walls.
8. Reimplemented config reader. Every piece of config (except main config
with port and maps) will be readed from login server.
9. Instead of arrays with given DEF_MAX etc. why not use dynamic arrays
with instances of class?

Some of the points are long term TODO. Feel free to discuss. At this moment
I am working on a basic project setup with some compilation directives to
easy compile on Windows/Linux.

BTW. I think new game server which will be compatible with 3.82 should be
around 25-30k lines of code. If not less. HBx is about now60k. So the rest
30k lines of code are crappy korean comments, shitty WinApi code and full
of idiotic korean ideas from 1997 (97 is in header in some old 2.2 src am I
right?)

If we get more ppl on this project, we could divide to two small teams, one
for Game Server and one for Client source. Please, if you guys could
involve someone feel free to do it. I will give access to everyone who
could make some serious help :)

Please discuss.

Original issue reported on code.google.com by Drajwer@gmail.com on 22 Nov 2009 at 8:27

GoogleCodeExporter commented 9 years ago
As promised. I am working on the code base. I hope in next days the code will be
available on our svn :) At this moment I am working on config loading and I am 
trying
to compile old classes. Everything compiles fine on Linux, altought I didn't 
had time
to make tests under Windows. There shouldn't be any problems I think.

Look at the screen. BTW Every developer here should use a good profiler. I am 
using
Valgrind. And you can see no mem leak found :) So sad it is available only on
Linux/MacOS but Im sure there is Windows substitute for it. It will be nice if
everyone make sure no memory leaks were made since last change just before 
commiting.

About architecture. I decided to go with something like this:

main -> CApplication -> CGameServer

1. main initialises CApplication
2. CApplication gets command line parameters etc, and tests host for any error 
then
spawns CGameServer instance.
3. CGameServer does rest.

I belive this could help us with better error handling. If CGameServer throws an
exception then CApplication could handle it and server will not be turned off.

I am doing some simple GUI framework and I plan to run it on separate thread 
spawned
from CApplication. The base GUI framework will deliver some functions like 
PutLog()
etc. So sky is the limit. At this moment it only supports printf :) On Windows 
it
will be *insert_your_favorite_gui*, and under Linux it will be ncurses. I am not
planning any GUI for Linux version.
As ncurses does not like me you can't see it in the attached screen. :(

I have some notes about GameServer<->Client connection, and security but I will
describe more specification later.

How about some kind of XML-RCP ? Remote admin etc. I know many online servers 
doing
this. 

Sleepy, gotta write todo list and more informations and IDE setup later. Bye :)

Original comment by Drajwer@gmail.com on 24 Nov 2009 at 10:13

Attachments: