Jump to content

Record Last Moves


jackmcnally

Recommended Posts

Hi Guys,

 

I appreciate your help! What I am doing is making a Choose Your Own Adventure Game and what I would like to do is the following.

 

  • Record the moves of the person
  • Put those moves on a page telling them their - say - 5 latest games
  • Record the time it took them to complete the adventure
  • Record that in a High Score database

 

I know that I will need to employ the use of MYSQL databases and PHP, but I'm a total noob! Any help would be greatly appreciated!

 

~ Jack

Link to comment
https://forums.phpfreaks.com/topic/247948-record-last-moves/
Share on other sites

There's not much general purpose design help we can give you other than "learn PHP and SQL."

 

You should have a table for the users (make them sign in) [minimum fields:  ID, username]

 

A table for the adventure as a whole [Minimum fields: ID, title, description]

 

A table for every step of the adventure [Minimum fields: ID, description, choiceAText, choiceAStepID, choiceBText, choiceBStepID (the choices should really be their own table, but I'm keeping it simple)]

 

A table that contains a userID, an adventureStepID, and the choice they made at that step. [Minimum fields: UserId, AdventureStepId, timestamp, NextStepChosen]

 

When they make a choice, insert a row into the last table, then load the step that they chose and display it.

 

When you want to show their history, select from the choices they made ordered by the timestamp of the choices.  You can JOIN to the steps table to get the text of each choice and then display their adventure in story mode.

 

-Dan

Link to comment
https://forums.phpfreaks.com/topic/247948-record-last-moves/#findComment-1273225
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.