DarkPlaces client server relationship

Discuss programming topics for the various GPL'd game engine sources.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

DarkPlaces client server relationship

Post by toneddu2000 »

Hi guys, in these days I was thinking if it's possible to join client-server part in only one for a totally single player game in DP (no multiplayer whatsoever). I searched for an explanation of the client/server relationship on quake engine and I found this, but I noticed that the functions names don't match with DP ones. I started looking deeply at the code and I tried to make my own conclusions and share them with you to see if I'm right or wrong:
the main files SHOULD be sv_main.c (for server) and cl_main (for client).
Client has CL_Init() which fires up CL_Parse_Init() but this function actually doesn't pase anything.

The two important functions I found that seems to start parsing a line containing map information,client socket information(I don't know what is it - I presume is related to the net location), crypto passed phrase, etc. are
NetConn_ClientFrame() and NetConn_ServerFrame() which lead respectively to
NetConn_ClientParsePacket() and NetConn_ServerParsePacket().

both NetConn_ClientFrame() and NetConn_ServerFrame() are called by Host_Main() which I can't desume is it related to client or server (I presume server)

Is it possible to melt client and server together? Where should I start? I don't want you guys make the work for me, I just like to know how is the client/server relationship from whom knows Quake/DarkPlaces better than me

Thanks in advance
Meadow Fun!! - my first commercial game, made with FTEQW game engine
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: DarkPlaces client server relationship

Post by frag.machine »

In theory, yes. The server and client limits are defined by the boundaries in the network subsystem. I remember that some first generation engines like Telejano even checked for single player mode to bypass the network support for things like sound playback. It may turn some things easier, like complete control over the UI from the QuakeC side without CSQC support, but besides this I personally dont see the point.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: DarkPlaces client server relationship

Post by toneddu2000 »

but besides this I personally dont see the point
Thanks frag.machine, you're right, I forgot to mention the most important thing. I'm learning DarkPlaces engine from the basis. I'm just wiping out all the features non-necessary for the pure functioning. I would like to have a client only DP version to better understand the architecture. The simpler, the better for me now. I don't want to make games with DP at this moment, it's just an academic interest.
Meadow Fun!! - my first commercial game, made with FTEQW game engine
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: DarkPlaces client server relationship

Post by Spike »

merging the client and server parts of the engine will remove any possibility to play/record demos.

if you can fix sv_phys.c to also work in csqc, and fix its csqc to actually be able to parse maps entities, then you can just gut all of the server+networking parts and go pure csqc.

the 'host' is the underlying commonality between client and server. its the part that handles 'shared' console commands and framerate timings. In QuakeWorld, the 'host' ended up firmly as part of the client, with all the server parts of the host rewritten pretty much from scratch. This helped reduce the negative effects of fixed-rate server frames.

why you'd want to cripple it like that I have no idea.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: DarkPlaces client server relationship

Post by toneddu2000 »

the 'host' is the underlying commonality between client and server. its the part that handles 'shared' console commands and framerate timings. In QuakeWorld, the 'host' ended up firmly as part of the client, with all the server parts of the host rewritten pretty much from scratch. This helped reduce the negative effects of fixed-rate server frames.
Ok thanks a lot Spike. Now it starts to be more clear.
My second question is: what's the main function the game calls? Host_Main()? Knowing that it's just a step further.
merging the client and server parts of the engine will remove any possibility to play/record demos.
ok, perfect. For this project I need a barebone DP. No need to record demos (to be honest I just wiped out demo recording part).
if you can fix sv_phys.c to also work in csqc, and fix its csqc to actually be able to parse maps entities, then you can just gut all of the server+networking parts and go pure csqc.
That's the part that freaks me out. I tried to understand what kind of string is parsed from server to client and why is it needed. I'll try to make an example, let me know if is correct.
Player launches a map.
The server, by NetConn_ServerParsePacket() in NetConn.c (that should be the file that handles all the connections) sends a string with the map name e all the map entities to the client.
The client verify if that string respects some rules and then decodes the string and launches client commands.
Is that correct?
Thanks again

PS:
why you'd want to cripple it like that I have no idea.
As I said before, for me, that I'm learning C programming from just a year, if architecture is simpler, is more probable that I can learn something
Meadow Fun!! - my first commercial game, made with FTEQW game engine
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: DarkPlaces client server relationship

Post by frag.machine »

If you don't have any previous programming experience in other language, I'd strongly advise you to not use Quake as a C study case.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: DarkPlaces client server relationship

Post by toneddu2000 »

Yeah, you're right frag.machine, I should have started with some simpler but, honestly, I don't want to give up now. This is the only part that I didn't comprehend completely but I think is doable in some way
Meadow Fun!! - my first commercial game, made with FTEQW game engine
jitspoe
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: DarkPlaces client server relationship

Post by jitspoe »

This is a bit of a catch 22. In order to make this change, you'd have to have a pretty good understanding of how the client/server architecture works. If you have a good understanding of it, then, well, you don't need to make the change, because you're trying to make the change to make it simpler and easer to understand.

My advice would be to embrace the client/server architecture, even if you're not planning on making a multiplayer game. If you want to add coop or PVP later on, it will be much easier, and understanding good multiplayer architecture tends to be a rarity in game development, so it's worth learning if you plan to use your programming skills to make games in the future.
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: DarkPlaces client server relationship

Post by toneddu2000 »

This is a bit of a catch 22. In order to make this change, you'd have to have a pretty good understanding of how the client/server architecture works
I opened this thread because I don't know how client/server architecture works in dp and I would like to know more! :)
If anyone knows at least an internet reference where it's described it would be awesome
Meadow Fun!! - my first commercial game, made with FTEQW game engine
jitspoe
Posts: 217
Joined: Mon Jan 17, 2005 5:27 am

Re: DarkPlaces client server relationship

Post by jitspoe »

What are you trying to accomplish that the client/server architecture is making difficult?
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: DarkPlaces client server relationship

Post by toneddu2000 »

To be honest, is the first time I see a list of replies that, not only not help anyone, but they are more problematic than the question! :) When I try to reply to a question in this forum, I just do it, I don' t try to get into the thread author's mind to understand if he/she is right, if it's usable, or whatever..

IT WAS JUST FOR UNDERSTAND HOW DARKPLACES WORKS BETWEEN CLIENT AND SERVER. IT WAS AN ACADEMIC/LEARNING PURPOSE. Just that.

I would like to know how packets are melt together in a string and send via Client/ServerParsePacket() funtion.

If anyone here in the forums doesn't know ho to accomplish it(but I think that someone could start a discussion at least), there's no problem, let's move along, but please, stop posting questions to question!
Meadow Fun!! - my first commercial game, made with FTEQW game engine
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: DarkPlaces client server relationship

Post by frag.machine »

Well, sorry if our answers didnt help. Maybe the problem lies in the question ? :roll:
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: DarkPlaces client server relationship

Post by toneddu2000 »

sorry frag.machine, could you be more specific? You mean that's impossible to separate client from server in quake architecture? Did you mean that?
Well, that's fine by me. I wanted just to know it.
frag.machine wrote:Well, sorry if our answers didnt help.
If you scroll carefully the entire thread you'll notice that, except your first post and Spike's one, no one has constructively explained his arguments. Just random phrases like "it's difficult" or "why in hell someone should do it?".
Well, just for the fun to do it and learn. That's it.

I didn't want to be harsh, sorry
Meadow Fun!! - my first commercial game, made with FTEQW game engine
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: DarkPlaces client server relationship

Post by frag.machine »

No, I didn't say anything that could imply it's impossible. Given enough time and effort, you can achieve pretty much anything.

This link may help you to better understand how the server client is implemented, at least NetQuake wise. Don't know if there's an equivalent documentation on QuakeWorld. I'd suggest paying special attention in the loopback driver section.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
toneddu2000
Posts: 1395
Joined: Tue Feb 24, 2009 4:39 pm
Location: Italy

Re: DarkPlaces client server relationship

Post by toneddu2000 »

Thanks a lot frag.machine, I had a look at the documentation you posted and I've only a doubt, what is NetQuake? I found this page over the net and I deduced this (correct me if I'm wrong).
NetQuake is the first implementation of a client server architecture in Quake, back in 1996, where were more the cons than the pros in multiplayer playability due to high latency problem.
QuakeWorld is a rewrite of NetQuake, improving NetQuake's flaws.

So, if I understood right, it's better for me to take a look at original quake source, because in that code Multiplayer part is less consistent and it's probably easier to get rid of it, right?
Meadow Fun!! - my first commercial game, made with FTEQW game engine
Post Reply