Sign in to follow this  

[web] [ ? ] What to use for interactive story

This topic is 3859 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I am writing an interactive story and I want to use a database. I am not sure what I should use to implement the page. I would like some advices. The features I want: 1) Character Profiles: On the main site, I want to display the profiles of the characters with instantaneous status. There are around 50 characters total, but only 12 of them will have dynamically changing status. Status include: "online", "offline", "sleeping", "shopping", "dead". I would also display any special items that they are carrying. Aside from the status and item, I would also display a picture of the character, and a text description that is mostly read-only but with formatted text and links. 2) A 2D Map: The Map is on the main site. It shows the locations of the characters on the map. It is prefered but not necessary that the map refreshes itself periodically. 3) Voting: Players have passwords that allows them to vote. 4) Polling and Comments: All visitors with or without a password may vote in polls and leave comments. 5) Movements: The player can move from one area another aread by clicking on the map. If the player wants to move from A to C, and the two locations are connected through path B, then the system would move the player to B first, check for any event, then move to C. Everytime a player moves, movement points are deducted. The points are recharged through time (in unit of hours or day). This prevents a player from arbitrarily moving all over the map. 6) Transactions: A player can trade with another player or shop. A player can also hide an item (which can be a written message), at dynamically defined locations on the map. A dynamically define location is like this: "under the first drawer", where the player types the location like a password. Transactions require Action points. It is similar to the movement points. 7) Dialogues: In each area on the map, a player can post a dialogue line. If another player is in the same area, the players can converse in real time. The chat log is automatically saved. When a game is taking place, a chat log can only be read by the players that chatted. When the game ends, everyone can read the chat log. What I plan to use: - Flash, MySQL, PHP I have just started learning MySQL and PHP. I know a small bit of Flash programming. What is the easiest or the most common way to implement each feature ? What combination of Flash, MySQL, PHP, and HTML should I use for each ? Do you see any pitfall in the way I thought about the features ? Do you see any limitations that I may want to know if I will expand the features ? - Thanks [Edited by - Wai on May 22, 2007 1:46:01 PM]

Share this post


Link to post
Share on other sites
Don't get me wrong, php and mysql are great tools for the internet and I'd be inclined to say they are damn near the best tools to decide to work with.

But php can't run graphic engines to play a game 2d or 3d. You'll want to start learning java more then likely. I'm sure just about any database will work as well, but your world is not going to be the database.

Characters can be, their position, items, stuff like that.

Someone will take this a little further, and will probably move this as well.

Share this post


Link to post
Share on other sites
Very brief answers, since the questions are somewhat nonspecific. :)

Quote:
Original post by Wai
1) Character Profiles:
On the main site, I want to display the profiles of the characters with instantaneous status. There are around 50 characters total, but only 12 of them will have dynamically changing status. Status include: "online", "offline", "sleeping", "shopping", "dead". I would also display any special items that they are carrying. Aside from the status and item, I would also display a picture of the character, and a text description that is mostly read-only but with formatted text and links.

Store the information in the database, let the Flash make a request to the server, and let a PHP script return the data in XML. The XML format is not required, but ActionScript has build in classes/methods to handle it. If bandwidth is an issue, you own format could be an option as well.

Quote:
2) A 2D Map:
The Map is on the main site. It shows the locations of the characters on the map. It is prefered but not necessary that the map refreshes itself periodically.

If the map is build from static tiles, the Flash would only have to request a grid of tile indices with which it can rebuild the map. If the map is much more irregular and complicated, you can use PHP to render the map as an image (JPEG/PNG) so that the flash can download it into a movieclip. The generation of the image can be a potentially expensive operation though, so you should only do it every so often and cache (save to disk) the result. Obviously, you can also use Flash to draw the image if feasible (and have the additional benefit of vector graphics).

Quote:
3) Voting:
Players have passwords that allows them to vote.

Post the username and password from Flash (perhaps encrypted on the client side) to the server PHP, validate and start/update a PHP session (storing the session in the database is generally a good idea).

Quote:
4) Polling and Comments:
All visitors with or without a password may vote in polls and leave comments.

Again, post it from Flash, check for a valid session (is the user logged in?) and update the database. Return some feedback (errors, new voting statistics etc.) if desired.

Quote:
5) Movements:
The player can move from one area another aread by clicking on the map. If the player wants to move from A to C, and the two locations are connected through path B, then the system would move the player to B first, check for any event, then move to C. Everytime a player moves, movement points are deducted. The points are recharged through time (in unit of hours or day). This prevents a player from arbitrarily moving all over the map.

Again, same procedure. First check on the server whether it is a valid move (logged in user, adjacent tiles, sufficient action point, etc.), and send back the result.

Quote:
6) Transactions:
A player can trade with another player or shop. A player can also hide an item (which can be a written message), at dynamically defined locations on the map. A dynamically define location is like this: "under the first drawer", where the player types the location like a password. Transactions require Action points. It is similar to the movement points.

Same thing. Make sure you check everything on the server!

Quote:
7) Dialogues:
In each area on the map, a player can post a dialogue line. If another player is in the same area, the players can converse in real time. The chat log is automatically saved. When a game is taking place, a chat log can only be read by the players that chatted. When the game ends, everyone can read the chat log.

Depends how real-time the chat should be. Perhaps you can get away with the HTTP, maybe you need sockets. There was a thread about a web-based RTS in this forum not too long ago. You may find some more info there..


In general: yes, you can use a combination of PHP, MySQL and Flash to achieve what I think you want to do.

Share this post


Link to post
Share on other sites
Thanks for the replies. Now I know more directions to look at.

Here is a more central question:


According to how I have described the game, the game states would not change until a player makes a move, because there is no game engine running on any server. The only things "there" are the database and the Flash swf. For example, a player cannot schedule an action for the character to perform while the player is offline, since there is nothing running to change the states in the database.

Intuitively, I have these solutions:

1) When a player connects, the Flash checks for any action that should have occured while no one was online. It simulates it up to the current point.


2) There is an admin player who is almost always online. The world states are updated through the special Flash that the admin player runs.


(The required update rate is about once per hour.)

How would you do it or how should it be done normally ?

- Thanks

Share this post


Link to post
Share on other sites
3) You have a crontab/scheduled task running that updates the database and everything else necessary every hour.

Number one would lead to all kind of nasty issues: any other player would see incorrect statistics (say, the number of action points) for me as a player until I have logged in, for instance.
Number two relies on human interaction to do boring tasks on ungodly hours, which is one of the reason we have invented computers. ;)
I'd go with number three.

Share this post


Link to post
Share on other sites
Thanks. The remote admin task can run automatically, but that computer needs to be connected to the database every hour.


4) Perhaps there can be just a button on the main page that shows the time the world stats was last updated. Any visitor can click on that button to update the states. An alternative to this is that whenever the page is refreshed, the page automatically check for events to simulate. (this is the same as method 1)


Feature 8: Displaying the Interactive Story

The text portion will contain pictures and dialogues. Each dialogue line starts with a small icon of the speaker. The text itself is formatted, may contain variables that are assigned on the fly. At the end of a passage, there would be a list of choices. When the player clicks on a choice, a new passsage is displayed. There should be a back button mechanism for the player to review previous passages. The player can review previous passages, but cannot change a past decision.


- I think that if I use Flash to display, the formatting will be quite hard (or is it very easy?), and to implement the back button I would need to store the previous states so that the variables in the text could display correctly. (I think I would need to store the states and the transitions in the database.)

- I think I can use PHP to display. When the player makes a choice, the game creates a post of the next passage and posts it to its thread. The story that the player reads is a that thread. To view previous passages, the player would either scroll up or go back one post.

It seems that Flash can readily display html. The advantage of using Flash to display the story is that the pictures can be alive, and the player is not limited to clicking to select the choices.


Feature 9: Screen Captures

Some parts of the game have to be Flash because it involves arcade style actions. When the player is playing, the game or the player can take screenshots. These screenshots are stored in the database. They are used when the story is displayed. (The game generates the narration based on the actions of the player.)

- What will it take to enable screen capture ?

Share this post


Link to post
Share on other sites

This topic is 3859 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this