Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ LIBS = -lncurses
# You shouldn't have to modify anything below this line.

# There's a dynamic format in the object-display routines; suppress the warning
CFLAGS = $(DEBUG) $(PROFILE) -Wall -Wno-format-security
CFLAGS = $(DEBUG) $(PROFILE) -Wall -Wno-format-security -fcommon

FILES = \
attack.c \
Expand Down Expand Up @@ -111,7 +111,7 @@ uninstall:

clean:
rm -f *.o TAGS vms-empire
rm -f *.6 *.html
rm -f *.html

clobber: clean
rm -f vms-empire vms-empire-*.tar*
Expand Down
19 changes: 0 additions & 19 deletions README

This file was deleted.

129 changes: 129 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# VMS Empire

VMS Empire is a classic turn-based strategy game played in a text terminal. Units, cities, land, and water are represented using letters and ASCII characters.

This fork includes small compatibility fixes that allow the game to compile cleanly on modern Linux systems, including Raspberry Pi OS.

## Changes in this fork

* Added the GCC `-fcommon` compiler option to fix multiple-definition linker errors on modern GCC versions.
* Corrected two map-array loops in `game.c`.
* Changed:

In line 126
```c
i <= MAP_SIZE
```

to:

```c
i < MAP_SIZE
```

This prevents the loops from accessing one element beyond the end of the arrays.

## Requirements

Install the compiler, development tools, Git, and ncurses library:

```bash
sudo apt update
sudo apt install -y git build-essential libncurses-dev
```

## Download

Clone this fork:

```bash
git clone https://github.com/dgdimick/empire.git
cd empire
```

## Build

Compile the game:

```bash
make
```

The executable will be created as:

```text
vms-empire
```

## Run

Start the game with:

```bash
./vms-empire
```

## Clean and rebuild

To remove compiled files and rebuild from scratch:

```bash
make clean
make
```

## Repository remotes

This fork is maintained at:

```text
https://github.com/dgdimick/empire
```

The original repository is:

```text
https://github.com/slacy/empire
```

## Platform tested

The changes in this fork were tested on Raspberry Pi OS using a Raspberry Pi.

## License

This fork retains the original project’s licensing and copyright terms. See the repository files for the original license information.



AI vs AI spectator mode
-----------------------

This fork adds an unattended spectator mode where the existing computer
player controls both empires. Start it with:

./vms-empire -a

Use the existing -d option to set the delay in milliseconds between map
updates. For example:

./vms-empire -a -d 500

The full battlefield is shown using the condensed map display. The USER-side AI
is shown in blue and the COMP-side AI is shown in red on color terminals. Press Ctrl-C
to stop an active game. At the end of a game, press any key to exit.


AI spectator views
------------------
Start an AI-versus-AI match in one of four views:

```bash
./vms-empire -a -v blue
./vms-empire -a -v red
./vms-empire -a -v shared
./vms-empire -a -v full

If -v is omitted, shared fog-of-war is used. During a match, press B, R,
S, or F to switch immediately between Blue, Red, Shared, and Full views.
These display modes do not alter either AI's private fog-of-war map.
3 changes: 2 additions & 1 deletion compmove.c
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,8 @@ void check_endgame(void) {

for (p = comp_obj[ARMY]; p != NULL; p = p->piece_link.next) ncomp_army++;

if (ncomp_city < nuser_city / 3 && ncomp_army < nuser_army / 3) {
if (!ai_vs_ai && ncomp_city < nuser_city / 3 &&
ncomp_army < nuser_army / 3) {
clear_screen();
prompt("The computer acknowledges defeat. Do");
ksend("The computer acknowledges defeat.");
Expand Down
23 changes: 23 additions & 0 deletions display.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,9 @@ void print_zoom_cell(view_map_t *vmap, int row, int col, int row_inc,
int col_inc) {
int r, c;
char cell;
#ifdef A_COLOR
chtype attr = COLOR_PAIR(COLOR_WHITE);
#endif

cell = ' ';
for (r = row; r < row + row_inc; r++)
Expand All @@ -438,8 +441,28 @@ void print_zoom_cell(view_map_t *vmap, int row, int col, int row_inc,
strchr(zoom_list, cell))
cell = vmap[row_col_loc(r, c)].contents;

#ifdef A_COLOR
if (ai_vs_ai) {
/* In spectator mode, USER is the Blue AI and COMP is the Red AI. */
if (cell == 'O' || strchr("TCBSDPFAZ", cell) != NULL)
attr = COLOR_PAIR(COLOR_BLUE) | A_BOLD;
else if (cell == 'X' || strchr("tcbsdpafz", cell) != NULL)
attr = COLOR_PAIR(COLOR_RED) | A_BOLD;
else if (cell == MAP_LAND || cell == '+')
attr = COLOR_PAIR(COLOR_GREEN);
else if (cell == MAP_SEA || cell == '.')
attr = COLOR_PAIR(COLOR_CYAN);
}
attron(attr);
#endif

(void)move(row / row_inc + NUMTOPS, col / col_inc);
(void)addch((chtype)cell);

#ifdef A_COLOR
attroff(attr);
attron(COLOR_PAIR(COLOR_WHITE));
#endif
}

/*
Expand Down
Loading