I'd like to learn how to do some of the more interesting things possible in 21st century MegaZeux, and that will take practice. Lesson learned from the past: don't plan out more than you think you can handle. And my free time is at a premium in these working-adult days, so "think small" is the motto. The idea is to do a couple of little projects that will help me learn my way around Robotic again, be feasible to declare "finished" on a timeline measured in months rather than years, and which could still be usable for a larger game in the future if I feel so inclined.
The Brainstorm/Goal Planning Phase
Project 1: Design a system for shuffling a deck of cards and dealing them out.
Topics to learn: MZMs, maybe sprites and/or strings.
Demo target: Not sure yet. I think programming a whole card game would be too ambitious, but I could do something like a simple RPG battle engine that uses cards instead of invisible dice. Or a system where you can draw cards and put them on the table or in a discard pile, with hot-seat players so you could play whatever card game you want (if for some bizarre reason you wanted to play a card game using a retro-styled computer program!).
The problem at hand: Writing an algorithm for shuffling the cards.
Current ideas: Maybe I don't need to shuffle the deck, so much as pick randomly from the remaining cards every time I need a draw. The inefficient way (especially as the deck gets nearly depleted) would be to roll a random number, and if it comes up on an already-taken card, reroll. A little better would be to take a random number from 1 to the number of cards remaining, and grab the card at that position, but I'm not yet sure how best to update the state of the deck after each draw. Or that process itself could be the shuffle... with each "draw" now appending a character to a string representing the deck, and when we get to the point of actually pulling cards, we grab the next character of the string and load the corresponding card.
Project 2: Design a conversation-tree system, like those seen in BioWare's cRPGs.
Topics to learn: File access, strings.
Demo target: A single playable conversation with several different outcomes. I'm thinking you've got two characters, one whose conversational tack is chosen by the player, with independent agendas. That'd give you four endings: both characters get what they want, neither does, and the two combinations of one character succeeding but the other not.
The problem at hand: Design a file format for the conversation tree, usable with MZX's file reading system, that's easy to scribble in away from MZX but which holds as much information as possible about the conversation--I'd like to limit the hard-coded Robotic stuff to reading and interpreting the file.
Here's my first thought as to what the format might look like. The block below represents a chunk of dialogue, beginning with a "bookmark" IDing the part of the conversation, and ending with the set of responses the player can choose from.
bookmark
*character*dialogue (repeatable)
*#number of responses
*response text*action code (repeat until number of responses reached)
*
first character of action code is a check digit:
D = destination. Following data is bookmark ID
Q = end conversation. Following data is returned as outcome to calling robot
S = store a result without ending the conversation. Following data is returned to calling robot (also needs a destination bookmark)
So an example would look like this:
1
*Joe*Blablabla
*Mac*Ow! My eyelid!
*#3
*Are you hurt?*D2
*MRGRY*S1D3
*I've had enough of this.*Q2
*
That'd be followed by bookmark 2, and so on. The conversation robot reads this, spitting out a bit of dialogue between Joe and Mac, followed by three conversation choices for Joe to say. Choosing "Are you hurt?" takes you to bookmark 2. Choosing "MRGRY" sends "1" back to the robot reading the file, whatever that means, and goes to bookmark 3. "I've had enough of this." ends the conversation, sending "2" back to the robot reading the file.
Any glaring flaws with that? I'm using the * terminator character for baby-steps purposes, so I can use the most basic FREAD functions; it should be simple enough to swap it out for a better delimiter once I feel up to coding that logic.
This post has been edited by SpellWeavre: 01 May 2010 - 03:33 PM

Help












