From 734ef167f93050b73b47ce61106d37e501a3b171 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sat, 25 Nov 2023 23:53:28 +0100 Subject: [PATCH 1/5] label renamed --- source/Gui/SimulationParametersWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/Gui/SimulationParametersWindow.cpp b/source/Gui/SimulationParametersWindow.cpp index b478c1193..73e55bb03 100644 --- a/source/Gui/SimulationParametersWindow.cpp +++ b/source/Gui/SimulationParametersWindow.cpp @@ -1180,7 +1180,7 @@ void _SimulationParametersWindow::processBase( if (ImGui::TreeNodeEx("External energy source", treeNodeOpenFlags)) { AlienImGui::SliderFloat( AlienImGui::SliderFloatParameters() - .name("External energy for constructors") + .name("External energy amount") .textWidth(RightColumnWidth) .colorDependence(true) .min(0.0f) From f3fddfeb3d8197aabb4265086c12814e53177d17 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Sun, 26 Nov 2023 17:50:09 +0100 Subject: [PATCH 2/5] restore snapshot also restores max ages if balancer is active --- source/Gui/TemporalControlWindow.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/Gui/TemporalControlWindow.cpp b/source/Gui/TemporalControlWindow.cpp index 99e489609..11c12bc69 100644 --- a/source/Gui/TemporalControlWindow.cpp +++ b/source/Gui/TemporalControlWindow.cpp @@ -205,6 +205,11 @@ void _TemporalControlWindow::applySnapshot(Snapshot const& snapshot) for (int i = 0; i < MAX_COLORS; ++i) { parameters.cellFunctionConstructorExternalEnergy[i] = origParameters.cellFunctionConstructorExternalEnergy[i]; } + if (parameters.cellMaxAgeBalancer || origParameters.cellMaxAgeBalancer) { + for (int i = 0; i < MAX_COLORS; ++i) { + parameters.cellMaxAge[i] = origParameters.cellMaxAge[i]; + } + } _simController->setCurrentTimestep(snapshot.timestep); _simController->setSimulationData(snapshot.data); _simController->setSimulationParameters(parameters); From 7cfee7f6425dfe61607e1392dce9f4815b52b377 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Tue, 28 Nov 2023 23:07:49 +0100 Subject: [PATCH 3/5] fixed insertion mutation error that led to undesirably high repetitions and made this mutation type more or less useless --- source/Base/Resources.h | 2 +- source/EngineGpuKernels/GenomeDecoder.cuh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/source/Base/Resources.h b/source/Base/Resources.h index 86ddb12e7..28f8419b8 100644 --- a/source/Base/Resources.h +++ b/source/Base/Resources.h @@ -2,7 +2,7 @@ namespace Const { - std::string const ProgramVersion = "4.4.2"; + std::string const ProgramVersion = "4.4.3"; std::string const DiscordLink = "https://discord.gg/7bjyZdXXQ2"; std::string const BasePath = "resources/"; diff --git a/source/EngineGpuKernels/GenomeDecoder.cuh b/source/EngineGpuKernels/GenomeDecoder.cuh index 8762ee7ee..bda47f607 100644 --- a/source/EngineGpuKernels/GenomeDecoder.cuh +++ b/source/EngineGpuKernels/GenomeDecoder.cuh @@ -462,6 +462,10 @@ __inline__ __device__ void GenomeDecoder::setRandomCellFunctionData( if (cellFunction == CellFunction_Constructor || cellFunction == CellFunction_Injector) { auto cellFunctionFixedBytes = cellFunction == CellFunction_Constructor ? Const::ConstructorFixedBytes : Const::InjectorFixedBytes; genome[nodeAddress + cellFunctionFixedBytes] = makeSelfCopy ? 1 : 0; + + auto subGenomeRelPos = getCellFunctionDataSize(cellFunction, makeSelfCopy, 0); + genome[nodeAddress + subGenomeRelPos + Const::GenomeHeaderNumRepetitionsPos] = 1; + if (!makeSelfCopy) { writeWord(genome, nodeAddress + cellFunctionFixedBytes + 1, subGenomeSize); } From 37f75dd44740669d4f0cf6fa165f273ded4b4c67 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Wed, 29 Nov 2023 20:54:48 +0100 Subject: [PATCH 4/5] + show text background when rendering is disabled + disable scrollbars when rendering is disabled --- RELEASE-NOTES.md | 7 ++ source/Gui/AlienImGui.cpp | 19 +++--- source/Gui/AlienImGui.h | 7 +- source/Gui/MainWindow.cpp | 11 +-- source/Gui/SimulationView.cpp | 112 ++++++++++++++++++++----------- source/Gui/SimulationView.h | 4 +- source/Gui/StartupController.cpp | 4 +- source/Gui/StyleRepository.h | 4 +- vcpkg.json | 2 +- 9 files changed, 104 insertions(+), 66 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 53ffa7fb1..0fdcfb6a2 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,12 @@ # Release notes +## [4.4.3] - 2023-11-29 +### Added +- show text background when rendering is disabled + +### Fixed +- fixed insertion mutation behavior that led to undesirably high repetitions and made this mutation type more or less useless + ## [4.4.2] - 2023-11-25 ### Added - external energy source, which is controllable by two new parameters diff --git a/source/Gui/AlienImGui.cpp b/source/Gui/AlienImGui.cpp index 93e282e9f..e6d5b1b6f 100644 --- a/source/Gui/AlienImGui.cpp +++ b/source/Gui/AlienImGui.cpp @@ -1671,9 +1671,9 @@ void AlienImGui::BasicInputColorMatrix(BasicInputColorMatrixParameters const& auto startPos = ImGui::GetCursorPos(); ImGui::SetCursorPos({startPos.x - scale(48), startPos.y + scale(105)}); - RotateStart(); + RotateStart(ImGui::GetWindowDrawList()); ImGui::Text("[host color]"); - RotateEnd(90.0f); + RotateEnd(90.0f, ImGui::GetWindowDrawList()); ImGui::SetCursorPos(startPos); @@ -1798,16 +1798,16 @@ void AlienImGui::BasicInputColorMatrix(BasicInputColorMatrixParameters const& //RotateStart, RotationCenter, etc. are taken from https://gist.github.com/carasuca/e72aacadcf6cf8139de46f97158f790f //>>>>>>>>>> -void AlienImGui::RotateStart() +void AlienImGui::RotateStart(ImDrawList* drawList) { - _rotationStartIndex = ImGui::GetWindowDrawList()->VtxBuffer.Size; + _rotationStartIndex = ImGui::GetBackgroundDrawList()->VtxBuffer.Size; } -ImVec2 AlienImGui::RotationCenter() +ImVec2 AlienImGui::RotationCenter(ImDrawList* drawList) { ImVec2 l(FLT_MAX, FLT_MAX), u(-FLT_MAX, -FLT_MAX); // bounds - const auto& buf = ImGui::GetWindowDrawList()->VtxBuffer; + const auto& buf = ImGui::GetBackgroundDrawList()->VtxBuffer; for (int i = _rotationStartIndex; i < buf.Size; i++) l = ImMin(l, buf[i].pos), u = ImMax(u, buf[i].pos); @@ -1822,17 +1822,18 @@ namespace } } -void AlienImGui::RotateEnd(float angle) +void AlienImGui::RotateEnd(float angle, ImDrawList* drawList) { - auto center = RotationCenter(); + auto center = RotationCenter(drawList); float s = sin((angle + 90.0f) * Const::DegToRad), c = cos((angle + 90.0f) * Const::DegToRad); center = ImRotate(center, s, c) - center; - auto& buf = ImGui::GetWindowDrawList()->VtxBuffer; + auto& buf = ImGui::GetBackgroundDrawList()->VtxBuffer; for (int i = _rotationStartIndex; i < buf.Size; i++) { buf[i].pos = ImRotate(buf[i].pos, s, c) - center; } } + //<<<<<<<<<< int AlienImGui::DynamicTableLayout::calcNumColumns(float tableWidth, float columnWidth) diff --git a/source/Gui/AlienImGui.h b/source/Gui/AlienImGui.h index 802627c76..afb5e67e9 100644 --- a/source/Gui/AlienImGui.h +++ b/source/Gui/AlienImGui.h @@ -319,6 +319,9 @@ class AlienImGui int _elementNumber = 0; }; + static void RotateStart(ImDrawList* drawList); + static void RotateEnd(float angle, ImDrawList* drawList); + private: template @@ -340,9 +343,7 @@ class AlienImGui template static void BasicInputColorMatrix(BasicInputColorMatrixParameters const& parameters, T (&value)[MAX_COLORS][MAX_COLORS]); - static void RotateStart(); - static ImVec2 RotationCenter(); - static void RotateEnd(float angle); + static ImVec2 RotationCenter(ImDrawList* drawList); static std::unordered_set _basicSilderExpanded; static int _rotationStartIndex; diff --git a/source/Gui/MainWindow.cpp b/source/Gui/MainWindow.cpp index cc20fa054..87ddd0cab 100644 --- a/source/Gui/MainWindow.cpp +++ b/source/Gui/MainWindow.cpp @@ -313,7 +313,7 @@ void _MainWindow::processLoadingControls() processControllers(); _uiController->process(); - _simulationView->processControls(); + _simulationView->processControls(_renderSimulation); _startupController->process(); ImGui::PopStyleVar(2); @@ -331,7 +331,7 @@ void _MainWindow::processFinishedLoading() processWindows(); processControllers(); _uiController->process(); - _simulationView->processControls(); + _simulationView->processControls(_renderSimulation); ImGui::PopStyleVar(2); @@ -343,12 +343,7 @@ void _MainWindow::renderSimulation() int display_w, display_h; glfwGetFramebufferSize(_window, &display_w, &display_h); glViewport(0, 0, display_w, display_h); - if (_renderSimulation) { - _simulationView->draw(); - } else { - glClearColor(0, 0, 0.1f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - } + _simulationView->draw(_renderSimulation); ImGui::Render(); _fpsController->processForceFps(WindowController::getInstance().getFps()); diff --git a/source/Gui/SimulationView.cpp b/source/Gui/SimulationView.cpp index 900fed530..50b5a9301 100644 --- a/source/Gui/SimulationView.cpp +++ b/source/Gui/SimulationView.cpp @@ -278,51 +278,83 @@ void _SimulationView::processEvents() _prevMousePosInt = mousePosInt; } -void _SimulationView::draw() +void _SimulationView::draw(bool renderSimulation) { - processEvents(); - - updateImageFromSimulation(); - - _shader->use(); - - GLint currentFbo; - glGetIntegerv(GL_FRAMEBUFFER_BINDING, ¤tFbo); - - glBindFramebuffer(GL_FRAMEBUFFER, _fbo1); - _shader->setInt("phase", 0); - glBindVertexArray(_vao); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _textureSimulationId); - glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); - - glBindFramebuffer(GL_FRAMEBUFFER, _fbo2); - _shader->setInt("phase", 1); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _textureSimulationId); - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, _textureFramebufferId1); - glActiveTexture(GL_TEXTURE2); - glBindTexture(GL_TEXTURE_2D, _textureFramebufferId2); - glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); + if (renderSimulation) { + processEvents(); + + updateImageFromSimulation(); + + _shader->use(); + + GLint currentFbo; + glGetIntegerv(GL_FRAMEBUFFER_BINDING, ¤tFbo); + + glBindFramebuffer(GL_FRAMEBUFFER, _fbo1); + _shader->setInt("phase", 0); + glBindVertexArray(_vao); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, _textureSimulationId); + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); + + glBindFramebuffer(GL_FRAMEBUFFER, _fbo2); + _shader->setInt("phase", 1); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, _textureSimulationId); + glActiveTexture(GL_TEXTURE1); + glBindTexture(GL_TEXTURE_2D, _textureFramebufferId1); + glActiveTexture(GL_TEXTURE2); + glBindTexture(GL_TEXTURE_2D, _textureFramebufferId2); + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); + + glBindFramebuffer(GL_FRAMEBUFFER, currentFbo); + _shader->setInt("phase", 2); + glActiveTexture(GL_TEXTURE0); + glBindTexture(GL_TEXTURE_2D, _textureFramebufferId2); + glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); + } else { + glClearColor(0, 0, 0.1f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); - glBindFramebuffer(GL_FRAMEBUFFER, currentFbo); - _shader->setInt("phase", 2); - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, _textureFramebufferId2); - glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0); + auto textWidth = scale(300.0f); + auto textHeight = scale(80.0f); + ImDrawList* drawList = ImGui::GetBackgroundDrawList(); + auto styleRep = StyleRepository::getInstance(); + auto right = ImGui::GetMainViewport()->Pos.x + ImGui::GetMainViewport()->Size.x; + auto bottom = ImGui::GetMainViewport()->Pos.y + ImGui::GetMainViewport()->Size.y; + auto maxLength = std::max(right, bottom); + + AlienImGui::RotateStart(ImGui::GetBackgroundDrawList()); + auto font = styleRep.getReefLargeFont(); + auto text = "Rendering disabled"; + ImVec4 clipRect(-100000.0f, -100000.0f, 100000.0f, 100000.0f); + for (int i = 0; toFloat(i) * textWidth < maxLength * 2; ++i) { + for (int j = 0; toFloat(j) * textHeight < maxLength * 2; ++j) { + font->RenderText( + drawList, + scale(34.0f), + {toFloat(i) * textWidth - maxLength / 2, toFloat(j) * textHeight - maxLength / 2}, + Const::RenderingDisabledTextColor, + clipRect, + text, + text + strlen(text), + NULL, + false); + } + } + AlienImGui::RotateEnd(45.0f, ImGui::GetBackgroundDrawList()); + } } -void _SimulationView::processControls() +void _SimulationView::processControls(bool renderSimulation) { - ImGuiViewport* viewport = ImGui::GetMainViewport(); - auto mainMenubarHeight = StyleRepository::getInstance().scale(22); - auto scrollbarThickness = 17; //fixed - _scrollbarX->process( - {{viewport->Pos.x, viewport->Size.y - scrollbarThickness}, {viewport->Size.x - 1 - scrollbarThickness, 1}}); - _scrollbarY->process( - {{viewport->Size.x - scrollbarThickness, viewport->Pos.y + mainMenubarHeight}, - {1, viewport->Size.y - 1 - scrollbarThickness}}); + if (renderSimulation) { + ImGuiViewport* viewport = ImGui::GetMainViewport(); + auto mainMenubarHeight = StyleRepository::getInstance().scale(22); + auto scrollbarThickness = 17; //fixed + _scrollbarX->process({{viewport->Pos.x, viewport->Size.y - scrollbarThickness}, {viewport->Size.x - 1 - scrollbarThickness, 1}}); + _scrollbarY->process({{viewport->Size.x - scrollbarThickness, viewport->Pos.y + mainMenubarHeight}, {1, viewport->Size.y - 1 - scrollbarThickness}}); + } } bool _SimulationView::isOverlayActive() const diff --git a/source/Gui/SimulationView.h b/source/Gui/SimulationView.h index c05edc68c..c11f3ad00 100644 --- a/source/Gui/SimulationView.h +++ b/source/Gui/SimulationView.h @@ -19,8 +19,8 @@ class _SimulationView void resize(IntVector2D const& viewportSize); - void draw(); - void processControls(); + void draw(bool renderSimulation); + void processControls(bool renderSimulation); bool isOverlayActive() const; void setOverlayActive(bool active); diff --git a/source/Gui/StartupController.cpp b/source/Gui/StartupController.cpp index 500c7b997..d35d195ce 100644 --- a/source/Gui/StartupController.cpp +++ b/source/Gui/StartupController.cpp @@ -141,10 +141,10 @@ void _StartupController::processWindow() auto millisecSinceStartup = std::chrono::duration_cast(now - *_startupTimepoint).count(); ImDrawList* drawList = ImGui::GetBackgroundDrawList(); - ImColor textColor = Const::ProgramVersionColor; + ImColor textColor = Const::ProgramVersionTextColor; textColor.Value.w *= ImGui::GetStyle().Alpha; - ImColor loadingTextColor = Const::ProgramVersionColor; + ImColor loadingTextColor = Const::ProgramVersionTextColor; loadingTextColor.Value.w *= ImGui::GetStyle().Alpha * 0.5f; //draw 'Initializing' text if it fits diff --git a/source/Gui/StyleRepository.h b/source/Gui/StyleRepository.h index 5ebc6c118..fecf78496 100644 --- a/source/Gui/StyleRepository.h +++ b/source/Gui/StyleRepository.h @@ -8,7 +8,9 @@ namespace Const { - ImColor const ProgramVersionColor = ImColor::HSV(0.5f, 0.1f, 1.0f, 1.0f); + ImColor const ProgramVersionTextColor = ImColor::HSV(0.5f, 0.1f, 1.0f, 1.0f); + + ImColor const RenderingDisabledTextColor = ImColor::HSV(0.5f, 0.1f, 1.0f, 0.2f); int64_t const SimulationSliderColor_Base = 0xff4c4c4c; int64_t const SimulationSliderColor_Active = 0xff6c6c6c; diff --git a/vcpkg.json b/vcpkg.json index 3f61639e8..dac285b46 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "alien", - "version": "4.4.2", + "version": "4.4.3", "dependencies": [ { "name": "glew", From b2e149a3b16d7ee3d762ae0e3636348488452b1f Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Wed, 29 Nov 2023 21:04:23 +0100 Subject: [PATCH 5/5] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0f5b5b0e5..6b4f81f0c 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ 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: 2023-11-25) +Installer for Windows: [alien-installer.msi](https://alien-project.org/media/files/alien-installer.msi) (Updated: 2023-11-29) 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).