Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
7fcf906
Android: Implement proper DPI-aware scaling and fullscreen mode
automaton82 May 23, 2026
3540920
Android: Fix right-side UI icon overlap with radar minimap
automaton82 May 23, 2026
838dfb6
Android: Implement touch controls and mobile UI improvements
automaton82 May 24, 2026
4d6a259
Android: Fix black screen on resume via robust EGL lifecycle
automaton82 May 24, 2026
4961c61
Android: Fix rendering after resume - restore viewport on EGL surface…
automaton82 May 24, 2026
b4f1496
render: fix CPU-GPU sync stalls causing 20 FPS on mobile
automaton82 May 24, 2026
6e9b29f
Guard Android-specific UI behind __ANDROID__ / isolate menu in separa…
automaton82 May 24, 2026
8e0ffb6
Android: Complete input system overhaul and menu redesign
automaton82 May 24, 2026
f052247
Fix safe zone tile not rendering on maps with custom tilesets
automaton82 May 24, 2026
7880b86
Add minimap colors for wormholes, asteroids, and space station
automaton82 May 24, 2026
7fa6709
Route join/leave messages to notification system on Android
automaton82 May 25, 2026
2e2c7e5
CLAUDE.md: scrub specific repo path references
automaton82 May 25, 2026
1b3a547
Android UI polish, score/flag sync, statbox improvements
automaton82 May 26, 2026
915c2eb
Fix flag touch loop: remove CarryFlags gate
automaton82 May 26, 2026
9c653fa
Add flag pickup/drop notifications for other players
automaton82 May 26, 2026
c094591
Add 15-second chat message timeout for Android
automaton82 May 26, 2026
1db360c
Fix InitialBounty prize loop overriding consumable config settings
automaton82 May 27, 2026
c546e61
Add multi-panel scoreboard display for Android
automaton82 May 27, 2026
434831a
Redesign Android login screen with animated background
automaton82 May 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
210 changes: 210 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
# Development Setup Guide

## Android Development Environment

### Prerequisites
- Android SDK installed (typically at `~/Android/Sdk`)
- Java 17+ (available from Android Studio's bundled JDK)
- Git submodules initialized

### Quick Start

#### 1. Initial Setup
```bash
# Clone and initialize submodules
git clone https://github.com/plushmonkey/nullspace
cd nullspace
git submodule init && git submodule update

# Copy resources (graphics and sound folders) to Android assets
mkdir -p android/app/src/main/assets
cp -r /path/to/graphics android/app/src/main/assets/
cp -r /path/to/sound android/app/src/main/assets/
```

#### 2. Configure Android Project
Create `android/local.properties`:
```properties
sdk.dir=/home/username/Android/Sdk
```

Update CMake version in `android/app/build.gradle`:
```gradle
externalNativeBuild {
cmake {
version '3.22.1' // Match your installed CMake version
}
}
```

#### 3. Build APK
```bash
cd android
export JAVA_HOME="/path/to/jdk" # e.g., Android Studio's bundled JDK
./gradlew build
```

### Running on Emulator

#### Create and Start Emulator
```bash
# Create AVD configuration
mkdir -p ~/.android/avd/nullspace_dev.avd

# Create AVD ini file (see full config in android/ folder)
# Then start emulator (use -gpu host for better input handling):
~/Android/Sdk/emulator/emulator -avd nullspace_dev -no-snapshot-save -no-audio -no-boot-anim -gpu host &

# Wait for boot
~/Android/Sdk/platform-tools/adb wait-for-device shell 'while [[ -z $(getprop sys.boot_completed) ]]; do sleep 1; done'
```

> **GPU Mode:** Use `-gpu host` for best performance and input handling. If you have GPU driver issues, fall back to `-gpu swiftshader_indirect` (software rendering).

#### Install and Run
```bash
cd android
./gradlew installDebug
~/Android/Sdk/platform-tools/adb shell am start -n com.plushnode.nullspace/.MainActivity
```

> **Note:** Before connecting, ensure an ASSS server is running (see [Server Setup](#server-setup) section). When using the emulator, the app will connect to 10.0.2.2:5000 by default, which maps to localhost:5000 on your host machine.

#### Take Screenshots
```bash
~/Android/Sdk/platform-tools/adb exec-out screencap -p > screenshot.png
```

#### View Logs
```bash
~/Android/Sdk/platform-tools/adb logcat -d | grep nullspace
```

#### Programmatic Control (Automation)

**Coordinate System:**
The emulator runs landscape (2400x1080) with rotation=1 on a portrait display (1080x2400).

**Click Play Button:**
```bash
# Play button coordinates in landscape: (1703, 648)
adb shell input tap 1703 648
```

**Move Camera (Swipe):**
```bash
# Swipe from center (1200, 540) to top-left (800, 340) over 500ms
adb shell input swipe 1200 540 800 340 500
```

**Coordinate Transformation Formula:**
```bash
# From raw touch events (getevent, max value 32767):
portrait_x = (raw_x × 1080) / 32767
portrait_y = (raw_y × 2400) / 32767

# Transform to landscape for adb input tap:
landscape_x = portrait_y
landscape_y = 1080 - portrait_x
```

**Full Automated Workflow:**
```bash
# Stop, restart, and connect to server
adb shell am force-stop com.plushnode.nullspace
adb shell am start -n com.plushnode.nullspace/.MainActivity
sleep 4
adb shell input tap 1703 648 # Click Play
sleep 3
adb exec-out screencap -p > game.png
```

### Common Paths

**Flatpak Android Studio Java:**
```
/home/username/.local/share/flatpak/app/com.google.AndroidStudio/x86_64/stable/[hash]/files/extra/jbr
```

**Output APKs:**
```
android/app/build/outputs/apk/debug/app-debug.apk
android/app/build/outputs/apk/release/app-release.apk
```

### Troubleshooting

**SDK location not found:**
- Create `android/local.properties` with correct `sdk.dir`

**CMake version mismatch:**
- Check installed version: `ls ~/Android/Sdk/cmake/`
- Update `android/app/build.gradle` to match

**Missing resources:**
- Ensure `graphics/` and `sound/` folders exist in `android/app/src/main/assets/`
- Assets are loaded via Android AssetManager, not filesystem

**Java not found:**
- Set `JAVA_HOME` to Java 17+ before running gradlew
- Android Studio's bundled JDK works well

### Touch Controls

The Android version is spectator-only (no ship controls):
- **Drag** - Move spectate camera
- **Double-tap** - Spectate nearby player
- **Long-press** - Open ESC menu
- **Screen zones** (3x3 grid) - Select ships 1-8 when menu is open

## Desktop Development

TODO

## Server Setup

### ASSS Server (for testing)

#### Clone and Build
```bash
# Clone ASSS server
git clone https://github.com/plushmonkey/asss
cd asss

# Build with CMake
mkdir build && cd build
cmake ..
make

# Server binary will be in build/bin/asss
```

#### Running the Server
```bash
# Start server (from asss/zone directory)
cd ~/path/to/asss/zone
../build/bin/asss

# Server listens on port 5000 (TCP/UDP) by default
# Emulator connects via 10.0.2.2:5000 (maps to host localhost)
```

#### Stop Server
```bash
# Find process
ps aux | grep asss

# Kill by PID
kill <pid>
```

### Connecting to Server

The nullspace app has multiple server configurations in `android/app/src/main/cpp/nullspace_android.cpp`:
- **"emulator"** - 10.0.2.2:5000 (for Android emulator → host localhost)
- **"local"** - 192.168.x.x:5000 (for device on local network)
- Various public servers

**When running in emulator:** Select the "emulator" zone to connect to ASSS running on your host machine.

**Zone selection:** The app defaults to `kServerIndex = 0` (emulator zone). To change, modify the index in nullspace_android.cpp and rebuild.
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,20 @@ Use the existing Visual Studio solution or install cmake. Choose Release x64 bui
6. `make`

### Android
Use the provided gradlew in the android folder.
This version doesn't support input and isn't really maintained, so it might not compile.
1. Ensure git submodules are initialized: `git submodule init && git submodule update`
2. Copy game resources to `android/app/src/main/assets/`:
- `graphics/` folder with sprite sheets (.bm2, .png, or .gif files)
- `sound/` folder with audio files (.wa2 files)
3. Create `android/local.properties` with your Android SDK path:
```
sdk.dir=/path/to/Android/Sdk
```
4. Update `android/app/build.gradle` CMake version to match installed version (e.g., `3.22.1`)
5. Set `JAVA_HOME` to Java 17+ (e.g., from Android Studio's bundled JDK)
6. Build and install:
```bash
cd android
./gradlew installDebug
```

**Note:** This is a spectator-only client. Touch controls: drag to move camera, double-tap to spectate players, long-press for menu.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ android {
externalNativeBuild {
cmake {
path file('src/main/cpp/CMakeLists.txt')
version '3.10.2'
version '3.22.1'
}
}
}
Expand Down
Loading