Skip to content

Commit bdc1845

Browse files
committed
add in the dependences install scripts.
1 parent 815aa79 commit bdc1845

File tree

4 files changed

+345
-29
lines changed

4 files changed

+345
-29
lines changed

attachments/simple_engine/audio_system.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,6 @@ class OpenALAudioOutputDevice : public AudioOutputDevice {
183183
this->channels = channels;
184184
this->bufferSize = bufferSize;
185185

186-
std::cout << "Initializing OpenAL audio output device: " << sampleRate << "Hz, "
187-
<< channels << " channels, buffer size: " << bufferSize << std::endl;
188-
189186
// Initialize OpenAL
190187
device = alcOpenDevice(nullptr); // Use default device
191188
if (!device) {
@@ -359,8 +356,6 @@ class OpenALAudioOutputDevice : public AudioOutputDevice {
359356
}
360357

361358
void AudioThreadFunction() {
362-
std::cout << "OpenAL audio playback thread started" << std::endl;
363-
364359
// Calculate sleep time for audio buffer updates (in milliseconds)
365360
const auto sleepTime = std::chrono::milliseconds(
366361
static_cast<int>((bufferSize * 1000) / sampleRate / 8) // Eighth buffer time for responsiveness
@@ -370,8 +365,6 @@ class OpenALAudioOutputDevice : public AudioOutputDevice {
370365
ProcessAudioBuffer();
371366
std::this_thread::sleep_for(sleepTime);
372367
}
373-
374-
std::cout << "OpenAL audio playback thread stopped" << std::endl;
375368
}
376369

377370
void ProcessAudioBuffer() {
@@ -1364,7 +1357,6 @@ void AudioSystem::startAudioThread() {
13641357
audioThreadRunning.store(true);
13651358

13661359
audioThread = std::thread(&AudioSystem::audioThreadLoop, this);
1367-
std::cout << "Audio processing thread started" << std::endl;
13681360
}
13691361

13701362
void AudioSystem::stopAudioThread() {
@@ -1384,7 +1376,6 @@ void AudioSystem::stopAudioThread() {
13841376
}
13851377

13861378
audioThreadRunning.store(false);
1387-
std::cout << "Audio processing thread stopped" << std::endl;
13881379
}
13891380

13901381
void AudioSystem::audioThreadLoop() {

attachments/simple_engine/engine.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -564,11 +564,6 @@ void Engine::GenerateBallMaterial() {
564564

565565
// Very low bounciness (0.05 to 0.15 for 85-95% momentum loss per bounce)
566566
ballMaterial.bounciness = 0.05f + dis(gen) * 0.1f;
567-
568-
std::cout << "Generated ball material - Albedo: (" << ballMaterial.albedo.x << ", "
569-
<< ballMaterial.albedo.y << ", " << ballMaterial.albedo.z << "), "
570-
<< "Metallic: " << ballMaterial.metallic << ", Roughness: " << ballMaterial.roughness
571-
<< ", Bounciness: " << ballMaterial.bounciness << std::endl;
572567
}
573568

574569
void Engine::InitializePhysicsScaling() {
@@ -585,12 +580,6 @@ void Engine::InitializePhysicsScaling() {
585580
physicsScaling.physicsTimeScale = 1.0f; // Keep time scale normal
586581
physicsScaling.gravityScale = 1.0f; // Keep gravity proportional to scale
587582

588-
std::cout << "Physics scaling initialized:" << std::endl;
589-
std::cout << " Game units to meters: " << physicsScaling.gameUnitsToMeters << std::endl;
590-
std::cout << " Force scale: " << physicsScaling.forceScale << std::endl;
591-
std::cout << " Time scale: " << physicsScaling.physicsTimeScale << std::endl;
592-
std::cout << " Gravity scale: " << physicsScaling.gravityScale << std::endl;
593-
594583
// Apply scaled gravity to physics system
595584
glm::vec3 realWorldGravity(0.0f, -9.81f, 0.0f);
596585
glm::vec3 scaledGravity = ScaleGravityForPhysics(realWorldGravity);
@@ -679,12 +668,6 @@ void Engine::ThrowBall(float mouseX, float mouseY) {
679668
spawnPosition.y += posDis(gen);
680669
spawnPosition.z += posDis(gen);
681670

682-
// Log camera, screen center, and spawn positions for debugging
683-
std::cout << "CAMERA POSITION: (" << cameraPosition.x << ", " << cameraPosition.y << ", " << cameraPosition.z << ")" << std::endl;
684-
std::cout << "SCREEN CENTER WORLD POS: (" << screenCenterWorldPos.x << ", " << screenCenterWorldPos.y << ", " << screenCenterWorldPos.z << ")" << std::endl;
685-
std::cout << "BALL SPAWN POSITION: (" << spawnPosition.x << ", " << spawnPosition.y << ", " << spawnPosition.z << ")" << std::endl;
686-
std::cout << "THROW DIRECTION: (" << throwDirection.x << ", " << throwDirection.y << ", " << throwDirection.z << ")" << std::endl;
687-
std::cout << "MOUSE NDC: (" << ndcX << ", " << ndcY << ")" << std::endl;
688671
std::uniform_real_distribution<float> spinDis(-10.0f, 10.0f);
689672
std::uniform_real_distribution<float> forceDis(15.0f, 35.0f); // Stronger force range for proper throwing feel
690673

@@ -757,9 +740,6 @@ void Engine::ProcessPendingBalls() {
757740
glm::vec3 throwImpulse = pendingBall.throwDirection * pendingBall.throwForce;
758741
rigidBody->ApplyImpulse(throwImpulse, glm::vec3(0.0f));
759742
rigidBody->SetAngularVelocity(pendingBall.randomSpin);
760-
761-
std::cout << "Ball " << pendingBall.ballName << " created successfully with force "
762-
<< pendingBall.throwForce << std::endl;
763743
}
764744
}
765745

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
#!/bin/bash
2+
3+
# Install script for Simple Game Engine dependencies on Linux
4+
# This script installs all required dependencies for building the Simple Game Engine
5+
6+
set -e # Exit on any error
7+
8+
echo "Installing Simple Game Engine dependencies for Linux..."
9+
10+
# Detect the Linux distribution
11+
if [ -f /etc/os-release ]; then
12+
. /etc/os-release
13+
OS=$NAME
14+
VER=$VERSION_ID
15+
elif type lsb_release >/dev/null 2>&1; then
16+
OS=$(lsb_release -si)
17+
VER=$(lsb_release -sr)
18+
elif [ -f /etc/lsb-release ]; then
19+
. /etc/lsb-release
20+
OS=$DISTRIB_ID
21+
VER=$DISTRIB_RELEASE
22+
elif [ -f /etc/debian_version ]; then
23+
OS=Debian
24+
VER=$(cat /etc/debian_version)
25+
else
26+
OS=$(uname -s)
27+
VER=$(uname -r)
28+
fi
29+
30+
echo "Detected OS: $OS $VER"
31+
32+
# Function to install dependencies on Ubuntu/Debian
33+
install_ubuntu_debian() {
34+
echo "Installing dependencies for Ubuntu/Debian..."
35+
36+
# Update package list
37+
sudo apt update
38+
39+
# Install build essentials
40+
sudo apt install -y build-essential cmake git
41+
42+
# Install Vulkan SDK
43+
echo "Installing Vulkan SDK..."
44+
wget -qO - https://packages.lunarg.com/lunarg-signing-key-pub.asc | sudo apt-key add -
45+
sudo wget -qO /etc/apt/sources.list.d/lunarg-vulkan-focal.list https://packages.lunarg.com/vulkan/lunarg-vulkan-focal.list
46+
sudo apt update
47+
sudo apt install -y vulkan-sdk
48+
49+
# Install other dependencies
50+
sudo apt install -y \
51+
libglfw3-dev \
52+
libglm-dev \
53+
libopenal-dev \
54+
libktx-dev \
55+
libstb-dev
56+
57+
# Install Slang compiler (for shader compilation)
58+
echo "Installing Slang compiler..."
59+
if [ ! -f /usr/local/bin/slangc ]; then
60+
SLANG_VERSION="2024.1.21"
61+
wget "https://github.com/shader-slang/slang/releases/download/v${SLANG_VERSION}/slang-${SLANG_VERSION}-linux-x86_64.tar.gz"
62+
tar -xzf "slang-${SLANG_VERSION}-linux-x86_64.tar.gz"
63+
sudo cp slang/bin/slangc /usr/local/bin/
64+
sudo chmod +x /usr/local/bin/slangc
65+
rm -rf slang "slang-${SLANG_VERSION}-linux-x86_64.tar.gz"
66+
fi
67+
}
68+
69+
# Function to install dependencies on Fedora/RHEL/CentOS
70+
install_fedora_rhel() {
71+
echo "Installing dependencies for Fedora/RHEL/CentOS..."
72+
73+
# Install build essentials
74+
sudo dnf install -y gcc gcc-c++ cmake git
75+
76+
# Install Vulkan SDK
77+
echo "Installing Vulkan SDK..."
78+
sudo dnf install -y vulkan-devel vulkan-tools
79+
80+
# Install other dependencies
81+
sudo dnf install -y \
82+
glfw-devel \
83+
glm-devel \
84+
openal-soft-devel
85+
86+
# Note: Some packages might need to be built from source on RHEL/CentOS
87+
echo "Note: Some dependencies (libktx, libstb, tinygltf) may need to be built from source"
88+
echo "Please refer to the project documentation for manual installation instructions"
89+
}
90+
91+
# Function to install dependencies on Arch Linux
92+
install_arch() {
93+
echo "Installing dependencies for Arch Linux..."
94+
95+
# Update package database
96+
sudo pacman -Sy
97+
98+
# Install build essentials
99+
sudo pacman -S --noconfirm base-devel cmake git
100+
101+
# Install dependencies
102+
sudo pacman -S --noconfirm \
103+
vulkan-devel \
104+
glfw-wayland \
105+
glm \
106+
openal
107+
108+
# Install AUR packages (requires yay or another AUR helper)
109+
if command -v yay &> /dev/null; then
110+
yay -S --noconfirm libktx stb
111+
else
112+
echo "Note: Please install yay or another AUR helper to install libktx and stb packages"
113+
echo "Alternatively, build these dependencies from source"
114+
fi
115+
}
116+
117+
# Install dependencies based on detected OS
118+
case "$OS" in
119+
"Ubuntu"* | "Debian"* | "Linux Mint"*)
120+
install_ubuntu_debian
121+
;;
122+
"Fedora"* | "Red Hat"* | "CentOS"* | "Rocky"*)
123+
install_fedora_rhel
124+
;;
125+
"Arch"* | "Manjaro"*)
126+
install_arch
127+
;;
128+
*)
129+
echo "Unsupported Linux distribution: $OS"
130+
echo "Please install the following dependencies manually:"
131+
echo "- CMake (3.29 or later)"
132+
echo "- Vulkan SDK"
133+
echo "- GLFW3 development libraries"
134+
echo "- GLM (OpenGL Mathematics) library"
135+
echo "- OpenAL development libraries"
136+
echo "- KTX library"
137+
echo "- STB library"
138+
echo "- tinygltf library"
139+
echo "- Slang compiler"
140+
exit 1
141+
;;
142+
esac
143+
144+
echo ""
145+
echo "Dependencies installation completed!"
146+
echo ""
147+
echo "To build the Simple Game Engine:"
148+
echo "1. cd to the simple_engine directory"
149+
echo "2. mkdir build && cd build"
150+
echo "3. cmake .."
151+
echo "4. make -j$(nproc)"
152+
echo ""
153+
echo "Or use the provided CMake build command:"
154+
echo "cmake --build cmake-build-debug --target SimpleEngine -j 10"

0 commit comments

Comments
 (0)