Online Highscore System - all in one (lite-c, DLL, PHP)

Posted By: TSG_Torsten

Online Highscore System - all in one (lite-c, DLL, PHP) - 04/19/10 19:39

Hi all,

I want to give you something I think almost everyone of you could use: A whole online highscore system.

Download Here

Including support for different score tables (or scores for different difficulties, levels, whatever you want).

It contains:
- A lite-c include offering functions to insert and get scores from the online highscore tables
- A DLL (to make downloading/uploading possible)
- A PHP-Script for almost every webserver

How does it work?
It's not that complex. After you call a send-function in lite-c, a dll-function will call your php-script which will get data from your game and store it in an online highscore file (a plain text file).
While storing, it already inserts the score at the right position.

When your game wants to get the scores, the dll will download the online scores, temporary place it in the game folder and you can read the data.

How to start
Take a look at the ReadMe.txt and run the Example.c to check it out!

I hope you enjoy this contribution!
A credit would be fair, I think wink

If someone wants to, he can also re-write the script to work with another online dll. But I think there is no need to.

If you find bugs, crashes, or if you simply like it, you're welcome to tell it laugh

Regards
TSGames
Posted By: Superku

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 04/19/10 22:27

That is a great contribution, thank you very much!
It will take some time until I'm able to test it, though.
Posted By: Cecia

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 04/22/10 17:49

Hi TSGames,
I've tested your DLL

I've change domain name and add permission serverside

The server and local files are created but when i lauch Example.c return this error:
ERROR E1515
Invalid arguments in main.

A7 Professional 7.21

Cecia
Posted By: Widi

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 04/22/10 17:52

A7 Pro 7.21 --> UPDATE !!!

EDIT: This old version have a lot of Bugs...
Posted By: TSG_Torsten

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 04/22/10 21:24

@Cecia
As Widi already mentioned, you've to update. I think this will cause the error, on the latest engine version the script runs fine.

Regards
TSGames
Posted By: Tempelbauer

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 04/23/10 11:12

@ceica
to update the software, go to the download-section http://www.3dgamestudio.com/download.php and get the setup of the current version V7.82.
look for your username and passwort (can be found in the gamestudio-program-directory) and enter it if you´re asked by the setup
Posted By: TSG_Torsten

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 04/26/10 19:16

I've updated the scripts and re-written the ReadMe-File to give some more information on how to implement it.

Any comments or suggestions would be fine.

Regards
TSGames
Posted By: darkinferno

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 04/30/10 09:57

am trying to learn how to do an online server list, would studying how this works help? i just want an idea
Posted By: TSG_Torsten

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 05/01/10 13:31

Sure, you could even use the DLL from it to get and send your online servers. It isn't that hard to develop, if you want to I could help you doing this (I've already developed on in c-script). (feel free to PM me in this case wink )

Regards
TSGames
Posted By: Liamissimo

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 06/30/10 19:05

I always get an error of Wrong Data / URL.

This is my link http://liamschnell.sagenundmeinen.de/score.php
and it is working with the browser? I also set the key, so I don't know.
Posted By: Liamissimo

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 06/30/10 19:09

I also set that public users can write to it
Posted By: TSG_Torsten

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 07/21/10 09:54

Hey Liam,

sorry for the belated answer. But you should also make sure that the folder where your score.php is located should have "777" rights.

Hope that helps...

Regards
TSGames
Posted By: Liamissimo

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 07/21/10 10:09

Everything works, I had the Free Version, surprise surprise laugh
Posted By: Liamissimo

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 12/14/10 10:42

Sorry, again a question. It seems like after I finished a level he is taking the old score and put they also in the new score table. So in level 1 I had 95 score, in level 2 78 but it also shows my 95 from before.

Code:
return_code = webscore_send(pname,level_name,str_for_num(NULL,score),str_for_num(NULL,zeit));
	if(return_code==-1) error("Upload: Missing DLL");
	else if(return_code==-2) error("Upload: No Connection");
	else if(return_code==-3) error("Upload: Wrong Key");
	else if(return_code==-4) error("Upload: Wrong Data/URL");
	return_code=webscore_get("temp.txt",level_name); // Get Scores from score table my_scores to temp.txt
	if(return_code==-1) error("Download: Missing DLL");
	else if(return_code==-2) error("Download: No Connection");
	else if(return_code==-3) error("Download: Wrong Key");
	else if(return_code==-4) error("Download: Wrong Data/URL");
	else
	{
		STRING* temp_str; // To store our score entries
		var i,j;
		for(i=0;1;i++)
		{
			temp_str=webscore_get_line("temp.txt",i); // Read score
			if(str_cmp(temp_str,"")) break;
			str_cat(scores_name,"\n"); // add a line break to the score output table
			str_cat(scores_points,"\n");
			str_cat(scores_time,"\n");
			str_cat(scores_name,webscore_get_index(temp_str,0)); // Read the name from the entry
			str_cat(scores_points,webscore_get_index(temp_str,1)); // Read the score from the entry
			str_cat(scores_time,webscore_get_index(temp_str,2)); // Read the time from the entry
		}
	}
	file_delete("temp.txt");

But I can't explain why, it deletes temp and so on?
Posted By: Joozey

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 12/14/10 12:02

Haven't tried the contribution, but it seems from code that indeed it adds the score to the list, under the old one. The code does not take levels in regard, it just adds any score to the file. Maybe try write a code that changes the filename to your level? Then you get different textfiles for each level with fitting hiscores.

Sorry if I misunderstood.
Posted By: Liamissimo

Re: Online Highscore System - all in one (lite-c, DLL, PHP) - 12/14/10 19:04

Sorry, my fault, I had to reset the strings every time, I have implemented it in Lift it Up! wink
© 2024 lite-C Forums