Skip to content

Commit

Permalink
Merge pull request #73 from BarthPaleologue/NextRelease
Browse files Browse the repository at this point in the history
Move back stable development branch into main
  • Loading branch information
BarthPaleologue authored Apr 19, 2024
2 parents 0557601 + e99eb14 commit f1ca3d7
Show file tree
Hide file tree
Showing 108 changed files with 2,693 additions and 1,699 deletions.
122 changes: 122 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
module.exports = {
"env": {
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": "./tsconfig.json",
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"import/no-cycle": "error",
"import/no-unresolved": "warn",
"@typescript-eslint/switch-exhaustiveness-check": "error",
"@typescript-eslint/no-inferrable-types": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"@typescript-eslint/no-explicit-any": "warn",
"eqeqeq": "error",
"no-restricted-syntax": [
"error",
{
"selector": "TSEnumDeclaration:not([const=true])",
"message": "Don't declare non-const enums"
}
],
"@typescript-eslint/naming-convention": [
"error",
{
"selector": "enumMember",
"format": [
"UPPER_CASE"
]
},
{
"selector": "memberLike",
"modifiers": [
"public",
"static"
],
"format": [
"PascalCase",
"UPPER_CASE"
],
"leadingUnderscore": "forbid"
},
{
"selector": "memberLike",
"modifiers": [
"private",
"static"
],
"format": [
"PascalCase",
"UPPER_CASE"
],
"leadingUnderscore": "forbid"
},
{
"selector": "typeLike",
"format": [
"PascalCase"
]
},
{
"selector": "variable",
"modifiers": [
"exported",
"const",
"global"
],
"format": [
"PascalCase"
],
"leadingUnderscore": "forbid"
},
{
"selector": "function",
"format": [
"camelCase",
"snake_case"
],
"leadingUnderscore": "forbid"
},
{
"selector": "function",
"modifiers": [
"exported",
"global"
],
"format": [
"camelCase"
],
"leadingUnderscore": "forbid"
},
{
"selector": "interface",
"format": [
"PascalCase"
],
"leadingUnderscore": "forbid"
},
{
"selector": "class",
"format": [
"PascalCase"
],
"leadingUnderscore": "forbid"
}
]
}
};
71 changes: 0 additions & 71 deletions .eslintrc.json

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/eslint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main", "NextRelease", "PatchCurrentRelease" ]
branches: [ "main" ]
jobs:
eslint:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main", "NextRelease", "PatchCurrentRelease" ]
branches: [ "main" ]
jobs:
jest:
runs-on: ubuntu-latest
Expand Down
24 changes: 18 additions & 6 deletions src/ts/architecture/Readme.md → ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
# Architecture of interface spanning from simple Transforms to complex Celestial bodies and Space stations:
# Cosmos Journeyer's Architecture

![img.png](img.png)
Cosmos Journeyer is designed with a clear separation of concerns in mind. If you are willing to contribute, this document will give you a good idea of where everything is and how it is organized.

This folder contains all the abstraction necessary to the architecture of the image.
## General architecture

This means all the node except the leaves (upper nodes) which are the actual concrete implementation of celestial bodies and space stations.
The following diagram is not an inheritance diagram, but a composition diagram. Each arrow represents an "is part of" relationship.

It all starts with simple `Transformable` and `BoundingSphere`:
For example, planets are part of the celestial bodies.

![Cosmos Journeyer's Architecture Diagram](coverImages/architecture_diagram.png)

## Orbital Object's interfaces relations

Even though you could argue the existence of an "is a" relationship between `CelestialBody` and `OrbitalObject`, I chose to avoid class inheritance for flexibility.

This means that in the previous diagram, in the `Orbital Objects` tree, are only classes the concrete types: `Star`, `BlackHole`, `NeutronStar`, `TelluricPlanet`, `GasPlanet`, and `SpaceStation`. The rest is only interfaces:

![Orbital Object's interfaces relations](coverImages/orbitalObjectsInterfaces.png)

It all starts with simple `Transformable` and `BoundingSphere`:
those are simple objects that possess a BaylonJS `TransformNode` for their position, rotation, scaling and a bounding volume to make simple calculations for distances.

An `OrbitalObject` builds on top of this by adding the notion of orbit. They possess `OrbitProperties` that describes their motion around their `parent` which can be null in the case of some objects (think like stars).
Expand All @@ -17,7 +29,7 @@ To sum up, an `OrbitalObject` is an object that can rotate around another `Orbit

`CelestialBody` builds up on top of `OrbitalObject` by adding the notion of `BODY_TYPE` and `radius` that is expected from spherical objects.

`CelestialBody` are spherical orbital objects that encompasses both planets and stellar objects.
`CelestialBody` are spherical orbital objects that encompasses both planets and stellar objects.
They can have specific post-processes applied to them (like atmosphere, clouds, rings...), which is why they also implement `HasPostProcesses`.

`StellarObject` builds on top of `CelestialBody` by adding a `PointLight` that is used to light up the scene. They also have a `STELLAR_TYPE` that describes their type (star, black hole, neutron star).
Expand Down
58 changes: 29 additions & 29 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,49 +16,49 @@ If you have an idea for a new feature, please open an issue on the [issue tracke

Pull requests are welcome! If you want to contribute code, please follow these steps:

1. Fork the repository
2. Create a new branch
3. Make your changes
4. Commit your changes
5. Push your changes
6. Open a pull request
1. Get familiar with the project by reading the [architecture document](ARCHITECTURE.md)
2. Fork the repository
3. Create a new branch from the `main` branch:
```sh
git checkout -b [name_of_your_new_branch]
```
4. Commit & push your changes
5. Open a pull request to the `main` branch

You can open a draft pull request if you want to get feedback on your changes before they are ready to be merged.

Pull request are tested against the linter and the unit tests, make sure you run them before opening a pull request.

Code that does not pass the linter or the unit tests will not be merged.
Code that does not pass the linter or the unit tests will not be merged, but I will help you fix it don't worry.

## Contribution ideas
## Translation

Cosmos Journeyer is available in multiple languages, but you can add more or improve existing translations.

There is still plenty to do on Cosmos Journeyer. Here are some ideas of contributions you can make (with stars indicating the difficulty of the task):
### Modifying existing language

### Visuals
To make a change in an existing language, go to `src/locales` and find the language you want to modify by its code.
For example if you want to modify the American English translation, you will find the `en-us` folder.
Inside this folder are many JSON files containing the various words and sentences used throughout the project.

- Improve the visuals of Neutron Stars to make the cone of the matter jets less visible (⭐⭐)
- Improve the visuals of Gas Giants to make them look better from closer (⭐⭐)
- Improve the visuals of the ocean using a separate mesh and FFT for wave generation (⭐⭐⭐)
- Experiment with volumetric clouds (⭐⭐⭐)
Make the changes you want by editing the files and then open a pull request. If you don't have/don't want to create a GitHub account, you can email the files at
[barth.paleologue@cosmosjourneyer.com](mailto:barth.paleologue@cosmosjourneyer.com). In any case you will be credited for your work.

### On-foot exploration
### Adding a new language

- Add new character animations (using Mixamo for example) (⭐)
- Make the character animation system more scalable (⭐⭐⭐)
- Add conditions to asset scattering to avoid grass in desert and at the bottom of the ocean (⭐⭐)
Adding a new language altogether is quite straightforward as well. Simply go to the `src/locales` folder and create a new folder with the language code you want to create.
Then, paste inside the content of another language directory and translate the content inside the JSON files.

### Space gameplay
You don't need to code at all, the language will be automatically bundled and available inside Cosmos Journeyer.

- Add a cockpit view for spaceships (⭐⭐⭐)
- Add new spaceships and space stations (⭐⭐⭐)
- Add lasers to spaceships (⭐⭐)
- Add trade missions at space stations (⭐⭐⭐)
To test your changes, simply run the project using `npm run serve` and change the url in this format:

### Optimization
```
http://localhost:8080/?lang=fr-FR
```

- Optimize the volumetric atmosphere rendering (⭐⭐⭐)
- Optimize the lens flare rendering (⭐⭐)
You only need to replace `fr-FR` with the language code you want to test.

### Miscellaneous
## Contribution ideas

- Improve WebGPU support (⭐⭐⭐)
- Improve the documentation (⭐)
There is still plenty to do on Cosmos Journeyer. You can check the [issue tracker](https://github.com/BarthPaleologue/CosmosJourneyer/issues) for ideas on what to work on.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ The main deployment of the procedural universe can be accessed https://barthpale

The documentation is online at https://barthpaleologue.github.io/CosmosJourneyer/docs/

Additionally, the [ARCHITECTURE.md](./ARCHITECTURE.md) file contains a big picture explanation of the architecture of the project.

To build it locally, run `npm run docs` and then `npm run serve:docs` to serve it at `localhost:8081`.

## Contributing
Expand All @@ -28,6 +30,10 @@ If you want to contribute, you will find guidelines and ideas [here](./CONTRIBUT

## Sponsor

Developing Cosmos Journeyer is time-consuming and generates no revenue since it is free and open-source.

If you like the project, please consider sponsoring it on [Patreon](https://www.patreon.com/barthpaleologue) or [GitHub Sponsors](

The project has a ko-fi page at https://ko-fi.com/cosmosjourneyer if you feel like sponsoring the project!

## Features
Expand Down
Binary file added coverImages/architecture_diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file modified coverImages/video.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit f1ca3d7

Please sign in to comment.