Compare commits
7 Commits
feature/db
...
feature/ma
Author | SHA1 | Date | |
---|---|---|---|
d5bb464d9f | |||
4549ee7517 | |||
31ae9c525f | |||
06913a5217 | |||
49663c9094 | |||
a843680b09 | |||
7183df4a8b |
13
.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
# Build artifacts
|
||||
build/
|
||||
goonscape
|
||||
goonscape.exe
|
||||
|
||||
# IDE files
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
|
||||
# OS files
|
||||
.DS_Store
|
||||
Thumbs.db
|
25
.woodpecker.yml
Normal file
@ -0,0 +1,25 @@
|
||||
pipeline:
|
||||
build:
|
||||
image: golang:1.23
|
||||
commands:
|
||||
# Install build dependencies
|
||||
- apt-get update && apt-get install -y gcc-mingw-w64 cmake zip libasound2-dev mesa-common-dev libx11-dev libxrandr-dev libxi-dev xorg-dev libgl1-mesa-dev libglu1-mesa-dev libwayland-dev wayland-protocols libxkbcommon-dev
|
||||
|
||||
# Build for all platforms
|
||||
- make all
|
||||
|
||||
when:
|
||||
event: tag
|
||||
tag: v*
|
||||
|
||||
# Optional: Create Gitea release with built artifacts
|
||||
release:
|
||||
image: plugins/gitea-release
|
||||
settings:
|
||||
api_key:
|
||||
from_secret: gitea_token
|
||||
base_url: https://gitea.boner.be
|
||||
files: build/*.zip
|
||||
when:
|
||||
event: tag
|
||||
tag: v*
|
2
Makefile
@ -3,7 +3,7 @@
|
||||
include scripts/platforms.mk
|
||||
|
||||
BINARY_NAME=goonscape
|
||||
VERSION=1.0.0
|
||||
VERSION=1.1.0
|
||||
BUILD_DIR=build
|
||||
ASSETS_DIR=resources
|
||||
|
||||
|
55
README.md
@ -16,24 +16,57 @@ A multiplayer isometric game inspired by Oldschool RuneScape, built with Go and
|
||||
## Prerequisites
|
||||
|
||||
- Go 1.23 or higher
|
||||
- GCC (for CGO/SQLite support)
|
||||
- OpenGL development libraries
|
||||
- Raylib dependencies (see [raylib-go](https://github.com/gen2brain/raylib-go#requirements))
|
||||
|
||||
## Installation
|
||||
|
||||
1. Clone the repository:
|
||||
### Pre-built Binaries
|
||||
The easiest way to get started is to download the latest release from:
|
||||
```
|
||||
https://gitea.boner.be/bdnugget/goonscape/releases
|
||||
```
|
||||
Choose the appropriate zip file for your platform:
|
||||
- Windows: `goonscape-windows-amd64-v1.1.0.zip`
|
||||
- Linux: `goonscape-linux-amd64-v1.1.0.zip`
|
||||
|
||||
Extract the zip and run the executable.
|
||||
|
||||
### Quick Start
|
||||
For development:
|
||||
```bash
|
||||
# Run directly (recommended for development)
|
||||
go run main.go
|
||||
|
||||
# Run with local server
|
||||
go run main.go -local
|
||||
```
|
||||
|
||||
### Server Setup
|
||||
The server requires CGO for SQLite support:
|
||||
```bash
|
||||
# Enable CGO
|
||||
go env -w CGO_ENABLED=1
|
||||
|
||||
# Clone and build server
|
||||
git clone https://gitea.boner.be/bdnugget/goonserver.git
|
||||
cd goonserver
|
||||
go build
|
||||
```
|
||||
|
||||
### Client Installation
|
||||
Then install or build:
|
||||
```bash
|
||||
# Install the client
|
||||
go install gitea.boner.be/bdnugget/goonscape@latest
|
||||
```
|
||||
|
||||
Or build from source:
|
||||
```bash
|
||||
git clone https://gitea.boner.be/bdnugget/goonscape.git
|
||||
cd goonscape
|
||||
```
|
||||
|
||||
2. Install dependencies:
|
||||
```bash
|
||||
go mod tidy
|
||||
```
|
||||
|
||||
3. Build and run:
|
||||
```bash
|
||||
go run main.go
|
||||
go build
|
||||
```
|
||||
|
||||
## Controls
|
||||
|
@ -1,12 +0,0 @@
|
||||
# Blender 3.6.0 MTL File: 'None'
|
||||
# www.blender.org
|
||||
|
||||
newmtl Material.001
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd coomer.png
|
Before Width: | Height: | Size: 2.2 MiB |
@ -1,12 +0,0 @@
|
||||
# Blender 3.6.0 MTL File: 'None'
|
||||
# www.blender.org
|
||||
|
||||
newmtl Material.001
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd goonion.png
|
Before Width: | Height: | Size: 2.5 MiB |
@ -1,12 +0,0 @@
|
||||
# Blender 3.6.0 MTL File: 'None'
|
||||
# www.blender.org
|
||||
|
||||
newmtl Material.001
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd shreke.png
|
Before Width: | Height: | Size: 4.8 MiB |
Before Width: | Height: | Size: 104 KiB |
@ -1,12 +0,0 @@
|
||||
# Blender 3.6.0 MTL File: 'None'
|
||||
# www.blender.org
|
||||
|
||||
newmtl Material.001
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd coomer.png
|
Before Width: | Height: | Size: 2.2 MiB |
@ -1,12 +0,0 @@
|
||||
# Blender 3.6.0 MTL File: 'None'
|
||||
# www.blender.org
|
||||
|
||||
newmtl Material.001
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd goonion.png
|
Before Width: | Height: | Size: 2.5 MiB |
@ -1,12 +0,0 @@
|
||||
# Blender 3.6.0 MTL File: 'None'
|
||||
# www.blender.org
|
||||
|
||||
newmtl Material.001
|
||||
Ns 250.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd shreke.png
|
Before Width: | Height: | Size: 4.8 MiB |
Before Width: | Height: | Size: 104 KiB |
@ -118,8 +118,14 @@ func (c *Chat) Draw(screenWidth, screenHeight int32) {
|
||||
|
||||
for i := startIdx; i < endIdx; i++ {
|
||||
msg := c.messages[i]
|
||||
var color rl.Color
|
||||
if msg.PlayerID == 0 { // System message
|
||||
color = rl.Gold
|
||||
} else {
|
||||
color = rl.White
|
||||
}
|
||||
text := fmt.Sprintf("%s: %s", msg.Username, msg.Content)
|
||||
rl.DrawText(text, int32(chatX)+5, int32(messageY), 20, rl.White)
|
||||
rl.DrawText(text, int32(chatX)+5, int32(messageY), 20, color)
|
||||
messageY += messageHeight
|
||||
}
|
||||
|
||||
|
2
go.mod
@ -3,7 +3,7 @@ module gitea.boner.be/bdnugget/goonscape
|
||||
go 1.23.0
|
||||
|
||||
require (
|
||||
gitea.boner.be/bdnugget/goonserver v0.0.0-20250113131525-49e23114973c
|
||||
gitea.boner.be/bdnugget/goonserver v1.1.0
|
||||
github.com/gen2brain/raylib-go/raylib v0.0.0-20250109172833-6dbba4f81a9b
|
||||
google.golang.org/protobuf v1.36.3
|
||||
)
|
||||
|
@ -100,6 +100,9 @@ func HandleServerCommunication(conn net.Conn, playerID int32, player *types.Play
|
||||
// Create a channel to signal when goroutines are done
|
||||
done := make(chan struct{})
|
||||
|
||||
// Create a set of current players to track disconnects
|
||||
currentPlayers := make(map[int32]bool)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
@ -194,6 +197,7 @@ func HandleServerCommunication(conn net.Conn, playerID int32, player *types.Play
|
||||
player.Unlock()
|
||||
|
||||
for _, state := range serverMessage.Players {
|
||||
currentPlayers[state.PlayerId] = true
|
||||
if state.PlayerId == playerID {
|
||||
player.Lock()
|
||||
// Update initial position if not set
|
||||
@ -216,6 +220,13 @@ func HandleServerCommunication(conn net.Conn, playerID int32, player *types.Play
|
||||
}
|
||||
}
|
||||
|
||||
// Remove players that are no longer in the server state
|
||||
for id := range otherPlayers {
|
||||
if !currentPlayers[id] {
|
||||
delete(otherPlayers, id)
|
||||
}
|
||||
}
|
||||
|
||||
if handler, ok := player.UserData.(types.ChatMessageHandler); ok && len(serverMessage.ChatMessages) > 0 {
|
||||
handler.HandleServerMessages(serverMessage.ChatMessages)
|
||||
}
|
||||
|
@ -6,12 +6,15 @@ build() {
|
||||
local arch=$2
|
||||
local output=$3
|
||||
|
||||
# Set CGO flags for static linking
|
||||
export CGO_ENABLED=1
|
||||
# Set GOOS and GOARCH for cross-compilation
|
||||
export GOOS=$os
|
||||
export GOARCH=$arch
|
||||
|
||||
# Platform specific flags
|
||||
|
||||
# Disable CGO only for cross-compilation
|
||||
if [ "$os" != "$(go env GOOS)" ] || [ "$arch" != "$(go env GOARCH)" ]; then
|
||||
export CGO_ENABLED=0
|
||||
fi
|
||||
|
||||
if [ "$os" = "windows" ]; then
|
||||
export CC=x86_64-w64-mingw32-gcc
|
||||
export CXX=x86_64-w64-mingw32-g++
|
||||
|