Main forum > Beta Tests

Lingooh! Word Puzzle - Playable Demoversion

<< < (2/2)

svenart:
@ Dreamerman

thanks again. I have already added a fullscreen switch button and changed limitfps to 60 and it seems that there is no black frame anymore. Also the mouseselecting is better/faster now. I hope I can upload an updated demoversion maybe in the next 1-2 weeks.

I´m unsure right now about the french and spanish language. I think you are right, if i offer this languages to play, I should add the relevant alphabet for this country with all special letters. I will think about this.

I have one Question: I would love to add a online highscore which could be stored on my webserver. But I have 0 experience in this "field" of programming (network/internet stuff). Is it hard to do? Do you know some examples or tutorials or have a hint for me where to start this?

erico:
Looks very polished. Everything is very clear/distinct so you can spot words from far away and concentrate on the game.
Well done! :good:

svenart:
thank you erico!

dreamerman:
If you only changed fps without addressing reason why that black frame appears it still may be there but just visible for shorter time so not so notable/easy to spot. I would advise to find why it's appearing.
Such languages as German should be fairly easy as (not sure) all letters are in extended ASCII, but French/Spanish would require some work to get have all letters.

There is quite a lot of thing to talk about when considering online highscore, but generally You need server with PHP and sql, don't have any specific tutorial but most info you can find here: w3schools
On one hand such solution is simple to implement and easy to maintain, but on other it's easier to hack (plain http request can be catch) without some kind of encryption of additional score verification.
You can consider two approaches:
1. simplest, just store each new uploaded score (nickname, score, number of words etc.), show 10 best, clear rest one of couple days,
2. store each user data separately, update user best score and show 10 best users, this way you can easily count users, active users and so on,
Below you can find some really simple highscore system for first option, in mysql admin create sql table 'highscores' with 3 fields - 'id' (autoincrement), 'nickname', 'userscore', modify and place those 3 php files on your server (for easier testing you can use local http server, for example xampp for windows)
Note some functions can have different name depending on your server specification and supported PHP/sql version, and most likely there are some typos here as this is fast modification of my older highscore system so take that in mind.

dbase.php - keep username, password in a separate file

--- Code: (glbasic) ---<?php
$db_user = "your_user";
$db_pass = "your_password";
$db_serv = "localhost"; // for localhost tests
$db_name = "your_db_name";
?>
--- End code ---

add_score.php - user to upload new scores

--- Code: (glbasic) ---<?php
error_reporting(0); // use this for public version
//error_reporting(E_ALL); // use this for developing and testing
header("Content-Type: text/html; charset=utf-8");
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET"); // it can be POST instead, depends on your needs

require("db_base.php");
$link = mysqli_connect($db_serv, $db_user, $db_pass, $db_name);
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

if (!isset($_GET['score']) || !isset($_GET['nick'])) {
printf("Not all variables were set in GET/POST request.");
exit();
}

$nick = mysql_real_escape_string($_GET['nick']);
if(is_null($nick)) $nick="Anonymous";
$pkt = (int)$_GET['score'];

$idzapytania = mysqli_query($link, "INSERT INTO highscores (nickname, userscore) VALUES (`".$nick."`, `".$score."`)");

mysqli_close($link);
?>
--- End code ---

fetch_highscore.php - get current best 10

--- Code: (glbasic) ---<?php
error_reporting(0);
header("Content-Type: text/html; charset=utf-8");
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: GET");

require("db_base.php");
$link = mysqli_connect($db_serv, $db_user, $db_pass, $db_name);
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit();
}

$score_count = 0;

$out_str = "retrieving_info<br>\n";

$idzapytania = mysqli_query($link, "SELECT nickname,userscore FROM highscores ORDER BY `userscore` DESC LIMIT 10");
while ($wiersz = mysqli_fetch_row($idzapytania))
{
$score_count=$score_count+1;
$out_str.="score_entry,id='".$score_count."',nick='".$wiersz[0]."',points='".$wiersz[1]."'<br>\n";
}
mysqli_close($link);

$out_str.="scores_count=".$score_count."<br>\n";

echo $out_str;
?>
--- End code ---
It should give you some idea how that should look like, and you can upgrade this and modify to your needs, also such example will show you what php/sql things you need to know to work with this.
This file will print 10 best scores in plain txt file formatted like this:

--- Code: (glbasic) ---retrieving_info<br>
score_entry,id='1',nick='player_1',points='12312'<br>
score_entry,id='2',nick='player_2',points='4234'<br>
score_entry,id='3',nick='player_3',points='342'<br>
scores_count=3<br>

--- End code ---
that you later need to parse with GLBasic, but this is rather simple with basic InStr/Mid$ functions.

To send new score use NETWEBGET$(server$, path$+"add_score.php?nick=" + usernick$ + "&score=" + userscore%, 80, 1024, 5000)
To get 10 best score use result$ = NETWEBGET$(server$, path$+"fetch_highscore.php", 80, 4096, 5000)   - 4096bytes should be enough for 10 entries, later you can parse result$ to get all entries.
This is easy way, you can add asynchronous http handling to not block app workflow, additional encoding and so on..

Navigation

[0] Message Index

[*] Previous page

Go to full version