C++代写:ICS214IcemanPart1


从头开始实现一款大型的RPG游戏Iceman,第一部分是介绍游戏背景。

Introduction

BruinCorp corporate spies have learned that TrojanSoft is planning to release
a new game, called Iceman, and would like you to program an exact copy so
BruinCorp can beat TrojanSoft to the market. To help you, BruinCorp corporate
spies have managed to steal a prototype Iceman executable file and several
source files from the TrojanSoft headquarters, so you can see exactly how your
version of the game must work (see posted executable file) and even get a head
start on the programming. Of course, such behavior would never be appropriate
in real life, but for this project, you’ll be a programming villain.
In Iceman, the player has to dig underground tunnels through an oil field
looking for oil. After the player has gathered all available oil within a
particular field, the level is completed and the player advances to a new,
more difficult oil field.

Game Details

In Iceman, the player starts out a new game with three lives and continues to
play until all of his/her lives have been exhausted. There are multiple levels
in Iceman, beginning with level 0, and each level has its own unique oil field
configuration. During each level, the Iceman (controlled by the player) must
dig and find all of the oil hidden within the oil field in order to move on to
the next level.
Upon starting each level, the player’s Iceman avatar (a miner) is placed at
the top-middle of the oil field just above the tunnel. Every time the player
starts (or re-starts) a level, the Iceman is restored to 100% health, given
fresh water for their squirt gun (enough for 5 squirts), and given a single
sonar charge that they can use to search for nearby items within the ice. Each
oil field has a number of Boulders, Gold Nuggets, and Barrels of oil randomly
distributed throughout the field. Only the Boulders will be visible initially

  • the other items must be discovered by the Iceman before they become visible.
    The player must use the arrow keys to move the Iceman left, right, up and down
    through the oil field; the Iceman digs through any ice in the direction of
    motion. The Iceman may move/dig anywhere in the oil field except for locations
    occupied by Boulders.
    The Iceman must dig through the oil field in search of every Barrel of oil and
    pick each one up by moving to its location. Once the Iceman has picked up all
    of the Barrels of oil in the current oil field, the level ends and the player
    advances to the next level.
    Unfortunately, the Iceman is not alone. A band of Regular and Hardcore
    Protesters roam around the oil field and shout at the Iceman any time they get
    near to him. Each time the Iceman is shouted at, he becomes more irritated
    (and less healthy) and eventually he gives up and quits (loses a life). At
    this point, if the Iceman has more lives, the player can continue the game on
    the current level. If not, the game is over.
    In addition to digging and walking around the oil field, the Iceman may also
    shoot their squirt gun (if it’s filled with water) by pressing the space bar.
    Squirts from the squirt gun will irritate the Protesters and temporarily stun
    them. A Protester who is sufficiently irritated (their hit points go to zero)
    will leave the oil field out of frustration. Occasionally, Water Pools will
    randomly bubble up within the tunnels, and the Iceman can move onto them to
    use this water to refill the squirt gun. But beware - a Water Pool disappears
    quickly back into the tunnel’s ice, so the Iceman needs to siphon it off into
    the squirt gun quickly lest they disappear.
    The Iceman will also discover Gold Nuggets randomly distributed throughout the
    oil field. If the Iceman picks up one or more gold Nuggets, he can use them to
    bribe the Protesters by dropping a Nugget in front of a Protester. If a
    Protester runs into such dropped gold, it will pick it up and accept it as a
    bribe. A bribed Regular Protester leaves the oil field immediately. However, a
    Hardcore Protester simply pockets the gold and after briefly stopping to gloat
    over this new treasure, resumes the hunt to protest against the Iceman. If the
    player drops a Gold Nugget and it’s not picked up quickly, it will sink into
    the muck of the oil field, never to be discovered again.
    In addition to squirting and bribing the Protesters, the Iceman can also cause
    Boulders to drop on them. If the Iceman digs all of the ice supporting a
    Boulder from underneath it, then after a short delay, the Boulder will fall
    until it crashes into the ice or another Boulder below. A Protester who is
    bonked by a Boulder as it falls becomes so irritated that it will immediately
    leave the oil field. But beware, the Iceman is also susceptible to being
    bonked. If the Iceman is bonked, he also becomes super irritated (lose all of
    his hit points), and the level will end. If the player still has lives
    remaining, the level is restarted.
    Of course, the Iceman is not alone - he has buddies that will help him from
    time to time. Friends of the Iceman will occasionally drop new Sonar Kits in
    the upper-left corner of the oil field for the Iceman to pick up. If the
    Iceman has one or more sonar charges in his inventory, the player can press
    the Z key to use a charge to map the contents of the oil field within an
    extended radius around them, eliminating the need to dig into the ice to
    determine its contents. In addition to the Sonar Kits dropped by the Iceman’s
    friends, he also starts out with one sonar charge at the start of each level.
    There are two types of protesters: Regular Protesters and Hardcore Protesters.
    As the gameplay progresses on each level, the game will introduce various new
    Regular and Hardcore Protesters in the upper-right corner of the screen, who
    will then seek out the Iceman to yell at him.
    Regular Protesters are not too dedicated, and are more likely to leave the oil
    field if they are either irritated by being squirted or bribed with gold.
    Regular Protesters wander around essentially randomly through the tunnels of
    the oil field. However, if a Regular Protester sees the Iceman, he will run
    right up to him and begin shouting at him (to irritate him). Each shout will
    cause the Iceman’s health to go down, and when it reaches zero, the Iceman
    will give up (and lose a life). If a Regular Protester is hit by a Boulder, it
    will instantly give up and head directly for the upper-right corner of the
    screen, where it will disappear from the game forever (although a different,
    new Protester will likely soon replace him as the game progresses).
    In contrast to the Regular Protesters, Hardcore Protesters are much nastier.
    They behave almost identically to Regular Protesters, with a few key
    differences. First, they’re much more dedicated and so it takes more squirts
    from the Iceman’s squirt gun to irritate them sufficiently to make them leave
    the oil field. Second, Hardcore Protesters cannot be bribed with Gold Nuggets
    to leave the oil field. Like Regular Protesters, they will stop to pick up
    Nuggets dropped by the Iceman if they run into them. However, after a brief
    delay to examine the Nugget (giving the Iceman valuable time to get away) they
    will pocket the gold and continue to hunt through the oil field for the
    Iceman. Third, Hardcore Protesters are so dedicated that they have found a way
    to track the Iceman’s location from his cell phone, and if they are within a
    short range of the Iceman (e.g., less than 16 horizontal/vertical moves away -
    this distance increases with each level of the game), they will run toward
    him. Assuming they’re close enough, the HardCore Protesters will home in on
    the Iceman and move toward him even if they have no direct line of sight to
    him (Hint: use a breadth-first search like we learned about in the Queue
    lecture). Like Regular Protesters, HardCore Protesters are instantly super-
    annoyed if they’re bonked by a Boulder and will leave the oil field
    immediately. And Hardcore Protesters will exhibit the same movement behavior
    as Regular Protesters if they’re not within cell-phone-detecting range of the
    Iceman.
    If the Iceman’s health reaches zero because they are repeatedly shouted at and
    irritated, he gives up and loses one “life.” If, after losing a life, the
    player has one or more remaining lives left, a new oil field is generated for
    them from scratch (with the same difficulty as the previous oil field they
    just tried to solve, but with a random, new layout), the Iceman is placed back
    on this level and they must again solve the entire level from scratch. The
    Iceman will restart the level with full health points, as well as their
    initial water supply for 5 squirt gun squirts, and one sonar charge.
    The game window is exactly 64 squares wide by 64 squares high. Each object in
    the game (e.g., the Iceman, Protesters, Boulders, Gold Nuggets, Sonar Kits,
    Barrels of oil, Water, etc.) has an image that is exactly 4 squares high by 4
    squares wide. The Iceman may move anywhere within the oil field except on top
    of a Boulder. Protesters are unable to dig through the Ice (they aren’t
    diggers, after all) so they may only move to locations that have no Ice or
    Boulders (i.e., down the tunnels the Iceman has already dug). Both the Iceman
    and the Protesters may occupy overlapping areas of the oil field with each
    other.
    The bottom-leftmost square of the game window has coordinates x=0,y=0, while
    the upper-rightmost square has coordinate x=63,y=63. Notice that x increases
    to the right and y increases upward toward the top of the screen. You can look
    in our provided file, GameConstants.h, for constants that represent the game
    window’s width and height. Each object (e.g., the Iceman or a Gold Nugget) has
    an x,y coordinate designating its location, and this coordinate points to the
    lower-left-hand corner of the object. Therefore, a game object at location
    x=10,y=16 would occupy the 4x4 square described by a lower-left-hand corner of
    (10,16) and an upper-right-hand corner of (13,19). No game object may have a
    lower-left-hand coordinate greater than x=60 or y=60, as this would cause part
    of the game object to be rendered outside the oil field. Similarly, no game
    object may have an x or y coordinate that is less than zero.
    The oil field, which is comprised of 1x1 Ice objects, occupies the entire
    width of the game window, but only the lower 60 squares of the screen. A
    single tunnel is always at the center of the oil field at the start of each
    level.
    As the game progresses, each level will pose new challenges for the Iceman.
    The number of Barrels of oil that must be collected increases, the number of
    Protesters increases, the frequency of Water and Sonar Kits available to the
    Iceman declines, and the Protesters move more quickly and are stunned for
    shorter and shorter periods of time when squirted or when they find a Nugget.
    All of these details are described in the later sections of this document.
    Once a new oil field (all of the Ice that comprises the 64 -square wide by
    60-square high oil field) and its contents have been generated (Boulders,
    Barrels of oil, and Gold Nuggets are distributed through the field) and the
    Iceman has been added to the game, the game play begins. Game play is divided
    into ticks, and there are dozens of ticks per second (to provide smooth
    animation and game play). During each tick, the following occurs:
    1. The player has an opportunity to hit a key to move the Iceman exactly one square horizontally or vertically, shoot their squirt gun (if the Iceman has water), use a sonar charge to reveal the nearby contents of the oil field, or give up (some levels may be unsolvable, so the player can press the Escape key to lose a life and restart the level from scratch).
    2. Every other object in the game (e.g., Regular Protesters, Hardcore Protesters, Gold Nuggets, Boulders, etc.) with the exception of Ice objects (which don’t do anything) is given an opportunity to do something. For example, when given the opportunity to do something, a Regular Protester can move one square (left, right, up or down) according to its built-in movement algorithm (the Regular Protester movement algorithms are described in detail in the various Regular Protester sections below).
    3. One or more new game objects (e.g., Protesters, Sonar Kits or Water) may be added to the game; once added, they’ll have an opportunity to do something during each tick as well.
    4. One or more existing game objects may be removed from the game. For example, if the Iceman picks up a Gold Nugget, its object must be deleted from the game (once the Iceman’s inventory has been updated).
      During game-play, the player controls the direction of the Iceman with the
      arrow keys, or for lefties and others for whom the arrow key placement is
      awkward, WASD or the numeric keypad: up is w or 8, left is a or 4, down is s
      or 2, right is d or 6. The player may move the Iceman anywhere in the oil
      field as they please. The player can sacrifice one life and restart the
      current level by pressing the Escape key at any time.
      The Iceman may shoot their squirt gun by pressing the spacebar key. If the
      Iceman manages to squirt a Regular Protester or a Hardcore Protester enough,
      the Protester will give up, and the player earns points:
      For causing a Regular Protester to give up: 100 points
      For causing a Hardcore Protester to give up: 250 points
      In addition to squirting Protesters, the Iceman can dig the Ice from under a
      Boulder causing it drop on Protesters (of both types). If a Boulder bonks a
      Protester as it falls, the player earns lots of points:
      For causing a Boulder to bonk a Protester: 500 points
      The player can also earn points by dropping a Gold Nugget in front of a
      Protester. Should the Protester pick up a dropped Gold Nugget, the player
      earns:
      For bribing a Regular Protester with a Gold Nugget: 25 points
      For bribing a Hardcore Protester with a Gold Nugget: 50 points
      Finally, the player also earns points and special benefits by picking up
      (i.e., moving onto the same region as) various items:
    • Barrel of oil: 1000 points (the Iceman must collect all of the Barrels on the oil field to complete the level)
    • Gold Nugget: 10 points (the Iceman gets 1 piece of gold added to their inventory, which they can subsequently drop to bribe Protesters)
    • Water: 100 points (5 squirts worth of water are added to the Iceman’s inventory)
    • Sonar Kit: 75 points (the Iceman gets two new sonar charges added to their inventory)
      The player starts with three lives. The player loses a life if their health
      reaches zero (from being annoyed by Protester shouts, or from being bonked by
      a Boulder).
      When the Iceman is completely annoyed (their health reaches zero), the current
      level ends and the player’s number of remaining lives is decremented by 1. If
      the player still has at least one life left, then they are prompted to
      continue and given another chance by restarting the current level from
      scratch. If the player has no lives left, then the game is over. Pressing the
      q key lets you quit the game prematurely.

文章作者: SafePoker
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 SafePoker !
  目录