Creating 3D Horror in a 2D Engine
When people think of GameMaker Studio 2, they usually think of 2D games. Platformers, top-down adventures, maybe some pixel art RPGs. But what if I told you that you could build a fully 3D multiplayer horror game with skeletal animations, dynamic lighting, and custom shaders—all within GameMaker?
That's exactly what Dedin's Nightmare: UNITED is: a cooperative multiplayer survival horror game built entirely in GameMaker Studio 2. It requires two players working together to solve puzzles and survive through horror-themed levels.
The 3D Challenge
GameMaker isn't traditionally a 3D engine, but it has the primitives you need: vertex buffers, matrix transformations, and shader support. The real challenge is building the infrastructure on top of those primitives.
Custom SMF System
The game uses the SMF (SnidRS Model Format) system, a custom 3D model format that supports:
- Vertex Buffer Management: Efficient rendering of 3D models
- Skeletal Animation: Character animations with dual quaternion skinning
- OBJ Import: Loading models from Blender and other 3D tools
- Collision Detection: Ray casting and triangle intersection for physics
// Example: Loading and animating a 3D model
var model = smf_model_load("models/enemy_ghost.smf");
smf_animation_play(model, "walk", true);
smf_model_draw(model, x, y, z);
Multiplayer Architecture
The game features IP-based networking with a client-server architecture. Key features include:
- Player role assignment (Dedin vs. Kasper characters)
- Network data synchronization for positions, animations, and states
- Latency monitoring and compensation
- Shared inventory and puzzle state across clients
Lighting and Atmosphere
Horror games live and die by their atmosphere. The game includes:
Dynamic Lighting System
- Real-time 3D point lights with fog integration
- Flashlight mechanics with battery drainage
- Zone-based darkness triggers
- Shader-based lighting calculations in GLSL
Visual Effects
- BktGlitch System: Screen distortion and glitch effects for horror moments
- Custom Shaders: Water rendering, color overlays, fog effects
- Post-Processing: Camera static effects for surveillance cameras
Enemy AI and Gameplay
The game features multiple enemy types with different behaviors:
- Ghost: Phase through walls and surprise players
- Psycho: AI pathfinding to chase players through levels
- Alien: Fast-moving creatures that hunt in packs
- Robot: Patrolling sentries with predictable patterns
- Creep: Slow but deadly melee attackers
Cooperative Puzzle Design
What makes the game unique is its focus on cooperation. Many puzzles require both players:
- One player monitoring cameras while the other navigates
- Switch-based doors that require coordination
- Shared inventory management (limited item slots)
- Revival mechanics when a player goes down
Technical Lessons Learned
Performance Optimization
3D rendering in GameMaker can be demanding. Key optimizations included:
- Culling objects outside the camera frustum
- Level-of-detail (LOD) for distant models
- Efficient vertex buffer usage
- Minimal draw calls through batching
Audio Management
Horror relies heavily on audio. I implemented:
- Audio groups for efficient memory management (music, SFX, voice)
- 3D positional audio for immersive sound
- Zone-based music triggers
- Adaptive audio that responds to gameplay events
The Result
Dedin's Nightmare: UNITED proves that with enough creativity and technical knowledge, you can push engines far beyond their intended use cases. While dedicated 3D engines like Unity or Unreal might offer more out-of-the-box features, there's something satisfying about building your own 3D infrastructure from scratch.
Check out the full project at https://dedin1.wixsite.com/devblog