Web version

The Ancient Empires game series is available as web applications.

The source code is downloadable from:

* Original source repository (Archive)
* Backup repository (Archive)

This page describes the methods to run the code in web browser.

# Original repository
git clone https://github.com/webbestmaster/main.git

```
 or
```
# Backup repository
git clone https://github.com/ancient-empires/Android-web-backup.git

```

### Google Chrome web browser

1. Download the Google Chrome browser. This is required to run the Web SQL database functionalities, which are used to save the game progress locally.
2. Install the User-Agent Switcher and Manager addon in Google Chrome.

### Node.js

1. Download Node.js. This includes the following command-line utilities: `node`, `npx`, and `npm`.
2. Install the http-server package in `npm`:
```
npm install -g http-server

```

## Running the games

1. Open a terminal window.
2. Change to the corresponding directory.
	* If you have cloned the Original source repository (Archive), then change directory to:
		+ AE1: `<repository root>/AncientOfEmpires/www`
		+ AE2: `<repository root>/AE2/www`
	* If you have cloned the Backup repository (Archive), then change directory to:
		+ AE1: `<repository root>/AE1/www`
		+ AE2: `<repository root>/AE2/www`
3. Start the server:
```
npx http-server -c-1
```

	* Use `-c-1` to disable caching. Hence if you start the local server again inside any other directories, it will not accidentally load the previous web application.
4. After starting the server you will see some output messages like this (your actual available IP addresses and ports may be different):
```
Starting up http-server, serving ./
Available on:
  http://127.0.0.1:8080
  http://100.65.20.32:8080
  http://100.65.20.12:8080
  http://192.168.250.1:8080
Hit CTRL-C to stop the server
```
 Now make a copy of one of these IP addresses, to be used later. For example: `http://127.0.0.1:8080`.
	* The local IP addresses and ports are automatically assigned by the OS based on their availability.
	* **Each pair of `address:port` has its own sets of data storage which are not shared with each other. Hence, you should use a consistent `address:port` pair to save and load your game progress.** More details are available in the #Web SQL storage section.
5. Open Google Chrome browser.
6. Open the User-Agent Switcher and Manager addon, and pick one user agent that has **Chrome** as the browser and **Android** as the platform.
7. Paste your previously copied local server address into the address bar, and hit `Enter`.
8. The game should now start loading.AE1 running in Google ChromeAE2 running in Google Chrome

## Data storage

The web version uses localStorage and Web SQL database to store user progress data. More detailed descriptions can be found in Web version/Data storage.

**Note:** Android and iOS versions also use the same data format to store user data.

## Notes

1. ↑ Web SQL browser support
2. ↑ Chrome 4 Now Supports the HTML 5 Web SQL Database API (Archive)
3. ↑ **The Web SQL is a deprecated technology and no longer receives feature updates or maintenance. It might or might not be supported by browsers in the future.** For more information of the specification, visit W3C Working Group website.