Skip to content

Navigator Wiki

Mike edited this page Nov 19, 2023 · 28 revisions

title

Feel free to report bugs or leave feedback here

Getting Started

Players:

  • To download the latest version of Navigator, head over to the downloads page and select the version for your operating system.
    • Versions marked with a 'C' indicate that the python script was first converted to Cython for potential performance improvements. Performance improvements may be negligible, as the code is being converted automatically (as of v0.4.9)
    • In the event that the download is flagged by your browser, you may have to allow it in order to continue. This will likely persist until Navigator is code signed
  • Extract the .zip file and run Navigator
    • On Windows, if the program is flagged by Windows Defender, click 'more info' and then 'run'. This will only happen on the first launch
    • On MacOS, if the program is marked unsafe, you will have to first right click, then open it. This will also only happen on the first launch

Developers:

  • You will need Python 3, preferably the latest stable version.
  • Download and install python, and check the box that says "ADD TO PATH"
  • Open up your terminal or command prompt and use the following commands to install the required packages:
    • pip install pygame core game modules
    • pip install python-dotenv for loading environment variables
    • pip install cryptography for encrypting and decrypting game records
    • pip install pypresence for Discord presence
    • pip install dnspython for connecting to leaderboard database
    • pip install certifi for certifying leaderboard connection
    • python -m pip install pymongo==3.11 database drivers
    • You may need to use pip3 or python3 depending on your system
    • On Linux, especially Raspberry Pi, you may need to do a few apt-get's to get the drivers necessary for graphics and fonts
  • Navigate to Navigator-main and run the program
    • on Windows, use python Navigator.py
    • on MacOS and Linux, use python3 Navigator.py
    • to get debug information, use Navigator.py debug

If you are an actual developer, you probably already know what you are doing. This is intended for my friends, or anyone else who wants to mess around with the game


Documentation (in progress)

I would like to apologize to anyone whose eyes I may have offended whilst attempting to read my code. It is not standardized by any means, nor is it particularly well written. Here is a brief and unprofessional breakdown of the source code:

Classes

  • Settings

    • Variables
      • list screenSize define game screen height and width ([800,800])
      • int fps clock tick rate (60)
      • bool fullScreen indicate screen mode (False)
      • bool showFPS display frame rate in window caption (False)
      • bool useController allow controller input (True)
      • bool cursorMode allow cursor input (True)
      • int cursorFollowDistance cursor follow deadzone (25)
      • int cursorRotateDistance cursor rotation deadzone (10)
      • int cursorThickness set crosshair thickness (2)
      • bool showHUD draw game HUD (True)
      • list shieldColor shield UI color ([0,0,255])
      • list fullShieldColor shield UI color when charged ([0,255,255])
      • list fuelColor fuel UI color ([255,0,0])
      • int timerDelay game clock tick delay in ms (1000)
      • int pauseMax max allowed user pauses per game (5)
      • list spawnRange power-up spawn range ([0.15,0.85])
      • int spawnVertices power-up spawn area shape vertex count (8)
      • int pointSize scaled power-up size (25)
      • int playerShieldSize player shield visual size (48)
      • int shieldVisualDuration player shield visual duration (250)
      • int minDistanceToPoint minimum distance between power-up spawns (100)
      • int maxRandomAttempts maximum attempts at generating a valid power-up (100)
      • bool showBackgroundCloud draw moving cloud over the background (True)
      • int cloudSpeed background cloud movement speed (1)
      • int cloudStart background cloud starting Y coordinate (-1000)
      • float cloudSpeedAdder background cloud movement speed increment between levels (0.5)
      • list primaryFontColor main game font color ([0,255,0])
      • list secondaryFontColor secondary game font color ([255,255,255])
      • int maxIcons maximum number of meteors on home screen (5)
      • int maxIconSpeed maximum home screen meteor speed (5)
      • int maxIconRotationSpeed maximum home screen meteor rotation speed (3)
      • int minIconSize minimum home screen meteor size (30)
      • int maxIconSize maximum home screen meteor size (100)
      • bool showVersion show game version on home screen (True)
      • bool showMenuIcons show UFO and meteor icons on home screen (True)
      • int stageUpCloudStartPos stage up cloud starting Y coordinate (-900)
      • int stageUpCloudSpeed stage up cloud movement speed (8)
      • int mainCreditsSpeed credits movement speed (1)
      • int extraCreditsSize supporter text size (50)
      • int maxExtras maximum supporter names on screen at a time (3)
      • int minBackgroundShipSpeed minimum supporter movement speed (2)
      • int maxBackgroundShipSpeed maximum supporter movement speed (3)
      • int minBackgroundShipSize minimum supporter background size (50)
      • int maxBackgroundShipSize maximum supporter background size (100)
      • int minBackgroundShipSpawnDelay minimum supporter spawn delay (500)
      • int maxBackgroundShipSpawnDelay maximum supporter spawn delay (3000)
      • bool showBackgroundShips display supporter backgrounds in credits menu (True)
      • bool showSupporterNames display supporter names in credits menu (True)
      • int musicVolume game music volume (10)
      • int sfxVolume game sound effects volume (5)
      • int numChannels number of audio channels (16)
      • bool musicMuted mute game music (False)
      • int menuLoopStart music menu loop start time (1100)
      • int menuLoopEnd music menu loop end time (12800)
      • int musicLoopStart music game loop start time (25000)
      • int musicLoopEnd music game loop end time (76000)
      • bool resetPlayerOrientation player direction reset if no movement held (True)
      • bool drawExhaust draw player exhaust animation (True)
      • int exhaustUpdateDelay exhaust animation delay (50)
      • bool defaultToHighSkin default to highest unlocked skin on startup (True)
      • bool defaultToHighShip default to highest unlocked ship on startup (False)
      • int heatSeekDelay time before player shot projectile starts heat seeking (15)
      • bool heatSeekNeedsTarget explode projectile if target not found (False)
  • Assets

    • Variables

      • Objects loaded using various pygame methods are stored in class variables.
    • Functions

      • resources(relative)

        • Returns the correct path to the given asset, depending on being run from executable
        • relative is a string representing the relative path to the asset being loaded
      • storeRecords(records) Writes records dictionary to file

      • loadRecords()Read and return records from file

      • loadGameOverMusic() Load and set game over music loop

      • loadMenuMusic() Load and set menu music loop

      • loadSoundtrack() Load game soundtrack and set music queue

      • getDefaultRecords() Returns game records dictionary for a new user

      • getDefaultUnlocks() Returns game unlocks dictionary for a new user

      • getLeaderboardClient() Returns leaderboard database client object using PyMongo

      • getLeaders() Returns leaderboard dictionary

      • uploadRecords(records) Uploads records dictionary to leaderboard database

      • getNewID() get a new user ID for leaderboard database connection

  • Unlocks

    • Stores user ship unlocks as well as unlock criteria
  • Game

    • Handles main game functions
  • Event

    • Handles timed game events
  • Menu

    • Handles menu loops
  • Player

    • Player ship object
  • Obstacle

    • Obstacle object
  • Cave

    • Cave object
  • Laser

    • Player-fired laser object
  • EnemyLaser

    • Enemy-fired laser object
  • Explosion

    • Handles obstacle explosion animations
  • Point

    • Powerup objects
  • Icon

    • Menu meteor icon objects
  • BackgroundShip

    • Credit screen background objects

Created by Mike Pistolesi
with art by Collin Guetta
music by Dylan Kusenko
& game over music by Simon Colker