Codigo De Jogo Need For Speed Hot Pursuit

0 views
Skip to first unread message
Message has been deleted

Emmanuelle Riker

unread,
Jul 15, 2024, 7:30:23 AM7/15/24
to unininle

GameInternals aims to spread knowledge of interesting game mechanics beyond the game-specific enthusiast communities. Each post focuses on a specific game mechanic that would normally only be known to high-level players of a particular game, and attempts to explain it in a manner that would be understandable even by readers unfamiliar with that game.

codigo de jogo need for speed hot pursuit


Descargar archivo https://urloso.com/2yOYCK



It only seems right for me to begin this blog with the topic that inspired me to start it in the first place. Not too long ago, I came across Jamey Pittman's "Pac-Man Dossier", which is a ridiculously-detailed explanation of the mechanics of Pac-Man. I found it absolutely fascinating, so this site is my attempt to discover and aggregate similarly-detailed information about other games (albeit in much smaller chunks). However, as a bit of a tribute, I'm going to start with Pac-Man as well, specifically the ghost AI. It's an interesting topic, and hopefully my explanation will be a bit more accessible than Jamey's, due to focusing on only the information relevant to ghost behavior.

Every level of Pac-Man uses the same maze layout, containing 240 regular "food" dots and 4 energizers. The tunnels that lead off of the left and right edges of the screen act as shortcuts to the opposite side of the screen, and are usable by both Pac-Man and the ghosts, though the ghosts' speed is greatly reduced while they are in the tunnel. Even though the layout is always the same, the levels become increasingly difficult due to modifications to Pac-Man's speed, as well as changes to both the speed and behavior of the ghosts. After reaching level 21, no further changes to the game's mechanics are made, and every level from 21 onwards is effectively identical.

Each of the ghosts is programmed with an individual "personality", a different algorithm it uses to determine its method of moving through the maze. Understanding how each ghost behaves is extremely important to be able to effectively avoid them. However, before discussing their individual behaviors, let's first examine the logic that they share.

When a player begins a game of Pac-Man, they are not immediately attacked by all four of the ghosts. As shown on the diagram of the initial game position, only one ghost begins in the actual maze, while the others are inside a small area in the middle of the maze, often referred to as the "ghost house". Other than at the beginning of a level, the ghosts will only return to this area if they are eaten by an energized Pac-Man, or as a result of their positions being reset when Pac-Man dies. The ghost house is otherwise inaccessible, and is not a valid area for Pac-Man or the ghosts to move into. Ghosts always move to the left as soon as they leave the ghost house, but they may reverse direction almost immediately due to an effect that will be described later.

The conditions that determine when the three ghosts that start inside the ghost house are able to leave it are actually fairly complex. Because of this, I'm going to consider them outside the scope of this article, especially since they become much less relevant after completing the first few levels. If you're interested in reading about these rules (and an interesting exploit of them), the Pac-Man Dossier covers them in-depth (under the "Home Sweet Home" heading), as always.

Much of Pac-Man's design and mechanics revolve around the idea of the board being split into tiles. "Tile" in this context refers to an 8 x 8 pixel square on the screen. Pac-Man's screen resolution is 224 x 288, so this gives us a total board size of 28 x 36 tiles, though most of these are not accessible to Pac-Man or the ghosts. As an example of the impact of tiles, a ghost is considered to have caught Pac-Man when it occupies the same tile as him. In addition, every pellet in the maze is in the center of its own tile. It should be noted that since the sprites for Pac-Man and the ghosts are larger than one tile in size, they are never completely contained in a single tile. Due to this, for the game's purposes, the character is considered to occupy whichever tile contains its center point. This is important knowledge when avoiding ghosts, since Pac-Man will only be caught if a ghost manages to move its center point into the same tile as Pac-Man's.

The key to understanding ghost behavior is the concept of a target tile. The large majority of the time, each ghost has a specific tile that it is trying to reach, and its behavior revolves around trying to get to that tile from its current one. All of the ghosts use identical methods to travel towards their targets, but the different ghost personalities come about due to the individual way each ghost has of selecting its target tile. Note that there are no restrictions that a target tile must actually be possible to reach, they can (and often are) located on an inaccessible tile, and many of the common ghost behaviors are a direct result of this possibility. Target tiles will be discussed in more detail in upcoming sections, but for now just keep in mind that the ghosts are almost always motivated by trying to reach a particular tile.

The ghosts are always in one of three possible modes: Chase, Scatter, or Frightened. The "normal" mode with the ghosts pursuing Pac-Man is Chase, and this is the one that they spend most of their time in. While in Chase mode, all of the ghosts use Pac-Man's position as a factor in selecting their target tile, though it is more significant to some ghosts than others. In Scatter mode, each ghost has a fixed target tile, each of which is located just outside a different corner of the maze. This causes the four ghosts to disperse to the corners whenever they are in this mode. Frightened mode is unique because the ghosts do not have a specific target tile while in this mode. Instead, they pseudorandomly decide which turns to make at every intersection. A ghost in Frightened mode also turns dark blue, moves much more slowly and can be eaten by Pac-Man. However, the duration of Frightened mode is shortened as the player progresses through the levels, and is completely eliminated from level 19 onwards.

Changes between Chase and Scatter modes occur on a fixed timer, which causes the "wave" effect described by Iwatani. This timer is reset at the beginning of each level and whenever a life is lost. The timer is also paused while the ghosts are in Frightened mode, which occurs whenever Pac-Man eats an energizer. When Frightened mode ends, the ghosts return to their previous mode, and the timer resumes where it left off. The ghosts start out in Scatter mode, and there are four waves of Scatter/Chase alternation defined, after which the ghosts will remain in Chase mode indefinitely (until the timer is reset). For the first level, the durations of these phases are:

The durations of these phases are changed somewhat when the player reaches level 2, and once again when they reach level 5. Starting on level 2, the third Chase mode lengthens considerably, to 1033 seconds (17 minutes and 13 seconds), and the following Scatter mode lasts just 1/60 of a second before the ghosts proceed to their permanent Chase mode. The level 5 changes build on top of this, additionally reducing the first two Scatter lengths to 5 seconds, and adding the 4 seconds gained here to the third Chase mode, lengthening it to 1037 seconds (17:17). Regarding the 1/60-of-a-second Scatter mode on every level except the first, even though it may seem that switching modes for such an insignificant amount of time is pointless, there is a reason behind it, which shall be revealed shortly.

The next step is understanding exactly how the ghosts attempt to reach their target tiles. The ghosts' AI is very simple and short-sighted, which makes the complex behavior of the ghosts even more impressive. Ghosts only ever plan one step into the future as they move about the maze. Whenever a ghost enters a new tile, it looks ahead to the next tile that it will reach, and makes a decision about which direction it will turn when it gets there. These decisions have one very important restriction, which is that ghosts may never choose to reverse their direction of travel. That is, a ghost cannot enter a tile from the left side and then decide to reverse direction and move back to the left. The implication of this restriction is that whenever a ghost enters a tile with only two exits, it will always continue in the same direction.

However, there is one exception to this rule, which is that whenever ghosts change from Chase or Scatter to any other mode, they are forced to reverse direction as soon as they enter the next tile. This forced instruction will overwrite whatever decision the ghosts had previously made about the direction to move when they reach that tile. This effectively acts as a notifier to the player that the ghosts have changed modes, since it is the only time a ghost can possibly reverse direction. Note that when the ghosts leave Frightened mode they do not change direction, but this particular switch is already obvious due to the ghosts reverting to their regular colors from the dark blue of Frightened. So then, the 1/60-of-a-second Scatter mode on every level after the first will cause all the ghosts to reverse their direction of travel, even though their target effectively remains the same. This forced direction-reversal instruction is also applied to any ghosts still inside the ghost house, so a ghost that hasn't yet entered the maze by the time the first mode switch occurs will exit the ghost house with a "reverse direction as soon as you can" instruction already pending. This causes them to move left as usual for a very short time, but they will almost immediately reverse direction and go to the right instead.

When a decision about which direction to turn is necessary, the choice is made based on which tile adjoining the intersection will put the ghost nearest to its target tile, measured in a straight line. The distance from every possibility to the target tile is measured, and whichever tile is closest to the target will be selected. In the diagram to the left, the ghost will turn upwards at the intersection. If two or more potential choices are an equal distance from the target, the decision between them is made in the order of up > left > down. A decision to exit right can never be made in a situation where two tiles are equidistant to the target, since any other option has a higher priority.

d3342ee215
Reply all
Reply to author
Forward
0 new messages