Skip to content

A pygame project about a samurai battling a flock of robotic spiders that shoot deadly lasers.

Notifications You must be signed in to change notification settings

romavini/Reflexy

Repository files navigation

Reflexy

version

A pixel-art pygame project

🚨 🕷   Concept

A samurai battling a bunch of robotic spiders that shoot deadly lasers, anyway, just another day in the life of a samurai...

Spider Arena

🤖 🦾   Genetic Algorithm and Artificial Neural Network

This project is also a sandbox to work with handmade IA algorithms. The intent is to create a model to guide the actions of the spiders, making them act in the group in a smart way.

The next GIF show the vision of the player and the spiders. Both the characters have a multiple of 36 lines of sight around, 10° apart. Every 36 lines are destined to identify a certain object, returning 1 if seen, or 0 if not.

Spider Arena AI

The characters of spiders have 4 groups of 36 lines of sights, each one identify below, in order of priority:

  • Red lines: Enemy (player) detected.
  • Blue lines: Laser detected.
  • Green lines: Ally (spiders) detected.
  • Black lines: Wall detected.

In case none of the items above is identified, the line is present in silver.

  • Silver lines: Nothing detected.

The character of the player doesn't have the group of lines of sight destined to allies.

Also, the two classes of characters have an extra "line" of sight in format of a square, as a mean to prevent lasers coming from a blindspot.

📦 🕹   Dependencies

  • pygame

🛠 🧰   Run and Test

Enviroment

$ # Create and activate a virtual environment
$ pip install requirements.txt # Install the dependencies

Running

$ python reflexy/main.py

Testing

$ pip install -r requirements-dev.txt # Install the dependencies
$ pytest reflexy