Skip to content
This repository has been archived by the owner on Apr 23, 2024. It is now read-only.

Add a highscore #6

Open
ghost opened this issue Jan 4, 2018 · 1 comment
Open

Add a highscore #6

ghost opened this issue Jan 4, 2018 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 4, 2018

What´s a game without a highscore? We need a highscore, preferrably stored in a database.

@ghost ghost added this to the Feature complete game milestone Jan 4, 2018
@ghost ghost self-assigned this Jan 4, 2018
@EllisTheEllice EllisTheEllice assigned EllisTheEllice and unassigned ghost Jan 5, 2018
@EllisTheEllice
Copy link
Owner

EllisTheEllice commented Jan 9, 2018

I started working on this issue by creating a MySQL container. This container loads an init.sql file in order to create the needed DB structure. The documenation is already adapted.
The next step is to use this database in the project itself and to document, how to persist the data (by mounting a volume to the container).

What I found out so far:

$ npm install mysql
Example
var mysql = require('mysql')
var connection = mysql.createConnection({
  host     : 'localhost',
  user     : 'dbuser',
  password : 's3kreee7',
  database : 'my_db'
});

connection.connect()

connection.query('SELECT 1 + 1 AS solution', function (err, rows, fields) {
  if (err) throw err

  console.log('The solution is: ', rows[0].solution)
})

connection.end()

Some thoughts:

  • a highscore only makes sense when there is the possibility to persist the usernam. Thus a login-mechanism is needed
  • There could be different highscores: One for Singleplayer mode, One for Multiplayer mode
  • Singleplayer Highscore: Increase the AI level after some time. The longer the time, the better the player
  • Multiplayer Highscore: Number of games, number of wins/looses

@EllisTheEllice EllisTheEllice added this to To do in Make pong great again via automation Nov 30, 2020
@EllisTheEllice EllisTheEllice removed their assignment Nov 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant