Forum

> > CS2D > General > [RELEASE] Custom CS2D Server a0.1
Forums overviewCS2D overviewGeneral overviewLog in to reply

English [RELEASE] Custom CS2D Server a0.1

79 replies
Page
To the start Previous 1 2 3 4 Next To the start

old Re: [RELEASE] Custom CS2D Server a0.1

Jermuk
User Off Offline

Quote
@ Everyone who can't start this server:
This is the source code and you have to compile it. Don't ask here until you can tell me exactly errors. And just btw: This is a alpha version. The version for noobs will come out when the server reaches the beta status.

old Re: [RELEASE] Custom CS2D Server a0.1

kNedLiik
User Off Offline

Quote
Wow I can make server with it now ! nice one Jermuk and FlooD . When It will be playable cause now it is saying This is alpha version ! Don't play at it!

old Re: [RELEASE] Custom CS2D Server a0.1

Lee
Moderator Off Offline

Quote
FlooD has written
is it just me or is server.cfg useless...


is it? I only took a look at the interface and it seems that if you don't specify a value for a certain field, it defaults to the values that were coded into the server.

old Re: [RELEASE] Custom CS2D Server a0.1

FlooD
GAME BANNED Off Offline

Quote
btw jermuk's code for main.c screws up the fps cuz the sleep function is inside an else loop

idk whether he did this accidentally or not

question:
1
if (FD_ISSET(readsocket, &descriptor))
that means if a packet is received?

old Re: [RELEASE] Custom CS2D Server a0.1

Jermuk
User Off Offline

Quote
FlooD has written
btw jermuk's code for main.c screws up the fps cuz the sleep function is inside an else loop

idk whether he did this accidentally or not

question:
1
if (FD_ISSET(readsocket, &descriptor))
that means if a packet is received?


1) Fixed with new version
2) yes

@All:
New version out! Added now leegoa's rcon_pw and my non-working drop.

old Re: [RELEASE] Custom CS2D Server a0.1

FlooD
GAME BANNED Off Offline

Quote
so currently the server can process only one packet per frame??

maybe that's why it lags when i set fps to 50 and start jamming keys in cs2d.

if i am wrong then just ignore what i write below

my idea:

current loop:
(stuff repeated every frame, including updatebuffer)
if (received packet)
....(packet stuff)
(sleep)
// one loop corresponds to one frame

loop for multiple packets per frame:
if (received packet)
....(packet stuff)
else
....(stuff repeated every frame)
....(sleep)
// one cycle of the else statement corresponds to one frame

old Re: [RELEASE] Custom CS2D Server a0.1

Lee
Moderator Off Offline

Quote
@Flood: The server blocks until a packet is received, so the else control can never be reached unless we explicitly ask the socket to timeout (this will cause players with high latency to randomly drop the connection with the server). If I remember correctly, a lot of other servers use socket selector to emulate pseudo concurrency for handling traffic. (A selector that returns a queue of pointers for read descriptors, write descriptors, and exceptions)

old Re: [RELEASE] Custom CS2D Server a0.1

Lee
Moderator Off Offline

Quote
FlooD has written
o.O
i tried it and the else control does get reached... i know because of !fps


are we actually using a nonblocking server?

Meh, I guess that makes sense seeing as we're handling multiple connections at the same time.

old Re: [RELEASE] Custom CS2D Server a0.1

DannyDeth
User Off Offline

Quote
This seems to be a decent project So im going to try it out. I am no n00b when it comes to C either, my speciality is in sockets programming, so if you need help, I'm the man I'll get the source and see what it is like, it looks very interesting.

old Re: [RELEASE] Custom CS2D Server a0.1

Jermuk
User Off Offline

Quote
Well, we can use threads, but with them we have to rewrite many parts.
And I think we are using a non-blocking server (timeout is 0 (zero; not NULL)).

@DannyDeth:
If you want to help us, just contact me.

old Re: [RELEASE] Custom CS2D Server a0.1

Lee
Moderator Off Offline

Quote
Jermuk has written
Well, we can use threads, but with them we have to rewrite many parts.
And I think we are using a non-blocking server (timeout is 0 (zero; not NULL)).


We don't necessarily need to write a dispatch in order to achieve concurrency, a proven technique to achieve concurrency within small timeouts can be written with the select() on the socket's IO descriptors (which apparently we're already using, God I need to read the source code more often)

http://www.codeproject.com/KB/IP/ScalableClientServer.aspx#premain3

At a higher level:
1
2
3
4
5
6
7
8
9
Socket server
fd_set {read, write, error} = select(server.fileDescriptor)
if server in read:
	// Handles incoming packets
	// Timeout
else if server in write:
	// Send out packets
else if error != 0:
	// Handle exceptions - Bad stream, send request for reconfirmation

Note that select does not block, so we can add in state updates before or after the selector.

Also, it's possible to implement a queue in order to process outgoing items. This way we can make sure that a socket is ready for writing as well as keeping track of corrupted packets (AKA, we requeue items that have not had a confirmation packet sent back to the server yet), this might be a necessity when we have live servers with lots of people playing. If I remember correctly from a profiler on the pre0104 server, we experienced less than 1% packet loss with fewer than 6 people while as high as 7% packet loss with over 12 people, the latter is very significant if we don't resend corrupted data.

old Re: [RELEASE] Custom CS2D Server a0.1

Jermuk
User Off Offline

Quote
@Lee Goa:
Yeah, I already thought about that. But at the beginning I was bored from this low level stuff and I wanted to start the server. Then I forgot it. And to tell the truth: My experience is not enough for such complicated socket handling (thats my first project with sockets). But if you want to implement it, i won't stop you
And btw the link is C++
To the start Previous 1 2 3 4 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview