chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Poker server in Chicken


From: Joel Reymont
Subject: Re: [Chicken-users] Poker server in Chicken
Date: Sun, 5 Dec 2004 16:01:21 +0000

Felix,

>On the other hand Chicken's threads are also quite
>efficient,

And Chicken is somehow specially tuned for continuations, right? 

My server is very much one big event-driven state machine and I'm now
looking at using continuations instead of returning state objects and such.

>So you mean, you have structured data with nested items? If the events are
>highly structured, it might be nice to send s-exprsessions with embedded
>structs that use SRFI-10, like:
>
>(a b c #,(game-summary <summary-data> ...) ...)

That's exactly what I want to do at first. It will simplify my debugging
greately! If I correctly understand from your other email I would just
create a structure, assign the fields (including structure elements like
game summary above) and then do this bit of magic:

(define-record foo a b)
(record->vector (make-foo 33 44))   ; ==> #(foo 33 44)

To read it in again:

(define-reader-ctor 'foo make-foo)

(with-input-from-string "#,(foo 99 100)" read) -> <foo>

Is that correct?

>Yes, you could use SRFI-10 (as used in the example above). You register
>a reader-procedure that will be called when the reader encounters text
>of the form "#,(<name> <arguments> ...)". This of course assumes a textual
>protocol.

Is there an example of registering such a reader procedure assuming that
I used SRFI-10? I'm about a minute away of doing my server in Scheme :-)!

>Can you give an estimation about the amount of data that is transmitted?
>(Sorry, I don't know much about poker, or how it's played online)

There current Delphi implementation uses RTTI to dump the whole object
tree for a packet into a binary blob. Some binary packets are 20K and
bigger. I think my new protocol will be more efficient but I do have to
think about users on modem lines. 

I suppose I could pass Chicken structures into C++ and then serialize
them but I'd rather only do that as a last resort. I think I'll try
compressing sexsps first.

    Thanks, Joel

-- 
OpenPoker: The Linux of poker software
http://wagerlabs.com/forums






reply via email to

[Prev in Thread] Current Thread [Next in Thread]