1 Attachment(s)
Server and C++ client skeleton code -- BETA
Hi all.
I wrote the code for a single threaded server and a C++ client. The code is very crude and needs to be refined a lot. I think that we probably will have to re-design large portions.
Both the server and the C++ client are MFC, because I use CSocket for the TCP/IP communication. The server does not implement any logic for computing the turn state and the client has no AI at all (it will have all creatures rest every turn). Yet they exchange all messages that they would in a real game. Have a look to the codewar.h file -- it's probably the most relevant.
I wanted to release the code ASAP, so I didn't take the time to polish it up. Many calls are not guarded and because the clients messages trigger the servers actions (without a timeout), the server will hang if the client fails.
Comments, ideas on how to improve both the design or the implementations are welcome :).
Enjoy,
1 Attachment(s)
And here comes the client...
And here's the client as promised a long time ago also :p
Just copy it into the same directory as the server, coz it shares the 'CodeWarCommon' directory.
have phun
Kurt
Re: And here comes the client...
Hey Guys,
No one has posted anything since Nov. 2003 here, is nobody working on it now ?
I am sorry if I am asking this in wrong place. :)
thanks,
K
Re: Server and C++ client skeleton code -- BETA
Correctomundo. I'm the last one who posted, and then nobody ever replied.
Are you interested?
K.
Re: Server and C++ client skeleton code -- BETA
I would love to, but I don't think I am right guy for this type of project, I am not into game programming at all.
Re: Server and C++ client skeleton code -- BETA
Quote:
Originally Posted by Krishnaa
I am not into game programming at all.
Me neither :)
But it's interesting to learn.
Re: Server and C++ client skeleton code -- BETA
It sure is :thumb:
I have been watching this project since long time, and I was thinking of joining but when I started seeing problems reagrding managing time for this project. I think same will happen with me, so decided not to commit anything.
Re: Server and C++ client skeleton code -- BETA
This seemed like a really cool project. Where does it stand currently?
Re: Server and C++ client skeleton code -- BETA
Quote:
Originally Posted by Nexeh
This seemed like a really cool project. Where does it stand currently?
You are right about this: the project is cool indeed.
I have made a client and a server application implementing the basics (based on Gabriel's code). And that's about it. Nothing more has been done since then...
Re: Server and C++ client skeleton code -- BETA
And what do this server and client do ?
Re: Server and C++ client skeleton code -- BETA
Quote:
Originally Posted by Krishnaa
And what do this server and client do ?
As far as I remember correctly the client and the server exchange positions (of clients of corz) and some basic actions.
So you can connect with two clients to the same server and walk around. I think I even implemented eating and fighting as basic actions. Eating could be done when you (as a client) were walking into a square with food properties. And fighting could be done when another "robot" was nearby.
I had (lucky me) some time left afterwards and I have played around with Direct3D. On the server application I have added a 3D view of the "arena" and you could see the clients walking around.
Re: Server and C++ client skeleton code -- BETA
Okay, I tried connecting 2 clients to server, I dont see them walking, where are they summoned after connecting ?
Re: Server and C++ client skeleton code -- BETA
Quote:
Originally Posted by Krishnaa
Okay, I tried connecting 2 clients to server, I dont see them walking, where are they summoned after connecting ?
I thought I saw some compiling errors... :ehh:
I guess that was fixed easily and you have edited your post :thumb:
Anyway, the "see" part was done after I had posted the client and server. I had some time left afterwards and I added the Direct3D view. This "add-on" was never posted though (as far as I remember; and I can't check it right now). You can only see the clients connecting if you are debugging the server.
The posted client and server are a working framework with just basic functionality. For this point on, you can add more functionality. The biggest and most attractive part is always the graphical part. And this is non-existing at the moment...
Re: Server and C++ client skeleton code -- BETA
I see some part of yellow grid in the right top on server, if I move mouse it moves and disapears.
Re: Server and C++ client skeleton code -- BETA
Quote:
Originally Posted by Krishnaa
I see some part of yellow grid in the right top on server, if I move mouse it moves and disapears.
Serously? Then the 3D part was added. Forgive my brain, it's getting old :o
I wasn't able to get the start position of the camera right. So you will have to move around in 3D using the mouse until you get to see the "arena".
Try something like click-and-hold the left or the right mouse button and move left/right/forward/backward. This will change your position in 3D. You should be able to move in any direction in 3D.
Re: Server and C++ client skeleton code -- BETA
Quote:
Originally Posted by Krishnaa
I see some part of yellow grid in the right top on server, ...
If I look at the downloaded server app, I can trace back what the colours mean:
Code:
switch( square->getType() )
{
case Square::Empty: box->setColor( 1.0f, 1.0f, 0.0f ); break; // Yellow
case Square::Border: box->setColor( 1.0f, 1.0f, 1.0f ); break; // White
case Square::Food: box->setColor( 0.0f, 1.0f, 0.0f ); break; // Green
case Square::Life: box->setColor( 0.0f, 0.0f, 1.0f ); break; // Blue
}
Re: Server and C++ client skeleton code -- BETA
Thats ok, but why the grid is not laid in middle of the screen ? Is it by design that it apears in the top right ?
Re: Server and C++ client skeleton code -- BETA
Quote:
Originally Posted by Krishnaa
Thats ok, but why the grid is not laid in middle of the screen ? Is it by design that it apears in the top right ?
The camera position needs to be adjusted but I never took the time to correct it.
If you would happen to know what needs to be changed, please let me know.
Re: Server and C++ client skeleton code -- BETA
Hello all. In the original post I read that the server and C++ client was done with MFC. What is or are the alternative approach or approaches in C++ besides MFC? Just curious.