6 Commits

Author SHA1 Message Date
944c33ce3b Update License 2025-01-20 01:17:13 +01:00
d5bb464d9f Add system messages to chat 2025-01-20 00:03:50 +01:00
4549ee7517 Fix cgo bullshit in build 2025-01-19 23:28:04 +01:00
31ae9c525f mod 2025-01-19 23:22:09 +01:00
06913a5217 Update buildscript and readme 2025-01-19 22:50:50 +01:00
49663c9094 rm build artefacts from git tracking 2025-01-19 22:25:48 +01:00
35 changed files with 88 additions and 879725 deletions

24
LICENSE
View File

@ -1,11 +1,21 @@
“Commons Clause” License Condition v1.0 MIT License
The Software is provided to you by the Licensor under the License, as defined below, subject to the following condition. Copyright (c) 2025 bdnugget
Without limiting other conditions in the License, the grant of rights under the License will not include, and the License does not grant to you, right to Sell the Software. Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
For purposes of the foregoing, “Sell” means practicing any or all of the rights granted to you under the License to provide to third parties, for a fee or other consideration (including without limitation fees for hosting or consulting/ support services related to the Software), a product or service whose value derives, entirely or substantially, from the functionality of the Software. Any license notice or attribution required by the License must also include this Commons Cause License Condition notice. The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Software: GoonScape THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
License: Commons Clause v1.0 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Licensor: bdnugget FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -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

Binary file not shown.

View File

@ -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

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

View File

@ -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

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

View File

@ -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

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

View File

@ -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

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 MiB

View File

@ -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

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 MiB

View File

@ -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

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

View File

@ -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
View File

@ -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
) )

View File

@ -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)
} }

View File

@ -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++