Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
c51d2fc
update client
actions-user Jul 7, 2021
4ed3ecb
update client
actions-user Jul 9, 2021
2165660
update client
actions-user Jul 9, 2021
7445553
update client
actions-user Jul 9, 2021
304f40a
update client
actions-user Jul 15, 2021
a7c0bba
update client
actions-user Jul 15, 2021
fb9b413
update client
actions-user Jul 15, 2021
bcf877a
update client
actions-user Jul 15, 2021
93e24f1
update client
actions-user Jul 27, 2021
f1b00fa
update client
actions-user Jul 27, 2021
5c9fb5a
update client
actions-user Jul 28, 2021
32c9945
update client
actions-user Aug 10, 2021
2018eb5
update client
actions-user Aug 12, 2021
a332073
update client
actions-user Aug 12, 2021
b75476f
update client
actions-user Aug 12, 2021
7d39894
update client
actions-user Aug 12, 2021
a11dd59
update client
actions-user Aug 12, 2021
7aef22d
update client
actions-user Aug 13, 2021
a218fb4
update client
actions-user Aug 13, 2021
95bca36
update client
actions-user Aug 13, 2021
00492e0
update client
actions-user Aug 14, 2021
4e44d93
update client
actions-user Aug 16, 2021
8b35e51
update client
actions-user Aug 16, 2021
eefdf95
update client
actions-user Aug 16, 2021
40e3f27
update client
actions-user Aug 18, 2021
2d1c968
update client
actions-user Sep 19, 2021
e9fecab
update client
actions-user Sep 28, 2021
2d991c1
update client
actions-user Sep 28, 2021
e4dff68
update client
actions-user Sep 30, 2021
2322ef1
update client
actions-user Sep 30, 2021
23e475c
update client
actions-user Sep 30, 2021
db10c5f
update client
actions-user Sep 30, 2021
af87825
update client
actions-user Oct 1, 2021
7eaac9e
update client
actions-user Oct 1, 2021
8471fe1
update client
actions-user Oct 1, 2021
5af3ca0
update client
actions-user Oct 1, 2021
da9011b
update client
actions-user Oct 1, 2021
2ada70c
update client
actions-user Oct 2, 2021
3d216fa
update client
actions-user Oct 21, 2021
a06020f
update client
actions-user Nov 23, 2021
dca7d34
update client
actions-user Dec 4, 2021
5cee86a
update client
actions-user Jan 31, 2022
0655f01
update client
github-actions[bot] Feb 13, 2022
5c8ab8e
update client
github-actions[bot] Feb 19, 2022
ad7659b
update client
github-actions[bot] Feb 19, 2022
0311cef
update client
github-actions[bot] Feb 19, 2022
619c275
update client
github-actions[bot] Feb 26, 2022
3f7a593
update client
github-actions[bot] Feb 28, 2022
bf80562
update client
github-actions[bot] Feb 28, 2022
b65bfe2
update client
github-actions[bot] Mar 1, 2022
493259b
update client
github-actions[bot] Mar 1, 2022
54cfeb0
update client
github-actions[bot] Mar 2, 2022
e2f50b5
update client
github-actions[bot] Mar 18, 2022
fe0e623
update client
github-actions[bot] Mar 23, 2022
c03dce9
update client
github-actions[bot] Mar 23, 2022
618bab9
update client
github-actions[bot] Mar 25, 2022
b7a81b4
update client
github-actions[bot] Apr 1, 2022
880776d
update client
github-actions[bot] Apr 1, 2022
259a36e
update client
github-actions[bot] Apr 2, 2022
ac06c97
update client
github-actions[bot] Apr 7, 2022
2927dce
update client
github-actions[bot] Apr 7, 2022
1a5cd21
update client
github-actions[bot] Apr 7, 2022
78dd740
update client
github-actions[bot] Apr 8, 2022
c78872c
update client
github-actions[bot] Apr 9, 2022
dbde2e5
update client
github-actions[bot] Apr 9, 2022
ece39b7
update client
github-actions[bot] Apr 10, 2022
42d7603
update client
github-actions[bot] Apr 11, 2022
009e643
update client
github-actions[bot] Apr 11, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react",
[
"@babel/preset-typescript",
{
"optimizeConstEnums": true
}
]
],
"plugins": ["babel-plugin-styled-components"]
}
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
NODE_ENV=development
# This defaults to localhost in development regardless of the value set in this file
DEFAULT_RPC=https://rpc-df.xdaichain.com/
# Removing this value will disable all webserver calls in the client
DF_WEBSERVER_URL=http://localhost:3000
11 changes: 4 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,11 @@ yarn-error.log*
# local image files for testing
public/img/artifacts

# compiled contracts
public/contracts/*.json
!public/contracts/DarkForestCore.json
!public/contracts/DarkForestGetters.json
!public/contracts/Whitelist.json
!public/contracts/DarkForestGPTCredit.json

declarations
tsconfig.ref.tsbuildinfo

# Local Netlify folder
.netlify

# Environment variables
.env
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ embedded_plugins/dist/
public/
src/styles/font/
src/styles/icomoon/
embedded_plugins/Remote-Explorer.ts
embedded_plugins/Renderer-Showcase.ts
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

### Installing Core Dependencies

- Node (v14.15.x)
- Node (v14.x OR v16.x)
- Yarn (Javascript Package Manager)

#### Installing The Correct Node Version Using NVM

Dark Forest is built and tested using Node.js v14.15.x and might not run properly on other Node.js versions. We recommend using NVM to switch between multiple Node.js version on your machine.
Dark Forest is built and tested using Node.js v14/v16 and might not run properly on other Node.js versions. We recommend using NVM to switch between multiple Node.js version on your machine.

```sh
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
nvm install
```

After the installation is finished, you can run `node --version` to verify that you are running v14.15.x
After the installation is finished, you can run `node --version` to verify that you are running v14 or v16

#### Installing Yarn

Expand Down
458 changes: 197 additions & 261 deletions docs/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
# Class: CaptureZoneGenerator

[Backend/GameLogic/CaptureZoneGenerator](../modules/Backend_GameLogic_CaptureZoneGenerator.md).CaptureZoneGenerator

Given a game start block and a zone change block interval, decide when to generate new Capture Zones.

## Table of contents

### Constructors

- [constructor](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#constructor)

### Properties

- [capturablePlanets](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#capturableplanets)
- [changeInterval](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#changeinterval)
- [gameManager](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#gamemanager)
- [generated$](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#generated$)
- [lastChangeBlock](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#lastchangeblock)
- [nextChangeBlock](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#nextchangeblock)
- [zones](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#zones)

### Accessors

- [gameObjects](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#gameobjects)

### Methods

- [\_generate](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#_generate)
- [generate](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#generate)
- [getNextChangeBlock](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#getnextchangeblock)
- [getZones](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#getzones)
- [isInZone](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#isinzone)
- [onNewChunk](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#onnewchunk)
- [setNextGenerationBlock](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#setnextgenerationblock)
- [updateCapturablePlanets](Backend_GameLogic_CaptureZoneGenerator.CaptureZoneGenerator.md#updatecapturableplanets)

## Constructors

### constructor

• **new CaptureZoneGenerator**(`gameManager`, `gameStartBlock`, `changeInterval`)

#### Parameters

| Name | Type |
| :--------------- | :---------------------------------------------------- |
| `gameManager` | [`default`](Backend_GameLogic_GameManager.default.md) |
| `gameStartBlock` | `number` |
| `changeInterval` | `number` |

## Properties

### capturablePlanets

• `Private` **capturablePlanets**: `Set`<`LocationId`\>

---

### changeInterval

• `Private` **changeInterval**: `number`

---

### gameManager

• `Private` **gameManager**: [`default`](Backend_GameLogic_GameManager.default.md)

---

### generated$

• `Readonly` **generated$**: `Monomitter`<[`CaptureZonesGeneratedEvent`](../modules/Backend_GameLogic_CaptureZoneGenerator.md#capturezonesgeneratedevent)\>

---

### lastChangeBlock

• `Private` **lastChangeBlock**: `number`

---

### nextChangeBlock

• `Private` **nextChangeBlock**: `number`

---

### zones

• `Private` **zones**: `Set`<`CaptureZone`\>

## Accessors

### gameObjects

• `Private` `get` **gameObjects**(): [`GameObjects`](Backend_GameLogic_GameObjects.GameObjects.md)

#### Returns

[`GameObjects`](Backend_GameLogic_GameObjects.GameObjects.md)

## Methods

### \_generate

▸ `Private` **\_generate**(`blockNumber`): `Promise`<`Set`<`CaptureZone`\>\>

#### Parameters

| Name | Type |
| :------------ | :------- |
| `blockNumber` | `number` |

#### Returns

`Promise`<`Set`<`CaptureZone`\>\>

---

### generate

▸ **generate**(`blockNumber`): `Promise`<`void`\>

Call when a new block is received to check if generation is needed.

#### Parameters

| Name | Type | Description |
| :------------ | :------- | :-------------------- |
| `blockNumber` | `number` | Current block number. |

#### Returns

`Promise`<`void`\>

---

### getNextChangeBlock

▸ **getNextChangeBlock**(): `number`

The next block that will trigger a Capture Zone generation.

#### Returns

`number`

---

### getZones

▸ **getZones**(): `Set`<`CaptureZone`\>

#### Returns

`Set`<`CaptureZone`\>

---

### isInZone

▸ **isInZone**(`locationId`): `boolean`

Is the given planet inside of a Capture Zone.

#### Parameters

| Name | Type |
| :----------- | :----------- |
| `locationId` | `LocationId` |

#### Returns

`boolean`

---

### onNewChunk

▸ `Private` **onNewChunk**(`chunk`): `void`

#### Parameters

| Name | Type |
| :------ | :------ |
| `chunk` | `Chunk` |

#### Returns

`void`

---

### setNextGenerationBlock

▸ `Private` **setNextGenerationBlock**(`blockNumber`): `void`

#### Parameters

| Name | Type |
| :------------ | :------- |
| `blockNumber` | `number` |

#### Returns

`void`

---

### updateCapturablePlanets

▸ `Private` **updateCapturablePlanets**(): `void`

#### Returns

`void`
Loading