DarkPlaces client server relationship
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
DarkPlaces client server relationship
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
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
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Re: DarkPlaces client server relationship
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)
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: DarkPlaces client server relationship
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.but besides this I personally dont see the point
Meadow Fun!! - my first commercial game, made with FTEQW game engine
Re: DarkPlaces client server relationship
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.
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.
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: DarkPlaces client server relationship
Ok thanks a lot Spike. Now it starts to be more clear.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.
My second question is: what's the main function the game calls? Host_Main()? Knowing that it's just a step further.
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).merging the client and server parts of the engine will remove any possibility to play/record demos.
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.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.
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:
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 somethingwhy you'd want to cripple it like that I have no idea.
Meadow Fun!! - my first commercial game, made with FTEQW game engine
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Re: DarkPlaces client server relationship
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)
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: DarkPlaces client server relationship
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
Re: DarkPlaces client server relationship
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.
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.
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: DarkPlaces client server relationship
I opened this thread because I don't know how client/server architecture works in dp and I would like to know more!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 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
Re: DarkPlaces client server relationship
What are you trying to accomplish that the client/server architecture is making difficult?
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: DarkPlaces client server relationship
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!
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
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Re: DarkPlaces client server relationship
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)
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: DarkPlaces client server relationship
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.
Well, just for the fun to do it and learn. That's it.
I didn't want to be harsh, sorry
Well, that's fine by me. I wanted just to know it.
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?".frag.machine wrote:Well, sorry if our answers didnt help.
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
-
- Posts: 2126
- Joined: Sat Nov 25, 2006 1:49 pm
Re: DarkPlaces client server relationship
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.
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)
-
- Posts: 1395
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: DarkPlaces client server relationship
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?
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