Compare commits
5 Commits
v1.1.0
...
feature/ma
Author | SHA1 | Date | |
---|---|---|---|
d5bb464d9f | |||
4549ee7517 | |||
31ae9c525f | |||
06913a5217 | |||
49663c9094 |
55
README.md
@ -16,24 +16,57 @@ A multiplayer isometric game inspired by Oldschool RuneScape, built with Go and
|
|||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- Go 1.23 or higher
|
- 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))
|
- Raylib dependencies (see [raylib-go](https://github.com/gen2brain/raylib-go#requirements))
|
||||||
|
|
||||||
## Installation
|
## 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
|
```bash
|
||||||
git clone https://gitea.boner.be/bdnugget/goonscape.git
|
git clone https://gitea.boner.be/bdnugget/goonscape.git
|
||||||
cd goonscape
|
cd goonscape
|
||||||
```
|
go build
|
||||||
|
|
||||||
2. Install dependencies:
|
|
||||||
```bash
|
|
||||||
go mod tidy
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Build and run:
|
|
||||||
```bash
|
|
||||||
go run main.go
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Controls
|
## 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++ {
|
for i := startIdx; i < endIdx; i++ {
|
||||||
msg := c.messages[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)
|
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
|
messageY += messageHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
go.mod
@ -3,7 +3,7 @@ module gitea.boner.be/bdnugget/goonscape
|
|||||||
go 1.23.0
|
go 1.23.0
|
||||||
|
|
||||||
require (
|
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
|
github.com/gen2brain/raylib-go/raylib v0.0.0-20250109172833-6dbba4f81a9b
|
||||||
google.golang.org/protobuf v1.36.3
|
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
|
// Create a channel to signal when goroutines are done
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
|
|
||||||
|
// Create a set of current players to track disconnects
|
||||||
|
currentPlayers := make(map[int32]bool)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
@ -194,6 +197,7 @@ func HandleServerCommunication(conn net.Conn, playerID int32, player *types.Play
|
|||||||
player.Unlock()
|
player.Unlock()
|
||||||
|
|
||||||
for _, state := range serverMessage.Players {
|
for _, state := range serverMessage.Players {
|
||||||
|
currentPlayers[state.PlayerId] = true
|
||||||
if state.PlayerId == playerID {
|
if state.PlayerId == playerID {
|
||||||
player.Lock()
|
player.Lock()
|
||||||
// Update initial position if not set
|
// 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 {
|
if handler, ok := player.UserData.(types.ChatMessageHandler); ok && len(serverMessage.ChatMessages) > 0 {
|
||||||
handler.HandleServerMessages(serverMessage.ChatMessages)
|
handler.HandleServerMessages(serverMessage.ChatMessages)
|
||||||
}
|
}
|
||||||
|
@ -6,12 +6,15 @@ build() {
|
|||||||
local arch=$2
|
local arch=$2
|
||||||
local output=$3
|
local output=$3
|
||||||
|
|
||||||
# Set CGO flags for static linking
|
# Set GOOS and GOARCH for cross-compilation
|
||||||
export CGO_ENABLED=1
|
|
||||||
export GOOS=$os
|
export GOOS=$os
|
||||||
export GOARCH=$arch
|
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
|
if [ "$os" = "windows" ]; then
|
||||||
export CC=x86_64-w64-mingw32-gcc
|
export CC=x86_64-w64-mingw32-gcc
|
||||||
export CXX=x86_64-w64-mingw32-g++
|
export CXX=x86_64-w64-mingw32-g++
|
||||||
|