Code Monkey home page Code Monkey logo

reconquering-empyre's Introduction

Reconquering Empyre

About

This is a (shoddy written) python3 port of VMS Empire using ncurses. This is my 1st big project (the other one is relatively small), so there is going to be a lot of SNAFU and stuff.

Requirements

  • Python 3
  • noise

Startup parameters

  • -f [1,2,3,4] Determine the Fog of War
    • 1: See the full map and all the units.
    • 2: See the full map but only friendly units
    • 3 (default): Map is unexplored but once discovered all units will remain visible.
    • 4: Map is unexplored and the only units visible are units within visual range of friendly units
  • -m xxx/yyy Map size for horizontal and vertical axis from 60-999. Defaults are 100x50
  • -d delay This option controls the length of time the computer will delay after printing informational messages at the top of the screen. delay is specified in seconds. The default value is 2 which allows the user two seconds to read a message.

Keys

Depending on the context the following keys issue the following commands. There are the following contexts:

  • global Commands that work no matter the context
  • city Commands that work with cities
  • unit Commands that work with units

Global

  • l Display the logs
  • g Give the AI 1 turn
  • n Give the AI x turns
  • q Save and Quit

City

  • p Pause, do nothing
  • b Build a unit
    • a army
    • f fighter
    • p patrol boat
    • d destroyer
    • s submarine
    • t troop transport
    • c aircraft carrier
    • b battleship
    • z satellite

Unit

  • Num 12346789 Direction to move/attack/load a unit
  • u Unload a unit from Transport or Carrier
  • s Turn unit into a sentry for 10 rounds
  • w Set a waypoint for units to move to

Notes

Combat

        if (irand (2) == 0) /* defender hits? */
            att_obj->hits -= piece_attr[def_obj->type].strength;
        else def_obj->hits -= piece_attr[att_obj->type].strength;
    }
Piece You Enemy Moves Hits Str Cost
Army A a 1 1 1 5(6)
Fighter F f 8 1 1 10(12)
Patrol Boat P p 4 1 1 15(18)
Destroyer D d 2 3 1 20(24)
Submarine S s 2 2 3 20(24)
Troop Transport T t 2 1 1 30(36)
Aircraft Carrier C c 2 8 1 30(36)
Battleship B b 2 10 2 40(48)
Satellite Z z 10 -- -- 50(60)

Other details: http://www.catb.org/~esr/vms-empire/vms-empire.html

typedef struct piece_attr {
        char sname; /* eg 'C' */
        char name[20]; /* eg "aircraft carrier" */
        char nickname[20]; /* eg "carrier" */
        char article[20]; /* eg "an aircraft carrier" */
        char plural[20]; /* eg "aircraft carriers" */
        char terrain[4]; /* terrain piece can pass over eg "." */
        uchar build_time; /* time needed to build unit */
        uchar strength; /* attack strength */
        uchar max_hits; /* number of hits when completely repaired */
        uchar speed; /* number of squares moved per turn */
        uchar capacity; /* max objects that can be held */
        long range; /* range of piece */
} piece_attr_t;

Gamestate format

The gamestate is a variable that tells the program the state of the game. It is updated constantly and through the Pickle to store the game to a file. I should make it save as a JSON at some point in case people want to create programs other than python to play from savegames.

gamestate['metadata']

This contains metadata about the game, what parameters was used to feed the Perlin Noise generator, size of the map, rounds etc

  • width - width of the map
  • height - height of the map
  • coast_percentage - the percentage of cities that are coastal cities
  • scale
  • base
  • octaves
  • persistence
  • lucnarity
  • xoffset
  • yoffset
  • turn - who's turn it is, either AI or player
  • round - int

gamestate['terrain']

This contains the blueprint of the terrain. It is a two dimensional array with either the one of the following values:

  • l Land
  • w Water
  • c City

gamestate['coast']

A list of positions that are costs. Used for city placement. May be useful later on.

gamestate['cities']

List of cities, per city it stores the following:

  • location x/y coordinate
  • side Either player or ai
  • order What its building or doing
  • stage How far it is doing this

gamestate['units']

List of units, per unit it stores the following:

  • type The unit-type, army, fighter etc
  • side Either player or ai
  • location x/y coordinate
  • order Standing order for the units (sentry, waypoint)
  • stage a counter or x/y coordinate
  • moves How many moves are left
  • hits How many hits are left

gamestate['fog']

A map with the Fog of War. Not sure about what has been explored or what is still fog.

reconquering-empyre's People

Contributors

glowiexyz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.