GingerBatMan's Forum Posts

  • Ok, I'll wait. Thanks

    "could me give a little more details about the server side?!"

    Like what?

       -What I need to happen on the server?

  • Weishaupt,

    I allready tried to modify it allready, Didn't go so well.

    Changed the variable names and then was like what now? :S

  • Tehee I feel Special ;D.

    Thanks sure i'll wait.

  • talkinghead Really cannot wait for this!!! It's gonna be amazing to make my first multiplayer game!!! :D:D:D:D <---- Excitement :D:D:D:D

  • Weishaupt, thanks and sorry for being a pain with all my questions :)

    How would I do this serverside? I have a server which im currently hosting high scores on, So will it be similar?

    Here is the PHP for posting..

    <?php

    // read variables from POST data.

    $username = $HTTP_GET_VARS[name]; <-- DEFINE THE USER??

    $score = $HTTP_GET_VARS[score]; // <-- MODIFY THIS TO SEND THE REPLAY??

    // verify the username is set and not empty

    if (!isset($username) || $username == "") {

        echo "failure";

        exit;

    }

    // verify the score is set and a number

    if (!isset($score) || !is_numeric($score)) {

        echo "failure";

        exit;

    }

    // format the username and score as a comma delimited row

    $entry = $username . "," . $score . "\n";

    // append entry to the score file

    if (!file_put_contents("scores.csv", $entry, FILE_APPEND)) {

        echo "failure"; // failed to write to file

        exit;

    }

    echo "success";

    ?>

    Then Return the data

    <?php

    /** Return a list of top scores. */

    // read variables from GET data

    $num_scores = $HTTP_GET_VARS[num_scores];

    // read each line in scores.csv as a string into an array

    $scores = file("scores.csv");

    // define a comparator to sort items by score

    function compare($s1, $s2) {

        // split the strings by their delimiter

        $a1 = explode(",", $s1);

        $a2 = explode(",", $s2);

        // compare the scores

        return $a2[1] - $a1[1];

    }

    // sort the array of scores

    usort($scores, "compare");

    // output the requested number of top scores

    for ($i = 0; $i < $num_scores && $i < count($scores); $i++) {

        echo $scores[$i];

    }

    ?>

    Can i send:

         - int(tokenat(state,0,","))

         - int(tokenat(state,1,","))

         - int(tokenat(state,2,","))

    instead of score? the retrieve it?

  • Yann, Thanks!!! makes things a little better :)

    A few questions if your genius mind is up for it :)

    1, Saving the replay?

         - Can your mind figure out how to save a replay?

    2, Controlling the replay -

        - Pausing and resuming the replay? (RexRainbows pause function does not quite pause this)

        - Speed control? - Can i control the speed of the playback?

  • , I don't really understand..

  • Thanks Weishaupt, you guys really helped me out.

    If only there was a way to save this, and view it at anytime :o

  • Yann, I couldn't get this working on the second part, It wont let me set state ect, as a sub event

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks Yann, I will give that a go soon. The webstorage is not something im completely in love with. It just makes sense for the user to be able to save replay and then view it somehow.

  • Using your tutorial :)!! Im making a racing game, 2D. And i want the user to be able to view/share there replay. and save it locally so they can view it any time they want.

  • yeah i can imagine so, But is there a way to record the screen with html5?

    I know there is a spritebank plugin, Which might be able to be used.. But This is a feature i really want to implement in my game :(

  • Is there a way to save a replay of a users game, You know like racing games a ghost lap ect?

    Could you record its x,y,angle, rotation every tick the save that into web storage? I'm quite familiar with web storage, but the logic behind getting the x and y position every tick overwhelms me :S

    Im sure Yann has a genius solution to this.. Challenge?

  • rexrainbow, Could you possible be able to show me how to make a ghost lap, or replay using this plugin?