Skip to content

Commit 982b4e5

Browse files
committed
add Makefile for standalone visual/debug builds, document visual mode in README
1 parent 9bb5839 commit 982b4e5

2 files changed

Lines changed: 57 additions & 0 deletions

File tree

pufferlib/ocean/osrs_pvp/Makefile

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# OSRS PvP C Environment Makefile
2+
#
3+
# standalone targets (no PufferLib dependency):
4+
# make — headless benchmark binary
5+
# make visual — headed raylib viewer with human input
6+
# make debug — debug build with sanitizers
7+
#
8+
# PufferLib training uses setup.py build_osrs_pvp instead.
9+
10+
CC = clang
11+
CFLAGS = -Wall -Wextra -O3 -ffast-math -flto -fPIC -std=c11
12+
DEBUG_FLAGS = -Wall -Wextra -g -O0 -fPIC -std=c11 -DDEBUG
13+
LDFLAGS = -lm
14+
15+
TARGET = osrs_pvp
16+
DEMO_SRC = osrs_pvp.c
17+
HEADERS = osrs_pvp.h
18+
19+
# Raylib (for visual target). download from https://github.com/raysan5/raylib/releases
20+
RAYLIB_DIR = raylib-5.5_macos
21+
UNAME_S := $(shell uname -s)
22+
ifeq ($(UNAME_S),Darwin)
23+
RAYLIB_FLAGS = -I$(RAYLIB_DIR)/include $(RAYLIB_DIR)/lib/libraylib.a \
24+
-framework Cocoa -framework OpenGL -framework IOKit -framework CoreVideo
25+
else
26+
RAYLIB_FLAGS = -I$(RAYLIB_DIR)/include -L$(RAYLIB_DIR)/lib -lraylib -lGL -lpthread -ldl -lrt
27+
endif
28+
29+
.PHONY: all clean debug visual
30+
31+
all: $(TARGET)
32+
33+
$(TARGET): $(DEMO_SRC) $(HEADERS)
34+
$(CC) $(CFLAGS) -o $@ $(DEMO_SRC) $(LDFLAGS)
35+
36+
visual: $(DEMO_SRC) $(HEADERS) osrs_pvp_render.h osrs_pvp_gui.h
37+
$(CC) $(CFLAGS) -DOSRS_PVP_VISUAL $(RAYLIB_FLAGS) -o $(TARGET)_visual $(DEMO_SRC) $(LDFLAGS)
38+
39+
debug: $(DEMO_SRC) $(HEADERS)
40+
$(CC) $(DEBUG_FLAGS) -o $(TARGET)_debug $(DEMO_SRC) $(LDFLAGS)
41+
42+
clean:
43+
rm -f $(TARGET) $(TARGET)_debug $(TARGET)_visual *.o

pufferlib/ocean/osrs_pvp/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ Zulrah encounter is a separate env that shares headers with osrs_pvp:
1313
python setup.py build_osrs_zulrah --inplace --force
1414
```
1515

16+
## Visual mode
17+
18+
Standalone headed viewer with raylib. supports human play, AI observation, and encounter selection.
19+
20+
```bash
21+
cd pufferlib/ocean/osrs_pvp
22+
make visual
23+
./osrs_pvp_visual --visual # PvP (watch AI vs scripted opponent)
24+
./osrs_pvp_visual --visual --encounter zulrah # Zulrah
25+
./osrs_pvp_visual --visual --human # human control (click to move/attack)
26+
```
27+
28+
requires raylib 5.5 — download from https://github.com/raysan5/raylib/releases and extract to `raylib-5.5_macos/` (or adjust `RAYLIB_DIR` in Makefile for linux).
29+
1630
## Data assets
1731

1832
Not in git. Exported from the OSRS game cache:

0 commit comments

Comments
 (0)