开发者

Online highscore for my game [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. 开发者_运维问答 Closed 12 years ago.

I'm creating a game using c# and I would like an online highscore board. I prefer the highscore to be stored in a MySQL-database but other ways will also work.

Please point me to the right direction.

Edit, more information:

I am using MySQL at localhost, dbname: diggangames. The game I'm creating in C# is a basic console application and the score is calculated in the end, that score + a string + a timestamp I want to insert into the database. After the insert I want to view the table with entry's


You'll need a web site, or at least some other service on the network that will talk to the database. (You don't want anyone connecting directly to the server, as any program that does will need to have the password -- and someone inclined to mess with your data could get that password in the assembly with very little trouble.)

On the server, it depends what language/platform you use. For web / MySQL, i'd recommend PHP, as it come semi built with support. And frankly, it's easier to start with than ASP.net is.

Once you have something to handle that access, in your C# app, you can use a WebRequest to post the info and see the response. Something like this:

WebRequest req = WebRequest.Create("http://my.site.com/reportscore");
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded"; // or something like that

Stream reqStream = req.GetRequestStream();
byte[] encoded = Encoding.UTF8.GetBytes("score=12345&name=Somebody");
reqStream.Write(encoded, 0, encoded.Length);
reqStream.Close();

WebResponse resp = req.GetResponse();

The response object will have a stream you can use to read the data the server sent back.

Something to keep in mind, though...anyone that knows this URL, and what to send, could mess with your scores and give themselves a score of 24246246624245245245 if you don't have some way to validate the score.


Start here: http://www.15seconds.com/issue/050210.htm

It's a tutorial for using ASP.NET to connect to and read from/update MySql.

Connecting to and using MySql from a Console app is pretty much the same as with ASP.Net, so this will be helpful...

But it sounds like what you need is a mentor, or more time learning the basics.


here are couple of link not directly in Asp.net but can get you started quickly.

http://code.google.com/p/scoreninja/

a simple application that you can upload on google app engine and start using it for your own high score data storage.

there is also one similar for android.

http://www.andoop.com/ahighscore

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜