Quixie now supports Net class

Another milestone for the Quixie project — the support for Net class, partially compatible to FreeKE‘s implementation.

FreeKE was using DirectX7’s DirectPlay while Quixie is powered by cha0s’ free ChiSock network library. Quixie’s network capability runs on User-Datagram Protocol (UDP).

This means that one can create a real-time multiplayer game. Of course, everything is preliminary for now — the API could change; we also plan to exploit ChiSock in the built-in game engine of Quixie itself and not just in the scripting level.

Apparently, there seem to be no existing documentation for FreeKE’s Net class. So I am writing below a code snippet for creating a network session and joining one, which I hope is self-explanatory. (Calling any volunteer for the documentation ^^)

//sample of hosting a session
function main() {
    Var:Boolean okay;
    Net:Host("I_am_server", 2, "nettest", okay)
    
    if (okay == true) {
        Var:String player, msg, msgs;
        Var:Boolean gotMsg;
        while (B1 == false) {
            Net:Check()
            Net:GetMessage(player, msg, gotMsg)
            
            if (gotMsg == true) {
                msgs = msgs + "\n" + msg;
                Screen:PrintString(msgs)
            }
            Screen:Render()
        }
    } else {
        Konsol:Message("Unable to create session.","Net Test")
    }
}

Copy above and name it server.ks then copy below for client.ks.

//sample of joining a session
function main() {
    Var:Boolean okay, sent;
    Net:Join("I_am_client", "nettest", "127.0.0.1", okay)
    Var:Number i;
    while (okay EQ true) {
        Net:Check()
        Net:Send(i, sent)
        Konsol:Log("sent " + sent)
        if (i < 20) {
            i++;
        } else {
            okay = false;
        }
    }
}

For the sample code for client, Net:Check is optional -- Net:Check is only used when you are expecting a message.

Sadly, we failed to deliver a release this November due to random bugs that is quite hard to duplicate. To test the code above, download the latest source code from the SVN repository and compile a copy of Quixie.

~creek23


Posted

in

by

Tags:

Comments

8 Responses to “Quixie now supports Net class”

  1. […] Net class — already implemented in v0.3.101130 on […]

  2. tarner Avatar
    tarner

    can I use this for MMORPG?

  3. decoder Avatar
    decoder

    It would probably better if you implement eventlisteners. This way the net-checking step is reduced from the loop resulting to more fps.

    just a thought. 😉

  4. soulradical Avatar
    soulradical

    @tarner, dont fret. this project might be old but progress is way too slow that its just actually starting. i’d use worldforge if i were you.

  5. mikero Avatar
    mikero

    Can I send a UDT? if not, can you implement it please?

  6. funkyfag Avatar
    funkyfag

    i want to make 4vs4 game but how can I make this? soorry for bad english.

  7. Mj Mendoza IV Avatar

    +1 to soulradical. 🙂

    @mikero: I was planning to support that but I’m currently busy with libQuixie nowadays.

    @funkyfag: Net class is more of a proof-of-concept… I still have to make a game out of KAGE then make use of Net class to fine tune its usability. Until then, I can’t help you just yet.

  8. logrono Avatar
    logrono

    I can’t believe people still use this ridiculous game engine!

Leave a Reply to tarner Cancel reply

Your email address will not be published. Required fields are marked *