4 Commits

Author SHA1 Message Date
4bfb5af362 shreke 2024-10-11 21:30:29 +02:00
c7f7c083b1 Different model per player 2024-10-11 15:58:28 +02:00
1c42ec2802 Add LICENSE 2024-10-11 13:46:29 +00:00
7ab75e8128 Merge pull request 'Fuck yeah server is working :D' (#1) from feature/multiplayer into master
Reviewed-on: #1
2024-10-11 12:49:31 +00:00
5 changed files with 210083 additions and 7 deletions

11
LICENSE Normal file
View File

@ -0,0 +1,11 @@
“Commons Clause” License Condition v1.0
The Software is provided to you by the Licensor under the License, as defined below, subject to the following condition.
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.
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.
Software: GoonScape
License: Commons Clause v1.0
Licensor: bdnugget

32
main.go
View File

@ -50,6 +50,8 @@ type Player struct {
TargetPath []Tile TargetPath []Tile
Speed float32 Speed float32
ActionQueue []Action // Queue for player actions ActionQueue []Action // Queue for player actions
Model rl.Model
Texture rl.Texture2D
} }
// Initialize the map with some height data // Initialize the map with some height data
@ -313,11 +315,11 @@ func main() {
go HandleServerCommunication(conn, playerID, &player) go HandleServerCommunication(conn, playerID, &player)
playerModel := rl.LoadModel("resources/models/goonion.obj") goonerModel := rl.LoadModel("resources/models/goonion.obj")
defer rl.UnloadModel(playerModel) defer rl.UnloadModel(goonerModel)
playerTexture := rl.LoadTexture("resources/models/goonion.png") playerTexture := rl.LoadTexture("resources/models/goonion.png")
defer rl.UnloadTexture(playerTexture) defer rl.UnloadTexture(playerTexture)
rl.SetMaterialTexture(playerModel.Materials, rl.MapDiffuse, playerTexture) rl.SetMaterialTexture(goonerModel.Materials, rl.MapDiffuse, playerTexture)
coomerModel := rl.LoadModel("resources/models/coomer.obj") coomerModel := rl.LoadModel("resources/models/coomer.obj")
defer rl.UnloadModel(coomerModel) defer rl.UnloadModel(coomerModel)
@ -325,6 +327,25 @@ func main() {
defer rl.UnloadTexture(coomerTexture) defer rl.UnloadTexture(coomerTexture)
rl.SetMaterialTexture(coomerModel.Materials, rl.MapDiffuse, coomerTexture) rl.SetMaterialTexture(coomerModel.Materials, rl.MapDiffuse, coomerTexture)
shrekeModel := rl.LoadModel("resources/models/shreke.obj")
defer rl.UnloadModel(shrekeModel)
shrekeTexture := rl.LoadTexture("resources/models/shreke.png")
defer rl.UnloadTexture(shrekeTexture)
rl.SetMaterialTexture(shrekeModel.Materials, rl.MapDiffuse, shrekeTexture)
models := []struct {
Model rl.Model
Texture rl.Texture2D
}{
{Model: goonerModel, Texture: playerTexture},
{Model: coomerModel, Texture: coomerTexture},
{Model: shrekeModel, Texture: shrekeTexture},
}
modelIndex := int(playerID) % len(models)
player.Model = models[modelIndex].Model
player.Texture = models[modelIndex].Texture
rl.SetTargetFPS(60) rl.SetTargetFPS(60)
// Music // Music
@ -356,9 +377,7 @@ func main() {
rl.ClearBackground(rl.RayWhite) rl.ClearBackground(rl.RayWhite)
rl.BeginMode3D(camera) rl.BeginMode3D(camera)
DrawMap(mapGrid) DrawMap(mapGrid)
DrawPlayer(player, &playerModel, mapGrid) DrawPlayer(player, &player.Model, mapGrid)
rl.DrawModel(coomerModel, rl.NewVector3(5*TileSize+32, 32, 5*TileSize+32), 16, rl.White)
rl.DrawFPS(10, 10) rl.DrawFPS(10, 10)
@ -366,7 +385,6 @@ func main() {
rl.EndDrawing() rl.EndDrawing()
} }
} }
func ConnectToServer() (net.Conn, int32, error) { func ConnectToServer() (net.Conn, int32, error) {
// Attempt to connect to the server // Attempt to connect to the server
conn, err := net.Dial("tcp", serverAddr) conn, err := net.Dial("tcp", serverAddr)

View File

@ -0,0 +1,12 @@
# 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

210035
resources/models/shreke.obj Normal file

File diff suppressed because it is too large Load Diff

BIN
resources/models/shreke.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB