Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
chrxh committed Aug 17, 2024
2 parents 498ab79 + 7950865 commit 46b7fe1
Show file tree
Hide file tree
Showing 118 changed files with 4,778 additions and 1,233 deletions.
31 changes: 26 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<a href="https://alien-project.org" target="_blank">ALIEN - Explore worlds of artificial life</a>
</h1>

![image](https://github.com/chrxh/alien/assets/73127001/169b4be7-d70e-4e0e-8bf7-7a4d72d29868)
![Preview](https://github.com/user-attachments/assets/ee578848-7dd7-458d-873f-89662a7c15f0)

<p>
<b><i>A</i></b>rtificial <b><i>LI</i></b>fe <b><i>EN</i></b>vironment <b>(ALIEN)</b> is an artificial life simulation tool based on a specialized 2D particle engine in CUDA for soft bodies and fluids. Each simulated body consists of a network of particles that can be upgraded with higher-level functions, ranging from pure information processing capabilities to physical equipment (such as sensors, muscles, weapons, constructors, etc.) whose executions are orchestrated by neural networks. The bodies can be thought of as agents or digital organisms operating in a common environment. Their blueprints can be stored in genomes and passed on to offspring.
Expand All @@ -17,6 +17,10 @@ An important goal is to make the simulator user-friendly through a modern user i
Please join our <a href="https://discord.gg/7bjyZdXXQ2" target="_blank">Discord server</a> as a place for discussions, new developments and feedback around ALIEN and artificial life in general.
</p>

<p>
Demo video: <a href="https://youtu.be/qwbMGPkoJmg" target="_blank">Emerging Ecosystems | Winner of the ALIFE 2024 Virtual Creatures Competition</a>
</p>

# ⚡ Main features
### Physics and graphics engine
- Particles for simulating soft and rigid body mechanics, fluids, heat dissipation, damage, adhesion etc.
Expand Down Expand Up @@ -67,9 +71,9 @@ Further information and artwork:
An Nvidia graphics card with compute capability 6.0 or higher is needed. Please check [https://en.wikipedia.org/wiki/CUDA#GPUs_supported](https://en.wikipedia.org/wiki/CUDA#GPUs_supported).

# 💽 Installer
Installer for Windows: [alien-installer.msi](https://alien-project.org/media/files/alien-installer.msi) (Updated: 2024-04-22)
Installer for Windows: [alien-installer.msi](https://alien-project.org/media/files/alien-installer.msi) (updated: 2024-04-26)

In the case that the program crashes for an unknown reason, please refer to the troubleshooting section in [alien-project.org/downloads.html](https://alien-project.org/downloads.html).
In the case that the program crashes for an unknown reason, please refer to the troubleshooting section below.

# 🔨 How to build the sources
The build process is mostly automated using the cross-platform CMake build system and the vcpkg package manager, which is included as a Git submodule.
Expand All @@ -82,8 +86,7 @@ git clone --recursive https://github.com/chrxh/alien.git
Note: The `--recursive` parameter is necessary to check out the vcpkg submodule as well. Besides that, submodules are not normally updated by the standard `git pull` command. Instead, you need to write `git pull --recurse-submodules`.

### Build instructions
Prerequisites: [CUDA Toolkit 11.2+](https://developer.nvidia.com/cuda-downloads) and a toolchain for CMake (e.g. GCC 9.x+ or [MSVC v142+](https://visualstudio.microsoft.com/de/free-developer-offers/)).
There are reported compile issues with GCC 13 at the moment. Please use GCC 12 instead if you intend to use GCC.
Prerequisites: [CUDA Toolkit 11.2+](https://developer.nvidia.com/cuda-downloads) and a toolchain for CMake (e.g. GCC 9.x+ or [MSVC v142+](https://visualstudio.microsoft.com/vs/)).

Build steps:
```
Expand All @@ -94,6 +97,11 @@ cmake --build . --config Release -j8
If everything goes well, the ALIEN executable can be found under the build directory in `./alien` or `.\Release\alien.exe` depending on the used toolchain and platform.
It is important to start ALIEN directly from the build folder, otherwise it will not find the resource folder.

There are reported build issues with (updated: 2024-06-22)
* GCC 13 (version 11 should work)
* Visual Studio 17.10 (version 17.9 should work)
* CUDA 12.5 (version 12.4 should work)

# ⌨️ Command-line interface

This repository also contains a CLI for ALIEN. It can be used to run simulations without using a GUI. This is useful for performance measurements as well as for automatic execution and evaluation of simulations for different parameters.
Expand All @@ -104,6 +112,19 @@ For example,
```
runs the simulation file `example.sim` for 1000 time steps.

# 🔎 Troubleshooting

Please make sure that:
1) You have an NVIDIA graphics card with compute capability 6.0 or higher (for example GeForce 10 series).
2) You have the latest NVIDIA graphics driver installed.
3) The name of the installation directory (including the parent directories) should not contain non-English characters. If this is not fulfilled, please re-install ALIEN to a suitable directory. Do not move the files manually. If you use Windows, make also sure that you install ALIEN with a Windows user that contains no non-English characters. If this is not the case, a new Windows user could be created to solve this problem.
4) ALIEN needs write access to its own directory. This should normally be the case.
5) If you have multiple graphics cards, please check that your primary monitor is connected to the CUDA-powered card. ALIEN uses the same graphics card for computation as well as rendering and chooses the one with the highest compute capability.
6) If you possess both integrated and dedicated graphics cards, please ensure that the alien-executable is configured to use your high-performance graphics card. On Windows you need to access the 'Graphics settings,' add 'alien.exe' to the list, click 'Options,' and choose 'High performance'.

If these conditions are not met, ALIEN may crash unexpectedly.
If the conditions are met and the error still occurs, please start ALIEN with the command line parameter `-d`, try to reproduce the error and then create a GitHub issue on https://github.com/chrxh/alien/issues where the log.txt is attached.

# 🌌 Screenshots
#### Different plant-like populations around a radiation source
![Screenshot1](https://user-images.githubusercontent.com/73127001/229311601-839649a6-c60c-4723-99b3-26086e3e4340.jpg)
Expand Down
29 changes: 29 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
# Release notes

## [4.10.0] - 2024-08-17
### Added
- engine: sensor and reconnector cells can be restricted to only sensing/connecting to certain type of mutants (same, other, nutrient, handcrafted, less and more complex)
- engine: sensor cells can tag detected cells for attacking if parameter 'Sensor detection factor' is above 0
- engine: sensors can not penetrate handcrafted structures when restricting to scanning for certain mutants
- engine: possibility to force muscle cells to obtain movement angles from nearby sensors (+ simulation parameter under addon 'Advanced muscle control')
- engine: possibility to redefine max age of permanently inactive or of emergent cells (+ simulation parameters under addon 'Cell age limiter')
- engine: possibility to reset age after cell switches from 'Under construction' to 'Ready' (+ simulation parameter under addon 'Cell age limiter')
- engine: allow to disable radiation sources in spots
- gui/statistics: diversity and average genome complexity plots added
- gui/statistics: thoughtput statistics
- gui/simulation view: attack visualization (+ simulation parameter)
- gui/simulation view: cell glow (+ simulation parameter under new addon 'Cell glow')
- gui/simulation view: configurable cell radius via simulation parameter
- gui/mass operation, engine: mass operation for randomizing mutation ids

### Changed
- engine: replace continuous mutation rates (which are applied in each time step) by genome copy mutations (which are only applied when genomes are copied)
- engine: make certain mutation rates (all except for translation, duplication and color mutations) dependent on the genome size
- engine: avoid that creature is able to eat its offspring when it is currently under construction
- engine: parameters 'Cell max force' and 'Maximum distance' are now color-dependent

### Fixed
- gui/simulation view: visibility of cells with low energy increased
- gui/browser: apply text filter to all workspaces and resource types
- serialization: load/save real-time counter in autosave
- engine: avoid genome bloating (with separated parts) due to mutations
- engine: incorrect construction processes based on single cell genomes with multiple branches and/or repetitions fixed

## [4.9.1] - 2024-04-26
### Added
- gui/browser: label new simulations
Expand Down
4 changes: 2 additions & 2 deletions imgui.ini
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,8 @@ Size=362,113
Collapsed=0

[Window][Mass operations]
Pos=750,236
Size=420,536
Pos=751,206
Size=417,605
Collapsed=0

[Window][Radiation sources]
Expand Down
7 changes: 6 additions & 1 deletion scripts/Server/replacesimulation.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ function closeAndExit($db) {
$settings = $_POST['settings'];
$simId = $_POST['simId'];
$size = strlen($content);
$userId = $obj->id;
$statistics = array_key_exists('statistics', $_POST) ? $_POST['statistics'] : "";

$obj = $db->query("SELECT sim.NAME as name, sim.TYPE as type, sim.FROM_RELEASE as workspace FROM simulation sim WHERE sim.ID='".addslashes($simId)."'")->fetch_object();
$obj = $db->query("SELECT sim.NAME as name, sim.TYPE as type, sim.FROM_RELEASE as workspace, sim.USER_ID as userId FROM simulation sim WHERE sim.ID='".addslashes($simId)."'")->fetch_object();
if (!$obj) {
closeAndExit($db);
}
Expand All @@ -44,6 +45,10 @@ function closeAndExit($db) {
closeAndExit($db);
}

if ($obj->userId != $userId) {
closeAndExit($db);
}

$stmt = $db->prepare("UPDATE simulation SET PARTICLES=?, VERSION=?, CONTENT=?, WIDTH=?, HEIGHT=?, SETTINGS=?, SIZE=?, STATISTICS=?, CONTENT2=?, CONTENT3=?, CONTENT4=?, CONTENT5=?, CONTENT6=? WHERE ID=?");
if (!$stmt) {
closeAndExit($db);
Expand Down
6 changes: 6 additions & 0 deletions source/Base/Definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ inline int toInt(T const& value)
return static_cast<int>(value);
}

template <typename T>
inline uint8_t toUInt8(T const& value)
{
return static_cast<uint8_t>(value);
}

#define THROW_NOT_IMPLEMENTED() throw std::runtime_error("not implemented")

#define CHECK(expression) \
Expand Down
2 changes: 1 addition & 1 deletion source/Base/Resources.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Const
{
std::string const ProgramVersion = "4.9.1";
std::string const ProgramVersion = "4.10.0";
std::string const DiscordURL = "https://discord.gg/7bjyZdXXQ2";

std::string const BasePath = "resources/";
Expand Down
11 changes: 2 additions & 9 deletions source/Base/StringHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ std::string StringHelper::format(float v, int fracPartDecimals)

std::string StringHelper::format(std::chrono::milliseconds duration)
{
if (duration.count() == 0) {
return "0";
}
auto months = std::chrono::duration_cast<std::chrono::months>(duration);
duration -= months;
auto days = std::chrono::duration_cast<std::chrono::days>(duration);
Expand All @@ -66,12 +63,8 @@ std::string StringHelper::format(std::chrono::milliseconds duration)
if (hours.count() > 0 || days.count() > 0 || months.count() > 0) {
oss << std::setw(2) << std::setfill('0') << hours.count() << ":";
}
if (minutes.count() > 0 || hours.count() > 0 || days.count() > 0 || months.count() > 0) {
oss << std::setw(2) << std::setfill('0') << minutes.count() << ":";
}
if (seconds.count() > 0 || minutes.count() > 0 || hours.count() > 0 || days.count() > 0 || months.count() > 0) {
oss << std::setw(2) << std::setfill('0') << seconds.count() << ":";
}
oss << std::setw(2) << std::setfill('0') << minutes.count() << ":";
oss << std::setw(2) << std::setfill('0') << seconds.count() << ".";
oss << std::setw(3) << std::setfill('0') << duration.count();

return oss.str();
Expand Down
30 changes: 30 additions & 0 deletions source/EngineGpuKernels/ActiveRadiationSources.cuh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include "Base.cuh"
#include "CudaMemoryManager.cuh"

class ActiveRadiationSources
{
public:
__host__ __inline__ void init()
{
CudaMemoryManager::getInstance().acquireMemory<int>(1, _numActiveSources);
CudaMemoryManager::getInstance().acquireMemory<int>(MAX_RADIATION_SOURCES, _activeSources);
}

__host__ __inline__ void free()
{
CudaMemoryManager::getInstance().freeMemory(_numActiveSources);
CudaMemoryManager::getInstance().freeMemory(_activeSources);
}

__device__ __inline__ int getNumActiveSources() const { return *_numActiveSources; }
__device__ __inline__ void setNumActiveSources(int value) { *_numActiveSources = value; }

__device__ __inline__ int getActiveSource(int i) const { return _activeSources[i]; }
__device__ __inline__ void setActiveSource(int i, int value) { _activeSources[i] = value; }

private:
int* _numActiveSources;
int* _activeSources;
};
Loading

0 comments on commit 46b7fe1

Please sign in to comment.