/vampose-ai

An Educational Game AI Developement

Primary LanguageJavaScript

We have created a simple 2D game interface and a super simple AI for our game idea. The game idea is a discrete grid-based game, where the player has to collect all the golds while avoiding the enemies and the holes.

  • The game is a grid-based exploration game with some elements of risk and reward.
  • The game has a 4 x 4 grid, which is the game level.
  • The player has one single life. If the player hits an enemy or a hole, the game is over.
  • The player can move left, right, up, down, and collect gold using the keyboard.
  • The player can only see a few blocks around them, so they have to use the environmental clues to find the gold and avoid the dangers.
  • The environmental clues are shown in a box at the corner of the screen or as icons or colors at the corner of each block the player observes.
  • The environmental clues are:
    • Smell for the monster, which is present in the four blocks around the monster (up, down, left, right).
    • Brightness for the gold, which is present in the block containing the gold.
    • Wind for the hole, which is present in the four blocks around the hole (up, down, left, right).
  • The player can collect the gold by pressing the “Space” key on the keyboard when they are in the same block as the gold.
  • The number of golds is visible to the player and depends on the game level and the size of the map. For a 4 x 4 map, there is one gold in the blocks.
  • The player’s score and lives are shown on the screen.
  • The goal of the game is to find and collect the gold and avoid the enemies and holes.

The game has the following elements:

  • A canvas element, where the game graphics are drawn.
  • A player object, which represents the user’s character in the game. The player can move one block at a time using the arrow keys, and collect the gold using the space key. The player has a green color and a square shape.
  • An array of enemy objects, which represent the obstacles in the game. The enemies can move randomly on the grid, and if they touch the player, the player loses a life. The enemies have a red color and a square shape.
  • An array of gold objects, which represent the goals in the game. The golds are randomly placed on the grid, and if the player collects them all, the player wins the game. The golds have a yellow color and a square shape.
  • An array of hole objects, which represent another type of obstacle in the game. The holes are randomly placed on the grid, and if the player falls into them, the player loses a life. The holes have a black color and a circular shape.
  • Some variables and constants for the game state and settings, such as the game time, the game score, the game lives, the game speed, the game FPS, the grid size, the grid rows, the grid columns, the number of golds, and the colors and sizes of the game elements.
  • Some sounds and alerts for the game events, such as the game over, the game win, the collect gold, the hit enemy, and the hit hole sounds, and the game over and game win alerts.
  • Some functions for the game logic and graphics, such as the initGame, updateGame, renderGame, handleInput, and isColliding functions, which initialize the game, update the game state, render the game graphics, handle the user input, and check the collision between two objects, respectively. We have coded the game interface using HTML, CSS, and JavaScript, and we have tested the game in a web browser. We have checked the collision between the game objects when generating the game level.

We have not yet worked on the AI of the game, which is the next step of our project. The AI of the game is the part that controls the behavior and intelligence of the enemies, and makes them more challenging and interesting for the player. We will need to use some algorithms and techniques to implement the AI of the game, such as pathfinding, decision making, learning, and adaptation.

To continue working on the AI of the game, I can tell GPT something like “Let’s work on the AI of the game” or “How can we make the enemies smarter?”. We need to make it partially observable as well.