### wxWidgets Installation Directory Structure Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Example directory structure after wxWidgets has been successfully built and installed. ```text drwxrwxr-x 2 gg gg 4096 mei 23 12:54 bin/ drwxrwxr-x 3 gg gg 4096 mei 23 12:54 include/ drwxrwxr-x 3 gg gg 4096 mei 23 12:54 lib/ drwxrwxr-x 5 gg gg 4096 mei 23 12:54 share/ ``` -------------------------------- ### Install zlib SDK Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Install the zlib development headers. ```bash sudo apt install zlib1g-dev ``` -------------------------------- ### Install libpng SDK Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Install the libpng development headers. ```bash sudo apt install libpng-dev ``` -------------------------------- ### Install X11 SDK Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Install the X11 development headers. ```bash sudo apt install libx11-dev ``` -------------------------------- ### Install FLAC SDK Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Install the FLAC development headers. ```bash sudo apt install libflac++-dev ``` -------------------------------- ### Install GTK3 SDK Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Install the GTK3 development headers. ```bash sudo apt install libgtk-3-dev ``` -------------------------------- ### Install libjpeg SDK Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Install the libjpeg development headers. ```bash sudo apt install libjpeg-dev ``` -------------------------------- ### Install SFML SDK Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Install the SFML development headers for sound support. ```bash sudo apt install libsfml-dev ``` -------------------------------- ### Install Git Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Install the Git version control system. ```bash sudo apt install git ``` -------------------------------- ### Install Vorbis SDK Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Install the Vorbis development headers. ```bash sudo apt install libvorbis-dev ``` -------------------------------- ### Copying UserSettings.cmake on Windows Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Windows.md Use this command to initialize the configuration file from the provided example template. ```batch cd %SOURCE_ROOT%\Floating-Sandbox copy UserSettings.example-windows.cmake UserSettings.cmake ``` -------------------------------- ### Install OpenGL SDK Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Install the Mesa OpenGL and GLU development headers. ```bash sudo apt install libgl1-mesa-dev sudo apt install libglu1-mesa-dev ``` -------------------------------- ### Copy UserSettings Example Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Copies the example UserSettings file to UserSettings.cmake. This file is crucial for configuring the build process by specifying library paths. ```bash cd ~/git/Floating-Sandbox cp UserSettings.example-linux.cmake UserSettings.cmake ``` -------------------------------- ### Build and Install wxWidgets Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Compiles and installs wxWidgets using multiple processor cores for faster build times. This command should be run from the wxWidgets build directory. ```bash make install -j$(nproc) ``` -------------------------------- ### wxWidgets Configuration Output Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Example output from the wxWidgets configure script, detailing the selected build options. ```text Configured wxWidgets 3.1.4 for `x86_64-pc-linux-gnu' Which GUI toolkit should wxWidgets use? GTK+ 3 with support for GTK+ printing Should wxWidgets be compiled into single library? no Should wxWidgets be linked as a shared library? no Should wxWidgets support Unicode? yes (using wchar_t) What level of wxWidgets compatibility should be enabled? wxWidgets 2.8 no wxWidgets 3.0 yes Which libraries should wxWidgets use? STL no jpeg sys png sys regex builtin tiff no lzma no zlib sys expat no libmspack no sdl no ``` -------------------------------- ### Install CMake Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Install CMake via APT if the version is sufficient. ```bash sudo apt install cmake ``` -------------------------------- ### Install and configure GCC 14 Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Install GCC 14 and set it as the default compiler using update-alternatives. ```bash sudo apt install gcc-14 sudo apt install g++-14 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 80 --slave /usr/bin/g++ g++ /usr/bin/g++-14 ``` -------------------------------- ### Verify wxWidgets Installation Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Windows.md Directory structure expected after building and installing wxWidgets. ```text 01/01/2022 06:31 PM . 01/01/2022 06:31 PM .. 01/01/2022 06:31 PM include 01/01/2022 06:31 PM lib ``` -------------------------------- ### Verify Floating Sandbox installation directory Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Displays the contents of the installation directory to confirm all necessary files are present. ```bash gg@ubuntu1804-vm:~$ ll ~/floating-sandbox/ total 183572 drwxrwxr-x 5 gg gg 4096 mei 23 15:57 ./ drwxr-xr-x 18 gg gg 4096 mei 23 15:57 ../ -rw-r--r-- 1 gg gg 20235 mei 23 11:06 changes.txt drwxr-xr-x 13 gg gg 4096 mei 23 15:57 Data/ -rwxr-xr-x 1 gg gg 187856824 mei 23 15:44 FloatingSandbox* drwxr-xr-x 2 gg gg 4096 mei 23 15:57 Guides/ -rw-r--r-- 1 gg gg 1270 mei 22 14:25 license.txt -rw-r--r-- 1 gg gg 12903 mei 23 14:43 README.md drwxr-xr-x 2 gg gg 57344 mei 23 15:57 Ships/ ``` -------------------------------- ### CMake Configuration Output Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Windows.md Example output generated after running the CMake configuration command. ```text -- Building for: Visual Studio 16 2019 -- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19043. -- The C compiler identification is MSVC 19.28.29913.0 -- The CXX compiler identification is MSVC 19.28.29913.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Loading user specific settings from C:/Users/FSUser/source/repos/Floating-Sandbox/UserSettings.cmake -- FS_USE_STATIC_LIBS:ON -- FS_BUILD_BENCHMARKS:OFF -- Found PicoJSON: C:/Users/FSUser/source/SDK/PicoJSON -- Found ZLIB: optimized;C:/Users/FSUser/source/SDK/ZLib-1.2.11/lib/x64/zlibstatic.lib;debug;C:/Users/FSUser/source/SDK/ZLib-1.2.11/lib/x64/zlibstaticd.lib (found version "1.2.11") -- Found JPEG: optimized;C:/Users/FSUser/source/SDK/jpeg-9d/lib/x64/jpeg.lib;debug;C:/Users/FSUser/source/SDK/jpeg-9d/lib/x64/jpegd.lib (found version "90") -- Found PNG: optimized;C:/Users/FSUser/source/SDK/LibPNG-1.6.37/lib/x64/libpng16_static.lib;debug;C:/Users/FSUser/source/SDK/LibPNG-1.6.37/lib/x64/libpng16_staticd.lib (found version "1.6.37") -- wxWidgets_ROOT:C:/Users/FSUser/source/SDK/wxWidgets-3.1.4 -- Found wxWidgets: debug;C:/Users/FSUser/source/SDK/wxWidgets-3.1.4/lib/vc_x64_lib/wxbase31ud.lib;optimized;C:/Users/FSUser/source/SDK/wxWidgets-3.1.4/lib/vc_x64_lib/wxbase31u.lib;debug;C:/Users/FSUser/source/SDK/wxWidgets-3.1.4/lib/vc_x64_lib/wxmsw31ud_gl.lib;optimized;C:/Users/FSUser/source/SDK/wxWidgets-3.1.4/lib/vc_x64_lib/wxmsw31u_gl.lib;debug;C:/Users/FSUser/source/SDK/wxWidgets-3.1.4/lib/vc_x64_lib/wxmsw31ud_core.lib;optimized;C:/Users/FSUser/source/SDK/wxWidgets-3.1.4/lib/vc_x64_lib/wxmsw31u_core.lib;debug;C:/Users/FSUser/source/SDK/wxWidgets-3.1.4/lib/vc_x64_lib/wxmsw31ud_html.lib;optimized;C:/Users/FSUser/source/SDK/wxWidgets-3.1.4/lib/vc_x64_lib/wxmsw31u_html.lib;debug;C:/Users/FSUser/source/SDK/wxWidgets-3.1.4/lib/vc_x64_lib/wxmsw31ud_propgrid.lib;optimized;C:/Users/FSUser/source/SDK/wxWidgets-3.1.4/lib/vc_x64_lib/wxmsw31u_propgrid.lib;debug;C:/Users/FSUser/source/SDK/wxWidgets-3.1.4/lib/vc_x64_lib/wxregexud.lib;optimized;C:/Users/FSUser/source/SDK/wxWidgets-3.1.4/lib/vc_x64_lib/wxregexu.lib;opengl32;glu32;winmm;comctl32;oleacc;rpcrt4;shlwapi;version;wsock32 -- SFML_ROOT:C:/Users/FSUser/source/SDK/SFML-2.5.1/lib/cmake/SFML -- Found SFML 2.5.1 in C:/Users/FSUser/source/SDK/SFML-2.5.1/lib/cmake/SFML -- Found OpenGL: opengl32 -- Found PythonInterp: C:/Users/FSUser/AppData/Local/Programs/Python/Python38/python.exe (found version "3.8.5") -- Looking for pthread.h -- Looking for pthread.h - not found -- Found Threads: TRUE -- Copying data files and runtime files for FloatingSandbox... -- Copying data files for GPUCalcTest... -- Copying data files for ShipBuilder... -- ----------------------------------------------------- -- cxx Flags:/DWIN32 /D_WINDOWS /GR /EHsc /D_CRT_SECURE_NO_WARNINGS /W4 /w44062 -- cxx Flags Release:/MT /Ob2 /DNDEBUG /W4 /w44062 /fp:fast /Ox /GS- /MP -- cxx Flags RelWithDebInfo:/MT /Zi /O2 /Ob1 /DNDEBUG /W4 /w44062 /fp:fast /Ox /GS- /MP -- cxx Flags Debug:/MTd /Zi /Ob0 /Od /RTC1 /W4 /w44062 /fp:strict /DFLOATING_POINT_CHECKS /MP -- c Flags:/DWIN32 /D_WINDOWS /W4 /w44062 -- c Flags Release:/MT /O2 /Ob2 /DNDEBUG /W4 /w44062 -- c Flags RelWithDebInfo:/MT /Zi /O2 /Ob1 /DNDEBUG /W4 /w44062 -- c Flags Debug:/MTd /Zi /Ob0 /Od /RTC1 /W4 /w44062 -- exe Linker Flags Release: /INCREMENTAL:NO /LTCG -- exe Linker Flags RelWithDebInfo:/debug /INCREMENTAL:NO /LTCG:incremental -- exe Linker Flags Debug:/debug /INCREMENTAL:NO ``` -------------------------------- ### Build CMake from source Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Compile and install CMake manually for older Ubuntu distributions. ```bash sudo apt install libssl-dev ./configure make sudo make install ``` -------------------------------- ### JPEG Library Structure Example Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Windows.md Illustrates the expected directory structure and files for the compiled jpeg library. Ensure the output matches this format under %SDK_ROOT%\jpeg-9d. ```text %SDK_ROOT%\jpeg-9d: 12/09/2021 07:57 PM include 01/01/2022 06:11 PM lib %SDK_ROOT%\jpeg-9d\include: 07/29/2015 12:44 PM 1,605 jconfig.h 12/02/2018 07:04 PM 14,892 jerror.h 09/17/2013 10:20 AM 15,371 jmorecfg.h 02/03/2019 04:06 PM 50,591 jpeglib.h %SDK_ROOT%\jpeg-9d\lib: 01/01/2022 06:13 PM x64 %SDK_ROOT%\jpeg-9d\lib\x64: 01/01/2022 11:52 AM 4,662,216 jpeg.lib ``` -------------------------------- ### Verify CMake installation Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Refresh the hash table and check the installed CMake version. ```bash hash -r cmake --version ``` -------------------------------- ### Define JSON array start Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/Guides/Material System.md The materials file must begin with an opening square bracket. ```json [ ``` -------------------------------- ### Configure and Build Floating Sandbox Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Configures the Floating Sandbox build using CMake with specific release settings and static libraries, then installs the project. Ensure you are in the Floating Sandbox checkout root directory. ```bash cd ~/git/Floating-Sandbox mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DFS_BUILD_BENCHMARKS=OFF -DFS_USE_STATIC_LIBS=ON -DwxWidgets_USE_DEBUG=OFF -DwxWidgets_USE_UNICODE=ON -DwxWidgets_USE_STATIC=ON -DFS_INSTALL_DIRECTORY=~/floating-sandbox .. make install -j$(nproc) ``` -------------------------------- ### LabController Initialization Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/NPCs.txt Specifies the initial state of the LabController when starting, which is that there are no NPCs present. ```cpp + LabController start: no NPC ``` -------------------------------- ### Configure Installation Directory in CMake Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/CMakeLists.txt Sets the CMAKE_INSTALL_PREFIX based on the FS_INSTALL_DIRECTORY variable or defaults to a local binary directory. ```cmake if(FS_INSTALL_DIRECTORY) set(CMAKE_INSTALL_PREFIX "${FS_INSTALL_DIRECTORY}" CACHE PATH "..." FORCE) else() set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}/Install" CACHE PATH "..." FORCE) endif() # User-defined DefineUserPostInstall() ``` -------------------------------- ### Example .shp File Structure Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/Guides/How to Build a Ship.md This JSON structure defines a ship by referencing its various layer image files and providing metadata such as ship name and creator. Ensure all referenced image files exist in the same directory. ```json { "structure_image":"ss_queen_of_unova_structure.png", "electrical_image":"ss_queen_of_unova_electrical.png", "ropes_image":"ss_queen_of_unova_ropes.png", "texture_image":"ss_queen_of_unova_texture.png", "ship_name":"S.S. Queen of Unova", "offset":{"x":0.0, "y":-14.0}, "created_by":"OceanLinerOrca; Gabriele Giuseppini" } ``` -------------------------------- ### Crate Material Configuration Example Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/NPCs.txt This JSON object represents the material properties for a 'Crate' entity, including its physical attributes like mass, friction, elasticity, and buoyancy. It serves as a reference for how material data is structured. ```json { "name": "Crate", "render_color": "#000060", "mass": 34.5, "spring_reduction_fraction": 0.97, "spring_damping_coefficient": 0.5, "static_friction": 0.07, "kinetic_friction": 0.05, "elasticity": 0.6, "buoyancy_volume_fill": 0.05 } ``` -------------------------------- ### Prepare APT repositories Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Update package lists and add the toolchain repository for newer GCC versions. ```bash sudo apt update sudo apt install software-properties-common sudo add-apt-repository ppa:ubuntu-toolchain-r/test ``` -------------------------------- ### FollowNpcTool Implementation Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/NPCs.txt Details the implementation of the 'FollowNpcTool', including its icon, cursor, and interaction logic. ```cpp Tool: "FollowNpcTool" Icon: like Move, Remove but with auto-focus frame - autofocus_on_npc_icon.png Cursor: autofocus_on_npc_cursor.png RemoveNpc tool becomes base+derivates, used for Remove & Follow Change (for both Remove & Follow, i.e. base): make it so we don't have to store candidate, but probe right away at each move+down Just react to move+down (& up, but just for cursor) Follow: calls SelectNpc() + SetAutoFocus(SelectedNpc) ``` -------------------------------- ### Configure Floating Sandbox with CMake Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Windows.md Commands to create the build directory and generate the Visual Studio solution file. ```batch cd %SOURCE_ROOT%\Floating-Sandbox mkdir build cd build cmake -D CMAKE_BUILD_TYPE=Release -D FS_BUILD_BENCHMARKS=OFF -D FS_USE_STATIC_LIBS=ON -D FS_INSTALL_DIRECTORY=%USERPROFILE%\floating-sandbox .. ``` -------------------------------- ### Define an Electrical Material Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/Guides/Material System.md Example JSON object representing a High Lamp material configuration. ```json { "name": "High Lamp", "template": { "row": "0|Lamps", "column": "0|High Lamp" }, "color_key": "#FFE010", "electrical_type": "Lamp", "heat_generated": 900.0, "is_self_powered": false, "luminiscence": 2.0, "light_spread": 9.0, "minimum_operating_temperature": 233.15, "maximum_operating_temperature": 398.15, "wet_failure_rate": 0.0 }, ``` -------------------------------- ### Configure Include Directories and Link Libraries Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/Sources/SoundCore/CMakeLists.txt Sets public and interface include directories for the 'SoundCore' library and links it with 'Core' and additional libraries. ```cmake target_include_directories(SoundCore PUBLIC ${PICOJSON_INCLUDE_DIRS}) target_include_directories(SoundCore INTERFACE ..) target_link_libraries(SoundCore Core ${ADDITIONAL_LIBRARIES} ) ``` -------------------------------- ### Clone WxWidgets Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Download the specific version of the WxWidgets library. ```bash cd ~/git git clone --recurse-submodules https://github.com/wxWidgets/wxWidgets.git cd wxWidgets git checkout v3.1.4 ``` -------------------------------- ### Define a Structural Material Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/Guides/Material System.md Example configuration object for an 'Iron Hull' material, defining its physical and thermal properties. ```json { "color_key": "#404050", "buoyancy_volume_fill": 0.0, "combustion_type": "Combustion", "ignition_temperature": 1588.15, "is_hull": true, "mass": { "density": 0.0935, "nominal_mass": 7950 }, "melting_temperature": 1783.15, "name": "Iron Hull", "render_color": "#404050", "rust_receptivity": 1.0, "sound_type": "Metal", "specific_heat": 449.0, "stiffness": 1.0, "strength": 0.055, "template": { "column": 0, "row": "0|Iron Hull" }, "thermal_conductivity": 79.5, "thermal_expansion_coefficient": 0.0000106, "water_diffusion_speed": 0.5, "water_intake": 1.0, "water_retention": 0.05, "wind_receptivity": 0.0 }, ``` -------------------------------- ### State Transition for Equilibrium Decision Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/NPCs.txt Resets the CurrentEquilibriumSoftTerminationDecision at transitions to Rising and Equilibrium states. Also prevents starting a walk if not on an edge. ```c++ HumanState.CurrentEquilibriumSoftTerminationDecision Reset also at transitions to Rising & Equilibrium Do not start walking if not on edge ``` -------------------------------- ### Configure wxWidgets Build Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Configures the wxWidgets build for GTK3, UNICODE, OpenGL, and static linking. Ensure you are in the wxWidgets checkout root directory. ```bash cd ~/git/wxWidgets mkdir my_wx_build cd my_wx_build ../configure --disable-shared --with-gtk=3 --with-libpng --with-libxpm --with-libjpeg --without-libtiff --without-expat --disable-pnm --disable-gif --disable-pcx --disable-iff --with-opengl --prefix=${HOME}/fs_libs/wxWidgets --exec_prefix=${HOME}/fs_libs/wxWidgets --disable-tests --disable-rpath ``` -------------------------------- ### Reproduction of 'Running Away' Issue Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/NPCs.txt Code to reproduce the 'running away' issue, starting at a specific position and observing trajectory behavior with a small delta time. ```C++ ! Repro: start at vec2f const position = vec2f(-0.634f, -2.0f); ! At second iteration of main loop, dt is very small but trajectory is still original: ``` ```C++ + 0: Build repro with ball & velocity first ``` -------------------------------- ### Define ShipTools Executable and Dependencies Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/Sources/ShipTools/CMakeLists.txt Sets up the source file list, creates the executable target, and links required libraries. ```cmake set (SHIP_TOOLS_SOURCES AndroidTextureDatabases.h Main.cpp ShipDatabaseBaker.cpp ShipDatabaseBaker.h SoundAtlasBaker.cpp SoundAtlasBaker.h TextureAtlasBaker.h ) source_group(" " FILES ${SHIP_TOOLS_SOURCES}) add_executable (ShipTools ${SHIP_TOOLS_SOURCES}) target_link_libraries (ShipTools Core SoundCore Game ${ADDITIONAL_LIBRARIES}) ``` -------------------------------- ### Begin Moving an NPC Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/NPCs.txt Starts the process of moving an existing NPC. The NPC is moved to the topmost ship and set to 'BeingPlaced' mode twice. This function maintains and publishes NPC statistics. ```cpp void BeginMoveNpc(NpcId) ``` -------------------------------- ### Begin Placing a New Human NPC Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/NPCs.txt Initiates the placement of a new human NPC. Returns nullopt if there is no room for new humans. Creates the NPC in the topmost ship and sets it to 'BeingPlaced' mode. Materialization is redone using FindTopmostTriangle. ```cpp opt> BeginPlaceNewHumanNpc(HumanKind, pos) ``` -------------------------------- ### Create Static Library Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/Sources/SoundCore/CMakeLists.txt Creates a static library named 'SoundCore' from the specified source files. Sets the C++ standard to 17. ```cmake add_library(SoundCore STATIC ${SOURCES}) set_target_properties(SoundCore PROPERTIES CXX_STANDARD 17) ``` -------------------------------- ### Configure Google Test and Unit Test Executable Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/Sources/UnitTests/CMakeLists.txt Sets up the Google Test environment, defines the list of source files for the unit test suite, and links the required project libraries. ```cmake enable_testing() if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING /DGTEST_HAS_TR1_TUPLE=0") endif() # # Setup google test # set_property( TARGET gmock gtest gtest_main PROPERTY FOLDER "GoogleTest") # # Setup target # set (UNIT_TEST_SOURCES AABBTests.cpp AlgorithmsTests.cpp BoundedVectorTests.cpp BufferTests.cpp Buffer2DTests.cpp CircularListTests.cpp ColorsTests.cpp DeSerializationBufferTests.cpp ElectricalPanelTests.cpp EndianTests.cpp EnumFlagsTests.cpp FileSystemTests.cpp FinalizerTests.cpp FixedSizeVectorTests.cpp FloatingPointTests.cpp FontSetTests.cpp GameGeometryTests.cpp GameMathTests.cpp GameTypesTests.cpp ImageToolsTests.cpp IndexRemapTests.cpp InstancedElectricalElementSetTests.cpp IntegralSystemTests.cpp LayerTests.cpp LayoutHelperTests.cpp main.cpp Matrix2Tests.cpp MultiProviderVertexBufferTests.cpp ParameterSmootherTests.cpp PortableTimepointTests.cpp PrecalculatedFunctionTests.cpp ProgressCallbackTests.cpp RopeBufferTests.cpp SettingsTests.cpp ShaderManagerTests.cpp ShipDefinitionFormatDeSerializerTests.cpp ShipNameNormalizerTests.cpp ShipPreviewDirectoryManagerTests.cpp #ShipTests.cpp # Needs a lot of rework SimulationEventDispatcherTests.cpp SliderCoreTests.cpp StreamsTests.cpp StrongTypeDefTests.cpp SysSpecificsTests.cpp TaskThreadTests.cpp TemporallyCoherentPriorityQueueTests.cpp TestingUtils.cpp TestingUtils.h TextureAtlasTests.cpp TextureDatabaseTests.cpp ThreadPoolTests.cpp TruncatedPriorityQueueTests.cpp TupleKeysTests.cpp UniqueBufferTests.cpp UtilsTests.cpp VectorsTests.cpp VersionTests.cpp ) source_group(" " FILES ${UNIT_TEST_SOURCES}) add_executable (UnitTests ${UNIT_TEST_SOURCES}) add_test (UnitTests UnitTests) target_include_directories(UnitTests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries (UnitTests Core Game OpenGLCore Render Simulation ShipBuilderLib UILib gmock gtest ${ADDITIONAL_LIBRARIES}) ``` -------------------------------- ### Define a Ship with .shp Files Source: https://context7.com/gabrielegiuseppini/floating-sandbox/llms.txt Ship definition files link image layers to metadata and electrical panel layouts. ```json { "structure_image": "my_ship_structure.png", "electrical_image": "my_ship_electrical.png", "ropes_image": "my_ship_ropes.png", "texture_image": "my_ship_texture.png", "ship_name": "My Custom Ship", "offset": {"x": 0.0, "y": -14.0}, "created_by": "Author Name", "year_built": "1912", "electrical_panel": { "0": {"panel_x": -1, "panel_y": 0, "label": "Generator"}, "1": {"panel_x": 0, "panel_y": 0, "label": "Main Lights"} } } ``` -------------------------------- ### SimulationParameters Configuration Source: https://context7.com/gabrielegiuseppini/floating-sandbox/llms.txt Contains global simulation constants and adjustable parameters for physics, spring dynamics, and fluid behavior. ```cpp struct SimulationParameters { // Time step: 64 frames/sec static float constexpr SimulationStepTimeDuration = 1.0f / 64.0f; // Physical constants static float constexpr GravityMagnitude = 9.80f; // m/s static vec2f constexpr Gravity = vec2f(0.0f, -9.80f); static float constexpr AirMass = 1.2754f; // Kg static float constexpr WaterMass = 1000.0f; // Kg static float constexpr AirPressureAtSeaLevel = 101325.0f; // Pa static float constexpr Temperature0 = 298.15f; // 25C reference // Spring dynamics static float constexpr SpringReductionFraction = 0.5f; static float constexpr SpringDampingCoefficient = 0.03f; static float constexpr GlobalDamping = 0.00010749653315f; // Adjustable parameters with min/max ranges float NumMechanicalDynamicsIterationsAdjustment; // 0.5 - 3.0 float SpringStiffnessAdjustment; // 0.001 - 2.0 float SpringDampingAdjustment; // 0.001 - 4.0 float SpringStrengthAdjustment; // 0.01 - 50.0 float ElasticityAdjustment; // 0.0 - 10.0 float StaticFrictionAdjustment; // 0.0 - 10.0 float KineticFrictionAdjustment; // 0.0 - 10.0 // Fluid dynamics float AirDensityAdjustment; // 0.001 - 1000.0 float WaterDensityAdjustment; // 0.001 - 100.0 float WaterIntakeAdjustment; // 0.001 - 10.0 float WaterDiffusionSpeedAdjustment;// 0.001 - 2.0 }; ``` -------------------------------- ### Quad Building with Intrinsics Notes Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/NPCs.txt Notes on using SIMD intrinsics for quad building, including specific instructions for loading, shuffling, and replicating data. ```Assembly - To load into high/low: loadh/l - To copy perp into all 4 parts of register: shuffle_pd(p, p, 0) - To replicate halfW into all four slots: setp ``` -------------------------------- ### Define Benchmark Executable and Dependencies Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/Sources/Benchmarks/CMakeLists.txt Configures the source files, include directories, and linked libraries for the Benchmarks executable. ```cmake set (BENCHMARK_SOURCES AutoTexturization.cpp DiffuseLight.cpp DivisionByZero.cpp GameMath.cpp ImageTools.cpp Logarithm.cpp MakeAABBWeightedUnion.cpp PrecalculatedFunction.cpp SingleVectorNormalization.cpp Step.cpp TopN.cpp UpdateSpringForces.cpp Utils.cpp Utils.h VectorNormalization.cpp ) source_group(" " FILES ${BENCHMARK_SOURCES}) add_executable (Benchmarks ${BENCHMARK_SOURCES}) target_include_directories(Benchmarks PRIVATE .) target_link_libraries (Benchmarks Core Game Simulation #GPUCalcLib benchmark::benchmark benchmark::benchmark_main ${OPENGL_LIBRARIES} ${ADDITIONAL_LIBRARIES}) ``` -------------------------------- ### Deploy Data Files Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/Sources/Benchmarks/CMakeLists.txt Copies the Data directory to the build output directory. ```cmake message (STATUS "Copying data files for Benchmarks...") file(COPY "${CMAKE_SOURCE_DIR}/Data" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/Release") ``` -------------------------------- ### Publishing Behavior Change TODO Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/NPCs.txt Addresses the need to publish behavior changes upon human initialization. This requires `CurrentlySelectedNpcId` and auto-selection logic from LabController. ```cpp + Publishing of behavior change at human initialization + Need CurrentlySelectedNpcId, opt + Auto-select from LabController at BeginPlacement, and reset at Abort ``` -------------------------------- ### Configure wxWidgets with CMake Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Windows.md Use this command to generate the Visual Studio solution for wxWidgets with specific build flags. ```batch cd %BUILD_ROOT% mkdir wxWidgets-3.1.4 cd wxWidgets-3.1.4 cmake %SOURCE_ROOT%\wxWidgets -D wxBUILD_OPTIMISE=ON -D wxBUILD_SHARED=OFF -D wxBUILD_USE_STATIC_RUNTIME=ON -D wxUSE_LIBJPEG=sys -D wxUSE_LIBPNG=sys -D wxUSE_ZLIB=sys -D wxUSE_LIBTIFF=OFF -D wxUSE_EXPAT=OFF -D wxUSE_PNM=OFF -D wxUSE_GIF=OFF -D wxUSE_PCX=OFF -D wxUSE_IFF=OFF -D ZLIB_ROOT=%SDK_ROOT%\ZLib-1.2.11 -D JPEG_ROOT=%SDK_ROOT%\jpeg-9d -D PNG_ROOT=%SDK_ROOT%\LibPNG-1.6.37 -D CMAKE_POLICY_DEFAULT_CMP0074=NEW -D CMAKE_LIBRARY_ARCHITECTURE=x64 -D CMAKE_INSTALL_PREFIX=%SDK_ROOT%\wxWidgets-3.1.4 ``` -------------------------------- ### Preferences Dialog Implementation Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/ShipBuilder TODO.txt Details the implementation of the Preferences dialog, including handling canvas background color and new ship size. ```C++ ::Open() gets both Controller and WorkbenchState ``` ```C++ OnOk: just store new ship size (taking it from UI) ``` ```C++ OnCancel: revert bg color to old saved in session ``` ```C++ Controller: Setter for color (which talks to WorkbenchState and View) and for ship size (which just talks to WorkbenchState) ``` -------------------------------- ### Ship Render Upload Logic Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/NPCs.txt Handles the upload of newly generated InteriorView texture quads to the GPU and applies them to the ship's persistent InteriorView texture. This is done on a separate thread for performance. ```cpp Ship::RenderUpload(): gives (std::move) the list to ShipRenderContext which will a) upload to texture as subtextures (on thread!), and b) apply to own Interior view texture (so that it's also persistent across view switches) ``` -------------------------------- ### Set GDK_BACKEND environment variable Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Ubuntu.md Configures the GDK_BACKEND to x11 to ensure compatibility with Wayland-based desktop environments. ```bash export GDK_BACKEND=x11 ``` -------------------------------- ### CMake Configuration Output Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/BUILD-Windows.md Expected output after running the CMake configuration command for wxWidgets. ```text -- Building for: Visual Studio 16 2019 -- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.19043. -- The C compiler identification is MSVC 19.28.29913.0 -- The CXX compiler identification is MSVC 19.28.29913.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- cotire 1.8.0 loaded. -- Found ZLIB: optimized;C:/Users/FSUser/source/SDK/ZLib-1.2.11/lib/x64/zlibstatic.lib;debug;C:/Users/FSUser/source/SDK/ZLib-1.2.11/lib/x64/zlibstaticd.lib (found version "1.2.11") -- Found JPEG: optimized;C:/Users/FSUser/source/SDK/jpeg-9d/lib/x64/jpeg.lib;debug;C:/Users/FSUser/source/SDK/jpeg-9d/lib/x64/jpegd.lib (found version "90") -- Found PNG: optimized;C:/Users/FSUser/source/SDK/LibPNG-1.6.37/lib/x64/libpng16_static.lib;debug;C:/Users/FSUser/source/SDK/LibPNG-1.6.37/lib/x64/libpng16_staticd.lib (found version "1.6.37") ... -- Check size of unsigned short -- Check size of unsigned short - done -- Searching 16 bit integer - Using unsigned short -- Check if the system is big endian - little endian -- Which libraries should wxWidgets use? wxUSE_STL: OFF (use C++ STL classes) wxUSE_REGEX: builtin (enable support for wxRegEx class) wxUSE_ZLIB: sys (use zlib for LZW compression) wxUSE_EXPAT: OFF (use expat for XML parsing) wxUSE_LIBJPEG: sys (use libjpeg (JPEG file format)) wxUSE_LIBPNG: sys (use libpng (PNG image format)) wxUSE_LIBTIFF: OFF (use libtiff (TIFF file format)) wxUSE_LIBLZMA: OFF (use liblzma for LZMA compression) -- Configured wxWidgets 3.1.4 for Windows-10.0.19043 Min OS Version required at runtime: Windows Vista / Windows Server 2008 (x64 Edition) Which GUI toolkit should wxWidgets use? msw Should wxWidgets be compiled into single library? OFF Should wxWidgets be linked as a shared library? OFF Should wxWidgets support Unicode? ON What wxWidgets compatibility level should be used? 3.0 -- Configuring done -- Generating done -- Build files have been written to: C:/Users/FSUser/source/build/wxWidgets-3.1.4 ``` -------------------------------- ### NPC Placement Tools Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/NPCs.txt Details the tools available for NPC placement: NewNpc (with polymorphic hierarchy for Human and Furniture) and MoveNpc (with states like Hovering and Moving). Includes error cursor and offset update fixes. ```cpp + Tools: + NewNpc: polymorphic hierarchy, Human and Furniture which just differ in tiny protected method for starting + Better error cursor + MoveNpc + States: + Hovering + CandidateNpc: as long as set, it's highlighted + Moving + PickedObject + Deinitialize: un-highlight + Fix: mouse move after npc picked does not update offset + RemoveNpc ``` -------------------------------- ### Configure UILib CMake Library Source: https://github.com/gabrielegiuseppini/floating-sandbox/blob/master/Sources/UILib/CMakeLists.txt Defines the source files and build settings for the UILib library, including wxWidgets dependencies. ```cmake set (UI_LIB_SOURCES BitmapButton.h BitmappedCheckbox.h BitmapPopupButton.h BitmapRadioButton.h BitmapToggleButton.h EditSpinBox.h ElectricalElementControl.cpp ElectricalElementControl.h HighlightableTextButton.h ImageLoadDialog.cpp ImageLoadDialog.h ImageLoader.cpp ImageLoader.h ImageSaveDialog.cpp ImageSaveDialog.h LayoutHelper.h LocalizationManager.cpp LocalizationManager.h LoggingDialog.cpp LoggingDialog.h ScalarTimeSeriesProbeControl.cpp ScalarTimeSeriesProbeControl.h ShipDescriptionDialog.cpp ShipDescriptionDialog.h ShipLoadDialog.cpp ShipLoadDialog.h ShipPreviewWindow.cpp ShipPreviewWindow.h ShipSaveDialog.cpp ShipSaveDialog.h SliderControl.h StandardSystemPaths.cpp StandardSystemPaths.h Style.h TextValidators.h UnderConstructionDialog.cpp UnderConstructionDialog.h UnFocusablePanel.h UnFocusableScrollablePanel.h WxHelpers.cpp WxHelpers.h ) source_group(" " FILES ${UI_LIB_SOURCES}) add_library (UILib ${UI_LIB_SOURCES}) target_include_directories(UILib PRIVATE .) target_include_directories(UILib PRIVATE ${wxWidgets_INCLUDE_DIRS}) target_compile_definitions(UILib PRIVATE "${wxWidgets_DEFINITIONS}") target_link_libraries (UILib Core ${wxWidgets_LIBRARIES} ${ADDITIONAL_LIBRARIES}) ```