Kingdom Rush Vengeance

Kingdom Rush Vengeance

View Stats:
Game Crushed:./all/gg_views.lua:262: UTF-8 decoding error: Invalid UTF-8
```
Error

./all/gg_views.lua:262: UTF-8 decoding error: Invalid UTF-8

Traceback

./main.lua:857: in function <./main.lua:808>
(C): in function ‘getWrap’
./all/gg_views.lua:262: in function 'get_wrap_lines'
./kr5/game_gui.lua:7454: in function ‘show’
./kr5/game_gui.lua:7021: in function ‘confirm’
./kr5/game_gui.lua:7319: in function ‘on_click’
./lib/love/kui.lua:1434: in function ‘mousereleased’
./kr5/game_gui.lua:1430: in function ‘mousereleased’
./all/game.lua:384: in function 'mousereleased'
./all/director.lua:982: in function 'mousereleased’
./main.lua:577: in function <./main.lua:576>
./main.lua:711: in function <./main.lua:671>
(C): in function 'xpcall'

Last error msgs

[1280419.7399] sound_db.ERROR play() - SOUND HeroBuilderBasicAttack defined but sound sources missing. Missing file during load?
[1280418.9719] sound_db.ERROR play() - SOUND HeroBuilderBasicAttack defined but sound sources missing. Missing file during load?
[1280418.7629] sound_db.ERROR play() - SOUND HeroBuilderBasicAttack defined but sound sources missing. Missing file during load?
[1280417.6796] sound_db.ERROR play() - SOUND HeroBuilderBasicAttack defined but sound sources missing. Missing file during load?
[1280416.4554] sound_db.ERROR play() - SOUND HeroBuilderBasicAttack defined but sound sources missing. Missing file during load?
[1280407.9722] sound_db.ERROR play() - SOUND HeroBuilderBasicAttack defined but sound sources missing. Missing file during load?
[1280407.9029] sound_db.ERROR play() - SOUND HeroBuilderBasicAttack defined but sound sources missing. Missing file during load?
[1280407.0074] sound_db.ERROR play() - SOUND HeroBuilderBasicAttack defined but sound sources missing. Missing file during load?
[1280406.9369] sound_db.ERROR play() - SOUND HeroBuilderBasicAttack defined but sound sources missing. Missing file during load?
[1280405.6855] sound_db.ERROR play() - SOUND HeroBuilderBasicAttack defined but sound sources missing. Missing file during load?
```

It looks like the errors are related to:
1. **UTF-8 Decoding Error**: This might be due to improperly encoded text files or incorrect file encoding settings.
2. **Missing Sound Files**: The logs show multiple instances of missing sound sources for "HeroBuilderBasicAttack," which means the game is trying to play a sound that doesn't exist or wasn't loaded properly.


Here are some possible solutions for the **UTF-8 decoding error** and **missing sound files**:

---

### **1. Fixing the UTF-8 Decoding Error**
**Error message:**
`./all/gg_views.lua:262: UTF-8 decoding error: Invalid UTF-8`

#### **Possible Causes**
- The script (`gg_views.lua`) might contain invalid or corrupted UTF-8 characters.
- The file encoding might be incorrect (e.g., saved as ANSI instead of UTF-8).
- A non-UTF-8 character might have been introduced due to improper handling of special characters.

#### **Solutions**
- **Check File Encoding:**
Open `gg_views.lua` in a text editor (e.g., VS Code, Sublime Text, or Notepad++).
- In **VS Code**:
- Open the file.
- Click the encoding status at the bottom right.
- Select **"Reopen with Encoding" → "UTF-8"**.
- If the file opens correctly, select **"Save with Encoding" → "UTF-8 without BOM"**.

- In **Notepad++**:
- Open the file.
- Click **Encoding** in the top menu.
- Select **Convert to UTF-8** and save.

- **Manually Inspect Line 262**
- Open `gg_views.lua` and go to **line 262**.
- Look for **special characters, accents, or symbols** that might not be encoded correctly.
- Remove or replace the problematic characters.

- **Use Lua’s Built-in UTF-8 Functions (Lua 5.3 and later)**
If the script processes text, you might need to ensure UTF-8 safety using:
```lua
local utf8 = require("utf8")
local clean_text = utf8.len(original_text) and original_text or "Invalid text"
```

---

### **2. Fixing the Missing Sound Files**
**Error message:**
`SOUND HeroBuilderBasicAttack defined but sound sources missing. Missing file during load?`

#### **Possible Causes**
- The sound files might be missing from the game’s asset directory.
- The game might not be loading the sound files correctly due to incorrect paths.
- The sound engine might be failing to initialize properly.

#### **Solutions**
- **Check Sound File Existence**
- Locate where the game stores sound files (usually in `assets/sounds/` or `audio/`).
- Look for missing files (`HeroBuilderBasicAttack.wav`, `.mp3`, `.ogg`, etc.).
- If missing, try adding the correct sound files.
- If you don’t have the files, check the game installation or redownload them.

- **Verify File Paths in Code**
- Open the script where sounds are loaded (probably a `.lua` file related to the game’s audio).
- Find the function that loads `HeroBuilderBasicAttack`.
- Check if the path is correct:
```lua
local attackSound = love.audio.newSource("sounds/HeroBuilderBasicAttack.wav", "static")
```
- If the path is incorrect, fix it based on your game’s file structure.

- **Ensure Audio Engine is Initialized Properly**
- If the game uses **LÖVE (LOVE2D)**, ensure that `love.audio` is initialized in `conf.lua`:
```lua
function love.conf(t)
t.modules.audio = true
end
```
- Try playing another sound file manually to see if the problem is specific to `HeroBuilderBasicAttack` or all sounds.

- **Reinstall or Verify Game Files**
- If you’re using a game engine like Unity, Unreal, or LÖVE, verify the installation.
- If it's a Steam game, verify files:
- Open **Steam Library** → Right-click the game → **Properties** → **Verify Integrity of Game Files**.

---

### **Next Steps**
1. **Fix encoding issues** in `gg_views.lua` by converting it to UTF-8.
2. **Inspect missing sound files** and restore or correct file paths.
3. **Run the game again** and check if the errors persist.