Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Real time render with SFML #107

Open
wants to merge 62 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
fed7023
this is a fork now
ilyabrilev May 23, 2024
d6aa80a
playing around with profiling
ilyabrilev May 23, 2024
9255419
profiling is working
ilyabrilev May 23, 2024
d5df0b7
SFML start
ilyabrilev May 29, 2024
a067953
live version is barebones working
ilyabrilev May 29, 2024
15bcada
Merge pull request #1 from ilyabrilev/feature/profiling-and-refactoring
ilyabrilev May 29, 2024
d0d26a9
view refactoring (full sfml support)
ilyabrilev May 30, 2024
bf3cd01
Merge pull request #2 from ilyabrilev/view-refactoring
ilyabrilev May 30, 2024
8a68165
add basic gui
ilyabrilev Jun 4, 2024
01266ac
Added ui components
ilyabrilev Jun 5, 2024
cf6e2d9
interactive params change
ilyabrilev Jun 5, 2024
45492d2
Merge pull request #3 from ilyabrilev/add-gui
ilyabrilev Jun 5, 2024
a3597c7
speed control ui
ilyabrilev Jun 7, 2024
ec391d4
Merge pull request #4 from ilyabrilev/add-gui
ilyabrilev Jun 7, 2024
a2bfc13
utils refactoring
ilyabrilev Jun 7, 2024
40434a4
refactor ai stuf
ilyabrilev Jun 7, 2024
1f95fb8
multithreading fix
ilyabrilev Jun 10, 2024
35c90d2
Merge pull request #5 from ilyabrilev/save-simulation
ilyabrilev Jun 10, 2024
8a636ab
save system v1 is finaly done
ilyabrilev Jun 19, 2024
f131f23
Merge pull request #6 from ilyabrilev/save-simulation
ilyabrilev Jun 19, 2024
0b3b614
Update README.md
ilyabrilev Jun 19, 2024
0144bae
binary saves and autosave checkbox
ilyabrilev Jun 19, 2024
fbae46f
Merge pull request #7 from ilyabrilev/save-simulation
ilyabrilev Jun 19, 2024
540e4ee
StopAtStart and StopAtEnd buttons
ilyabrilev Jun 21, 2024
871e07a
Merge pull request #8 from ilyabrilev/save-simulation
ilyabrilev Jun 21, 2024
889ee6d
restart on end button
ilyabrilev Jun 21, 2024
486f35b
Merge pull request #9 from ilyabrilev/save-simulation
ilyabrilev Jun 21, 2024
e223a88
barrier drawing
ilyabrilev Jun 24, 2024
67c4f53
barrier combo box
ilyabrilev Jun 26, 2024
9122e6d
Merge pull request #10 from ilyabrilev/save-simulation
ilyabrilev Jun 26, 2024
f4ceac8
selecting indiv and creating its neural graph
ilyabrilev Jun 27, 2024
f70fe0e
Merge pull request #11 from ilyabrilev/more-settings-ui
ilyabrilev Jun 27, 2024
0aff724
zoom fix, barrier save fix, and selection fix
ilyabrilev Jun 28, 2024
bf06bff
Merge pull request #12 from ilyabrilev/more-settings-ui
ilyabrilev Jun 28, 2024
1ada7d9
right panel refactoring
ilyabrilev Jul 2, 2024
e6ec729
Merge pull request #13 from ilyabrilev/more-settings-ui
ilyabrilev Jul 2, 2024
ec9bbdd
Update README.md
ilyabrilev Jul 2, 2024
3eea0c1
Update README.md
ilyabrilev Jul 2, 2024
7c6156f
info button
ilyabrilev Jul 2, 2024
686b72c
Merge pull request #14 from ilyabrilev/more-settings-ui
ilyabrilev Jul 2, 2024
4c69303
Update README.md
ilyabrilev Jul 4, 2024
0441a53
Update README.md
ilyabrilev Jul 4, 2024
f2017d1
survival criteria info button
ilyabrilev Jul 10, 2024
28d5215
Merge pull request #15 from ilyabrilev/more-settings-ui
ilyabrilev Jul 10, 2024
1fda334
survival criteria refactoring
ilyabrilev Aug 12, 2024
c3f30bc
CHALLENGE_CORNER_WEIGHTED display
ilyabrilev Aug 14, 2024
24dbe4a
ChallengeCorner вшыздфн
ilyabrilev Aug 14, 2024
fb1f9ef
show passed btn and round challenges display
ilyabrilev Aug 15, 2024
8ffa6d5
readme screenshot
ilyabrilev Aug 15, 2024
f5e9871
line challenges display
ilyabrilev Aug 19, 2024
8bb7468
near barrier criteria fix
ilyabrilev Aug 19, 2024
2ad06f1
population and steps per generation controlls
ilyabrilev Aug 19, 2024
0607ee0
playing with kill sensor
ilyabrilev Aug 19, 2024
fd46024
population size fix
ilyabrilev Aug 20, 2024
5ace6ad
new survival criteria and refactoring
ilyabrilev Sep 7, 2024
04bf6e4
readme
ilyabrilev Sep 7, 2024
a3c4032
end of sim step challenges refactoring
ilyabrilev Sep 10, 2024
5bfd885
Challenge refactoring completed
ilyabrilev Sep 13, 2024
09ca265
requirements in readme
ilyabrilev Sep 20, 2024
1afefd7
add comments to functions
ilyabrilev Sep 20, 2024
e1e54bd
Merge pull request #16 from ilyabrilev/docs
ilyabrilev Sep 20, 2024
6a9e035
Merge branch 'davidrmiller:main' into pr-to-davidrmiller-repo
ilyabrilev Sep 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
obj/
tools/*.svg
build/
28 changes: 28 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"configurations": [
{
"name": "Linux",
"browse": {
"path": [
"${workspaceFolder}",
"${workspaceFolder}/src/*"
],
"limitSymbolsToIncludedHeaders": true
},
"includePath": [
"${default}",
"/usr/include/SFML",
"/usr/lib/x86_64-linux-gnu",
"/usr/include",
"/usr/include/opencv4",
"${workspaceFolder}/src/include"
],
"defines": [],
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.makefile-tools"
}
],
"version": 4
}
33 changes: 33 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"configurations": [
{
"name": "C/C++: g++-11 build and debug active file",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/Debug/biosim4",
"args": [
"${workspaceFolder}/biosim4.ini"
],
"cwd": "${workspaceFolder}",
"stopAtEntry": false,
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
],
"preLaunchTask": "${defaultBuildTask}",
"miDebuggerPath": "/usr/bin/gdb"
}
],
"version": "2.0.0"
}
77 changes: 77 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"files.associations": {
"*.embeddedhtml": "html",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"chrono": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"list": "cpp",
"map": "cpp",
"set": "cpp",
"string": "cpp",
"unordered_map": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"functional": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"random": "cpp",
"ratio": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"fstream": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cinttypes": "cpp",
"typeinfo": "cpp",
"cassert": "cpp",
"any": "cpp",
"bitset": "cpp",
"codecvt": "cpp",
"unordered_set": "cpp",
"optional": "cpp",
"regex": "cpp",
"typeindex": "cpp",
"variant": "cpp",
"forward_list": "cpp",
"valarray": "cpp"
}
}
20 changes: 20 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: g++ build active file",
"command": "make debug",
"args": [
],
"options": {
"cwd": "${workspaceFolder}/"
},
"problemMatcher": [
"$gcc"
],
"group": "build",
"detail": "Task generated by Debugger."
}
],
"version": "2.0.0"
}
32 changes: 30 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ CXXFLAGS += \
-std=c++17 \
-fexceptions \
-fopenmp \
-I./src/include \
$(shell pkg-config --cflags opencv4)

LDFLAGS += \
Expand All @@ -19,6 +20,10 @@ LDFLAGS += \
-lopencv_videoio \
-lgomp \
-lpthread \
-lsfml-graphics \
-lsfml-window \
-lsfml-system \
-ltgui \
-fopenmp

ifeq ($(BUILD),debug)
Expand All @@ -32,10 +37,19 @@ else
LDFLAGS += -O3 -s
endif

SOURCE := $(wildcard src/*.cpp src/*.h)
SOURCE := $(wildcard src/*.cpp src/*.h src/userio/*.cpp src/userio/*.h \
src/userio/sfmlComponents/*.cpp src/userio/sfmlComponents/*.h \
src/utils/*.cpp src/utils/*.h \
src/ai/*.cpp src/ai/*.h \
src/survivalCriteria/*.cpp src/survivalCriteria/*.h \
src/userio/sfmlComponents/flowComponents/*.cpp src/userio/sfmlComponents/flowComponents/*.h \
src/userio/sfmlComponents/settingsComponents/*.cpp src/userio/sfmlComponents/settingsComponents/*.h \
)
CXXSOURCE := $(filter %.cpp, $(SOURCE))
HEADERS := $(filter %.h, $(SOURCE))
OBJS := $(subst src/,$(OBJ_DIR)/, $(CXXSOURCE:.cpp=.o))
INCLUDES = -I./src/include
LIBS = -L/path/to/cereal/lib -lcereal


all: debug release
Expand All @@ -44,10 +58,24 @@ all: debug release
before_debug:
test -d bin/Debug || mkdir -p bin/Debug
test -d obj/Debug/src || mkdir -p obj/Debug/src
test -d obj/Debug/src/userio || mkdir -p obj/Debug/src/userio
test -d obj/Debug/src/userio/sfmlComponents || mkdir -p obj/Debug/src/userio/sfmlComponents
test -d obj/Debug/src/userio/sfmlComponents/flowComponents || mkdir -p obj/Debug/src/userio/sfmlComponents/flowComponents
test -d obj/Debug/src/userio/sfmlComponents/settingsComponents || mkdir -p obj/Debug/src/userio/sfmlComponents/settingsComponents
test -d obj/Debug/src/utils || mkdir -p obj/Debug/src/utils
test -d obj/Debug/src/ai || mkdir -p obj/Debug/src/ai
test -d obj/Debug/src/survivalCriteria || mkdir -p obj/Debug/src/survivalCriteria

before_release:
test -d bin/Release || mkdir -p bin/Release
test -d obj/Release/src || mkdir -p obj/Release/src
test -d obj/Release/src/userio || mkdir -p obj/Release/src/userio
test -d obj/Release/src/userio/sfmlComponents || mkdir -p obj/Release/src/userio/sfmlComponents
test -d obj/Release/src/userio/sfmlComponents/flowComponents || mkdir -p obj/Release/src/userio/sfmlComponents/flowComponents
test -d obj/Release/src/userio/sfmlComponents/settingsComponents || mkdir -p obj/Release/src/userio/sfmlComponents/settingsComponents
test -d obj/Release/src/utils || mkdir -p obj/Release/src/utils
test -d obj/Release/src/ai || mkdir -p obj/Release/src/ai
test -d obj/Release/src/survivalCriteria || mkdir -p obj/Release/src/survivalCriteria

.PHONY : release debug
debug: before_debug
Expand Down Expand Up @@ -77,7 +105,7 @@ clean_release:
$(RM) -f bin/Release/biosim4

distclean: clean
$(RM) -f logs/* images/*
$(RM) -f Output/Images/* Output/Videos/* Output/Logs/* Output/Saves/* Output/Profiling/*

.PHONY: all clean distclean

File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions Output/Profiling/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

5 changes: 5 additions & 0 deletions Output/Saves/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

5 changes: 5 additions & 0 deletions Output/Videos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,32 @@
# biosim4

Fork of https://github.com/davidrmiller/biosim4

### What has been done

- heavy refactoring
- a new output via SFML which renders individuals, challenge criterias and barriers in real-time with the ability to drag simulation (LMB), zoom in/out (scroll), select indiv (LMB)
- UI to watch and control simulation with TGUI:
- pause/resume button, pause at start/end of generation
- slow or increase speed of simulation
- change some settings
- restart simulation
- save selected indiv's net to svg
- show indivs who would pass survival criteria if simulation end now
- saving and loading simulations with "cereal" serialization library

![screenshot](https://github.com/ilyabrilev/biosim4/blob/main/screenshot.png?raw=true)

### Plans
- expand UI functionality to controll simulation
- implement recording of simulation, add ability to play it with time skipping, ability to go back (etc.)
- hopefuly add more behaviour, events, resources to simulation

### Requirements
- sfml https://stackoverflow.com/questions/30696114/how-to-install-sfml-in-ubuntu
- tgui 1.1 https://tgui.eu/tutorials/latest-stable/
- cereal (it should work right of the box, but here is a link anyway https://uscilab.github.io/cereal/index.html)

## What is this?

This pile of code was used to simulate biological creatures that evolve through natural selection.
Expand Down
Binary file added Resources/Black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading