From: Miguel A. B. L. <mig...@ho...> - 2003-12-29 19:05:44
|
I expose here the idea hidden on the graphic that I send yesterday. Hope it help to point out problems better. Title : Implementation walkthrough Info : Description of how we are going to implement it Keyword: basic, design, game, rp, idea Author : Miguel Angel Blanch Lardin Created: 2003/12/30 status : planning Let's describe a common session and along it we describe how each part is implemented. 1) Player starts the game and click on the Start button. Common login-character procedure follow as in SimpleGame. RuleProcessor.onInit { Player[_joined]="" add Player to Zone } 2) We are now on the main screen, and the client would have showed that a new player have joined. RuleProcessor.nextTurn { foreach Player do { foreach Attribute { if (start with "_") { remove Attribute } } } } We are seeing now in zone the next set of objects. Zone { Object /* The heroes house is the shop in Gladiators */ { name="Heroes' House" type="shop" Slots { Gladiators { Object { type="Gladiator"; ... } Object { type="Gladiator"; ... } Object { type="Gladiator"; ... } } Items { Object { type="sword"; ... } Object { type="shield"; ... } } } } Object /* The arena where fighting happens */ { name="Arena" type="arena" status="waiting" gladiators="[]" waitingGladiators="0" } Object { type="player" name="miguel" fame="100" Slots { Gladiators { Object { type="Gladiator" ... } } Items { } } } Object { type="player" name="root777" fame="100" Slots { Gladiators { Object { type="Gladiator" ... } } Items { } } } } Well, a bit legnthy, but that would be the real content of a Zone that is just with two players, and none of them has requested to fight. As I have said, we will consider buy action on a later revision, so our players already comes with a gladiator to fight. 3) There are two possible actions now: · Equip · Request fight 3.1) TODO: Equip command This command is scheduled for next revision. Goto to 3 3.2) Request fight The player MUST click on the glowing sword on the right side of the window. Then the REQUEST FIGHT action is scheduled. RequestFight { Gladiator } On server we would have: RuleProcessor.Request Fight { arena=get Arena from Zone if(arena[status] is WAITING && arena[gladiators].size < GLADIATORS_PER_FIGHT) { player[status]="onArena" arena[gladiators].add gladiator } else { player[requestedFight]=turn arena[waitingGladiators]=arena[waitingGladiators]+1; } } The basic translation to common english is: "If the arena is waiting for fighters and there are no still enough fighters for the fight to begin, then add ourselves to the fight, else put us on the waiting queue". RuleProcessor.NextTurn { if arena[gladiators].size==GLADIATORS_PER_FIGHT { arena[status]=FIGHTING } foreach arena[gladiators] { gladiator[status]="onFight" } } 4) Once that arena status is fighting, can happen two things: · You are fighting · You are watching 4.1) You are fighting You have at the side of your character 3 buttons. · FULL Attack · FULL Defense · Dogde You can cast the action to change the way of fighting of your player. That will be initially to FULL Defense. FightMode { Gladiator Mode } RuleProcessor.nextTurn { if(arena[status]==FIGHTING) { /* Resolve this turn combat */ Roll dices for each Gladiator GladiatorsPlaying=0; foreach gladiator { if(gladiator[status]=="onFight") { GladiatorsPlaying++ Compute damages based on Ragnar's Doc for the rest of Gladiators if(gladiator[hp]<=0) { gladiator[status]="onDefeat" } } } if(GladiatorsPlaying==1) { arena[status]=REQUEST FAME foreach gladiator { arena[fame]=SUM gladiators[fame] if(gladiator[status]=="onFight") { gladiator[status]="onVictory" arena[winner]=gladiator[id] arena[timeout]="60" arena[thumb_up]=0 arena[thumb_down]=0 arena[fame]=arena[fame]-gladiator[fame] } } } } } 5) Requesting Fame When client see on Arena the REQUEST FAME status, he/she is presented a screen to vote for the result of the combat. The more thumbs up, the best the combat has been and so the more fame you are awarded. On the other side if combat has been really boring, you will see lots of thumbs and you will recieve a small amount of fame instead. Basically the process is control in the arena with a timeout value. Zone { ... Object /* The arena where fighting happens */ { name="Arena" type="arena" status="REQUEST FAME" winner="miguel" thumb_up=0 thumb_down=0 timeout="60" gladiators="[miguel|root777]" waitingGladiators=... } } RuleProcessor.Vote { if(NOT exist player[vote]) { if(exists action[thumb_up]) { arena[thumb_up]=arena[thumb_up]+1 } if(exists action[thumb_down]) { arena[thumb_down]=arena[thumb_down]+1 } player[vote]="" } } RuleProcessor.nextTurn { if(arena[status]==REQUEST FAME) { if(arena[timeout]>0) { arena[timeout]=arena[timeout]-1 } else { arena[status]=WAITING arena[gladiators]="[]" if(arena[waitingGladiators]>0) { Choose new fighters } Assign fame to winner foreach player { remove vote } } } } 4.2) You are watching combat Well, just that, you are only watching it. Things that are left away on this analysis ------------------------------------------ 1) If player is playing and exists we have to remove it from the queue. RuleProcessor.onExit { if(exist player[requestedFight]) { arena[waitingGladiators]--; } ... } RuleProcessor.onTimeout { if(exist player[requestedFight]) { arena[waitingGladiators]--; } ... } 2) Attributes of Gladiators have been deliveratedly ignored. They depend on the doc that Ragnar should follow soon. _________________________________________________________________ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail |