Commit graph

56 commits

Author SHA1 Message Date
Kelsi
6d22f4249f Add 3D character model preview to character creation screen
Render an animated M2 character model in the creation screen using a
dedicated CharacterRenderer with an offscreen FBO. Preview updates on
race/gender/appearance changes, supports mouse-drag rotation, and
composites skin, face, hair scalp, and underwear textures from
CharSections.dbc. Extracts getPlayerModelPath() to a shared free
function in game/character.
2026-02-05 14:58:45 -08:00
Kelsi
0ff34364b6 Add sqlite single-player persistence with autosave 2026-02-05 14:55:42 -08:00
Kelsi
c89fccdfeb Use created character data and DB start items/spells 2026-02-05 14:35:12 -08:00
Kelsi
2db690a866 Fix crash in character creation by deferring callback to next update
The charCreateCallback was firing synchronously during ImGui render,
causing a state transition before the create screen's ImGui::End() was
called. Defer the callback to GameHandler::update() and ensure update()
runs during CHARACTER_CREATION and CHARACTER_SELECTION states.
2026-02-05 14:18:41 -08:00
Kelsi
0605d1522d Add character creation screen with race/class/appearance customization
Implements a full character creation UI integrated into the existing flow.
In single-player mode, auth screen now goes to character creation before
entering the world. In online mode, a "Create Character" button on the
character selection screen sends CMSG_CHAR_CREATE to the server. Includes
WoW 3.3.5a race/class combo validation and appearance range limits.
2026-02-05 14:13:48 -08:00
Kelsi
e6e3093467 Emulate server loot/xp and combat feedback in single-player 2026-02-05 14:01:26 -08:00
Kelsi
738dafb65b Add system chat for key game events 2026-02-05 13:22:15 -08:00
Kelsi
5ef11fdc7d Fix auth protocol to match real WoW 3.3.5a client format
Three critical bugs fixed:
- LOGON_CHALLENGE request: set protocol byte to 0x03 (was 0x00) and
  reverse FourCC strings (game/platform/os/locale) to match real client
- Response parsers: remove double-read of opcode byte that shifted all
  field reads by one, preventing successful auth with real servers
- LOGON_PROOF response sizes: success=32 bytes, failure=4 bytes to match
  TrinityCore/AzerothCore format

Also adds missing auth result codes (0x13-0x20, 0xFF) including
IGR_WITHOUT_BNET (0x17) which Warmane was returning.
2026-02-05 12:39:34 -08:00
Kelsi
bc9c7f09b1 Fix non-blocking TCP connect for remote servers and persist login info between sessions 2026-02-05 12:25:00 -08:00
Kelsi
a52e28191e Improve auth error feedback with specific failure reasons, version mismatch details, and connection timeout 2026-02-05 12:17:09 -08:00
Kelsi
78442f8aea Add XP tracking with level-up, kill XP formula, and server-compatible SMSG_LOG_XPGAIN support 2026-02-05 12:07:58 -08:00
Kelsi
ed5d10ec01 Add single-player local combat system with auto-attack, NPC aggro, and death 2026-02-05 12:01:03 -08:00
Kelsi
b16578e2b9 Fix single-player NPC loading outside Goldshire 2026-02-04 23:37:30 -08:00
Kelsi
28a8e806e1 Fix WMO spawn presets to avoid terrain snapping 2026-02-04 23:30:03 -08:00
Kelsi
ae37e5592e Load single-player NPC spawns from local AzerothCore SQL assets 2026-02-04 23:18:50 -08:00
Kelsi
affcfcfce1 Add interactive world map with continent/zone navigation 2026-02-04 22:27:45 -08:00
Kelsi
47945451be Rewrite minimap to use pre-baked BLP tile textures from MPQ archives
Replace the 3D top-down rendered minimap with WoW's native pre-rendered
BLP tile textures loaded via md5translate.trs. Tiles are composited into
a 3x3 grid FBO with proper axis transposition matching the ADT terrain
convention. The screen shader provides camera-rotation, circular mask,
directional player arrow, and 20% transparency. Minimap is now on by
default with the N toggle key removed.
2026-02-04 20:06:27 -08:00
Kelsi
d8e2becbaa Add teleporter panel and server-compatible coordinate conversions
Teleporter panel (T key) lets the player teleport between Goldshire,
Stormwind Gate, Ironforge, and Westfall in single-player mode. Adds
serverToCanonical/canonicalToServer conversion at the network packet
boundary so positions are compatible with TrinityCore/MaNGOS/AzerothCore
emulator servers.
2026-02-04 18:27:52 -08:00
Kelsi
6690910712 Unify coordinate systems with canonical WoW world coordinates
Centralizes all coordinate conversions in core/coordinates.hpp with
proper canonical WoW coords (+X=North, +Y=West, +Z=Up). Fixes critical
tile calculation bug that was loading wrong surrounding tiles during
terrain streaming, and fixes position sync sending ADT-raw format
instead of canonical coordinates to the server.
2026-02-04 17:37:28 -08:00
Kelsi
ee9efa3478 Stabilize player shadows and improve foot contact 2026-02-04 16:41:40 -08:00
Kelsi
54eac50c4d Add player character shadow casting in shadow pass 2026-02-04 16:36:03 -08:00
Kelsi
ab4cb878ea Improve shadow stability and reduce foliage pop-in 2026-02-04 16:30:24 -08:00
Kelsi
979c0b5592 Stabilize shadows and soften foliage shadow casting 2026-02-04 16:22:18 -08:00
Kelsi
f17b15395d Implement shadow mapping pipeline for terrain and models 2026-02-04 16:08:35 -08:00
Kelsi
1f672e1d73 Add HDR post-process FBO pipeline with 4x MSAA
Render the world into an off-screen MSAA RGBA16F framebuffer, resolve
to a regular texture, then blit to screen via a fullscreen quad shader.
This sets up the infrastructure for future HDR tonemapping and SSAO
(depth texture preserved for sampling). Currently a passthrough until
HDR light sources are added. Login screen bypasses the FBO and renders
directly to the default framebuffer.
2026-02-04 15:21:04 -08:00
Kelsi
aeccddddeb Add centralized anisotropic filtering, fog, and Blinn-Phong specular to all renderers
Anisotropic filtering now queries GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT once
and applies via a single applyAnisotropicFiltering() utility, replacing
hardcoded calls across all renderers. Fog (sky horizon color, 100-600
range) and Blinn-Phong specular highlights are added to WMO, M2, and
character shaders for visual parity with terrain. Shadow sampling
plumbing (sampler2DShadow with 3x3 PCF) is wired into all three shaders
gated by uShadowEnabled, ready for a future shadow map pass.
2026-02-04 15:05:46 -08:00
Kelsi
c9adcd3d96 Add smoke particle emitters with ember sparks and enable 4x MSAA
Replace UV scroll workaround for chimney smoke with proper GL_POINTS
particle system. Smoke particles rise, expand, drift, and fade over
4-7 seconds. One in eight particles spawns as a bright orange/red
ember spark. Enable 4x multisample antialiasing for smoother edges
on player models, fences, and foliage.
2026-02-04 14:37:32 -08:00
Kelsi
11a4958e84 Add M2 global sequence animation, smoke UV scroll, and fix WMO floor detection
- Parse global sequence durations from M2 binary and use them in bone
  interpolation so torches, candles, and other env doodads animate.
- Add UV scroll shader effect for smoke models (HouseSmoke, SmokeStack)
  as a workaround for unimplemented M2 particle emitters.
- Tighten WMO floor probe heights to prevent multi-story buildings from
  returning the wrong floor, fixing player clipping through inn floors
  and camera locking onto the second floor.
- Use player ground level as reference for camera orbit floor collision
  so the camera doesn't fight upper floors in buildings.
2026-02-04 14:06:59 -08:00
Kelsi
6ca9e9024a Add loading screen, fix tree/foliage collision, jump buffering, and fence rotation
- Loading screen stays visible until all terrain tiles finish streaming;
  character spawns only after terrain is loaded and Z-snapped to ground
- Reduce tree trunk collision bounds (5% of canopy, capped at 5.0) and
  make all small/medium trees, bushes, lily pads, and foliage walkthrough
- Add jump input buffering (150ms) and coyote time (100ms) for responsive jumps
- Fix fence orientation by adding +180° heading rotation
- Increase terrain load radius from 1 to 2 (5x5 tile grid)
- Add hearthstone callback for single-player camera reset
2026-02-04 13:29:27 -08:00
Kelsi
f7cd871895 Add M2 idle animation variations, dedup instances, fix terrain textures
- Add idle variation system: creatures randomly play Stand variations
  (stretch, flap, look around) every 4-10s, then return to idle loop
- Deduplicate M2 instances at same position (was hidden before animation
  made duplicates visible with different random start times)
- Adaptive M2 render distance: 350 units in open terrain, 180 in cities
- Restore terrain sampler-to-unit uniform bindings lost during texture
  bind optimization (roads were invisible under grass)
- Safety: clamp bone count to 128, validate sequence indices, sanitize scale
2026-02-04 11:50:18 -08:00
Kelsi
15fa055726 Add M2 skeletal animation and fix terrain texture layers
- Implement GPU bone skinning for M2 doodads/creatures (gryphons, birds)
- Store bone hierarchy and animation keyframes per model
- Compute bone matrices per-instance with keyframe interpolation
- Upload bone weights/indices in vertex buffer, skinning in vertex shader
- Fix terrain texture rendering: restore sampler-to-unit uniform bindings
  removed during texture bind optimization (roads were invisible)
2026-02-04 11:40:00 -08:00
Kelsi
4bc5064515 Add spellbook, fix WMO floor clipping, and polish UI/visuals
- Add spellbook screen (P key) with Spell.dbc name lookup and action bar assignment
- Default Attack and Hearthstone spells available in single player
- Fix WMO floor clipping (gryphon roost) by tightening ceiling rejection threshold
- Darken ocean water, increase wave motion and opacity
- Add M2 model distance fade-in to prevent pop-in
- Reposition chat window, add slash/enter key focus
- Remove debug key commands (keep only F1 perf HUD, N minimap)
- Performance: return chat history by const ref, use deque for O(1) pop_front
2026-02-04 11:31:08 -08:00
Kelsi
c49bb58e47 Add gameplay systems: combat, spells, groups, loot, vendors, and UI
Implement ~70 new protocol opcodes across 5 phases while maintaining
full 3.3.5a private server compatibility:

- Phase 1: Server-aware targeting (CMSG_SET_SELECTION), player/creature
  name queries, CMSG_SET_ACTIVE_MOVER after login
- Phase 2: Auto-attack, melee/spell damage parsing, health/mana/power
  tracking from UPDATE_OBJECT fields, floating combat text
- Phase 3: Spell casting, action bar (12 slots, keys 1-=), cast bar,
  cooldown tracking, aura/buff system with cancellation
- Phase 4: Group invite/accept/decline/leave, party frames UI,
  /invite chat command
- Phase 5: Loot window, NPC gossip dialog, vendor buy/sell interface

Also: disable debug HUD/panels by default, gate 3D rendering to
IN_GAME state only, fix window resize not updating UI positions.
2026-02-04 10:31:03 -08:00
Kelsi
6bf3fa4ed4 Add Windows cross-platform support alongside Linux
Replace POSIX-specific socket and process APIs with portable
abstractions so the project builds on both Windows and Linux.

- Add include/network/net_platform.hpp: Winsock2/POSIX socket
  abstraction (socket types, non-blocking, error handling,
  WSAStartup lifecycle)
- Add include/platform/process.hpp: CreateProcess/fork+exec
  abstraction for spawning ffplay subprocesses
- Update network module (tcp_socket, world_socket) to use
  portable socket helpers instead of raw POSIX calls
- Update audio module (music_manager, footstep_manager,
  activity_sound_manager) to use portable process helpers
  instead of fork/exec/kill/waitpid
- Replace hardcoded /tmp/ paths with std::filesystem::temp_directory_path()
- Link ws2_32 and SDL2main on Windows in CMakeLists.txt
2026-02-03 22:25:41 -08:00
Kelsi
d0dac0df07 Refine water rendering, swimming, and underwater visuals 2026-02-03 20:40:59 -08:00
Kelsi
8bc50818a9 Implement activity SFX and decouple camera orbit from movement facing 2026-02-03 19:49:56 -08:00
Kelsi
dfc29cad10 Add intent-driven strafe animation selection and movement state hooks 2026-02-03 19:29:11 -08:00
Kelsi
871172d63e Tune collision behavior for ramps, props, and structural walls 2026-02-03 19:10:22 -08:00
Kelsi
f00d13bfc0 Improve performance and tune ramp/planter collision behavior 2026-02-03 17:21:04 -08:00
Kelsi
f43e6bf834 Tune planter curb collision and reduce foliage pushback 2026-02-03 16:51:25 -08:00
Kelsi
75046afe47 Add stepped fountain collision for parkour-style climbing 2026-02-03 16:28:33 -08:00
Kelsi
baca09828e Optimize collision queries with spatial grid and improve movement CCD 2026-02-03 16:21:48 -08:00
Kelsi
a3f351f395 Fix camera occlusion and stabilize WMO/M2 collision behavior 2026-02-03 16:04:21 -08:00
Kelsi
d03ff5ee4c Tune collision feel and align M2 movement/camera behavior 2026-02-03 15:17:54 -08:00
Kelsi
dfb1f3cfdc Add WoW-style footsteps and improve third-person movement/collision 2026-02-03 14:55:32 -08:00
Kelsi
54dc27c2ec Add WoW-style camera system with collision and first-person mode
- Implement orbit camera with smooth zoom and collision detection
- Add 50° slope limiting with sliding (prevents mountain climbing)
- Add first-person mode that hides player model and weapons
- Add floor clearance check to prevent camera clipping through ground
- Improve WMO wall collision with proper height range checks
- Add two-sided floor collision detection for WMO geometry
- Increase M2 render distance slightly for better visibility
2026-02-03 14:26:08 -08:00
Kelsi
3e792af3e5 Reduce render distances for better performance
- Terrain load radius: 2 tiles (was 6) - 25 tiles max vs 169
- WMO render distance: 500 units (was 3000)
- M2 doodad distance: 300 units (was 1000)
2026-02-03 13:37:52 -08:00
Kelsi
01bf3b4c08 Add loading screen with random WOWEE splash images
- Add loading screen system with stb_image for JPEG loading
- Two loading screen images (orc and dwarf) randomly selected
- Display loading screen while terrain data loads
- Cache WMO inverse matrices to reduce per-frame computation
- Stub WMO liquid rendering (needs coordinate system fix)
- Update spawn point to Stormwind Trade District
2026-02-03 13:33:31 -08:00
Kelsi
665a73e75f Fix WMO MOHD chunk parsing by adding missing nTextures field
The MOHD header structure was missing the nTextures field at the start,
causing all subsequent field reads to be offset by 4 bytes. This corrupted
bounding box values and caused floor geometry to be incorrectly culled.
2026-02-03 11:46:12 -08:00
Kelsi
a9dd685398 Fix terrain collision by correcting spawn coordinates
- Spawn position changed to (-9080, -100, 100) which is on actual terrain
- The terrain mesh uses WoW coordinates from ADT files directly
- Camera/spawn position must use same coordinate system as terrain
- Cleaned up getHeightAt comments to clarify coordinate system
- Removed debug logging from WMO floor detection
2026-02-02 23:36:49 -08:00