Compare commits

...

1 Commits
main ... wip

Author SHA1 Message Date
Trevor Slocum 73502ccd2d wip 2023-01-30 12:45:57 -08:00
5 changed files with 38 additions and 12 deletions

View File

@ -5,6 +5,7 @@ import (
"image/color"
"log"
"math"
"net"
"os"
"strconv"
"strings"
@ -105,6 +106,9 @@ func (g *Game) startLocalGame() {
}
func (g *Game) startNetworkGame() {
ServerAddr, err := net.ResolveUDPAddr("udp", world.LocalIP+":17000")
log.Printf("Client address for connection: %s %s %s", world.LocalIP, ServerAddr, err)
address := ""
port := world.ConnectPromptText
if strings.ContainsRune(port, ':') {

View File

@ -106,3 +106,7 @@ func (g *GameSession) OnEvent(info *ggpo.Event) {
}
}
}
func (g *GameSession) LocalIP() string {
return world.LocalIP
}

10
go.mod
View File

@ -5,8 +5,8 @@ go 1.19
require (
code.rocketnine.space/tslocum/etk v0.0.0-20230103193701-368514415e01
code.rocketnine.space/tslocum/gohan v1.0.0
github.com/assemblaj/ggpo v0.0.0-20230106194913-0f5ca8313c51
github.com/hajimehoshi/ebiten/v2 v2.4.15
github.com/assemblaj/ggpo v0.0.0-20230129160025-68dbb12db83e
github.com/hajimehoshi/ebiten/v2 v2.4.16
)
require (
@ -15,10 +15,12 @@ require (
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b // indirect
github.com/hajimehoshi/file2byteslice v1.0.0 // indirect
github.com/jezek/xgb v1.1.0 // indirect
golang.org/x/exp v0.0.0-20230108222341-4b8118a2686a // indirect
golang.org/x/exp/shiny v0.0.0-20230108222341-4b8118a2686a // indirect
golang.org/x/exp v0.0.0-20230129154200-a960b3787bd2 // indirect
golang.org/x/exp/shiny v0.0.0-20230129154200-a960b3787bd2 // indirect
golang.org/x/image v0.3.0 // indirect
golang.org/x/mobile v0.0.0-20221110043201-43a038452099 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
)
replace github.com/assemblaj/ggpo => github.com/tslocum/ggpo v0.0.0-20230130204355-fa282e75280f

30
go.sum
View File

@ -5,8 +5,8 @@ code.rocketnine.space/tslocum/gohan v1.0.0/go.mod h1:12yOt5Ygl/RVwnnZSVZRuS1W6gC
code.rocketnine.space/tslocum/messeji v1.0.2 h1:3/68FnXWaBDMhfUGb8FvNpVgAHY8DX+VL7pyA/CcY94=
code.rocketnine.space/tslocum/messeji v1.0.2/go.mod h1:bSXsyjvKhFXQ7GsUxWZdO2JX83xOT/VTqFCR04thk+c=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/assemblaj/ggpo v0.0.0-20230106194913-0f5ca8313c51 h1:7utlNj3OWPUxtFgav/0Eu1EXOrsNS5lrq+NWnwTRnAs=
github.com/assemblaj/ggpo v0.0.0-20230106194913-0f5ca8313c51/go.mod h1:ZKiAYEZgxDlGHGeP/VZsv1+xIRo9kQpgUFmjP/PR0lQ=
github.com/assemblaj/ggpo v0.0.0-20230129160025-68dbb12db83e h1:tfcqziT05uc2ow93d8csUPVmt7EKnO3cGwMb2+mGOJ4=
github.com/assemblaj/ggpo v0.0.0-20230129160025-68dbb12db83e/go.mod h1:ZKiAYEZgxDlGHGeP/VZsv1+xIRo9kQpgUFmjP/PR0lQ=
github.com/ebitengine/purego v0.0.0-20220905075623-aeed57cda744/go.mod h1:Eh8I3yvknDYZeCuXH9kRNaPuHEwvXDCk378o9xszmHg=
github.com/ebitengine/purego v0.1.1 h1:HI8nW+LniW9Yb34k34jBs8nz+PNzsw68o7JF8jWFHHE=
github.com/ebitengine/purego v0.1.1/go.mod h1:Eh8I3yvknDYZeCuXH9kRNaPuHEwvXDCk378o9xszmHg=
@ -15,8 +15,8 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b h1:GgabKamyOY
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20221017161538-93cebf72946b/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/hajimehoshi/bitmapfont/v2 v2.2.2 h1:4z08Fk1m3pjtlO7BdoP48u5bp/Y8xmKshf44aCXgYpE=
github.com/hajimehoshi/bitmapfont/v2 v2.2.2/go.mod h1:Ua/x9Dkz7M9CU4zr1VHWOqGwjKdXbOTRsH7lWfb1Co0=
github.com/hajimehoshi/ebiten/v2 v2.4.15 h1:yvhCrDv9y7TpdHtdux5ES/IwP6Pfplz5rJVxE0Z+ZPU=
github.com/hajimehoshi/ebiten/v2 v2.4.15/go.mod h1:BZcqCU4XHmScUi+lsKexocWcf4offMFwfp8dVGIB/G4=
github.com/hajimehoshi/ebiten/v2 v2.4.16 h1:vhuMtaB78N2HlNMfImV/SZkDPNJhOxgFrEIm1uh838o=
github.com/hajimehoshi/ebiten/v2 v2.4.16/go.mod h1:BZcqCU4XHmScUi+lsKexocWcf4offMFwfp8dVGIB/G4=
github.com/hajimehoshi/file2byteslice v0.0.0-20210813153925-5340248a8f41/go.mod h1:CqqAHp7Dk/AqQiwuhV1yT2334qbA/tFWQW0MD2dGqUE=
github.com/hajimehoshi/file2byteslice v1.0.0 h1:ljd5KTennqyJ4vG9i/5jS8MD1prof97vlH5JOdtw3WU=
github.com/hajimehoshi/file2byteslice v1.0.0/go.mod h1:CqqAHp7Dk/AqQiwuhV1yT2334qbA/tFWQW0MD2dGqUE=
@ -30,6 +30,20 @@ github.com/jezek/xgb v1.1.0/go.mod h1:nrhwO0FX/enq75I7Y7G8iN1ubpSGZEiA3v9e9GyRFl
github.com/jfreymuth/oggvorbis v1.0.4/go.mod h1:1U4pqWmghcoVsCJJ4fRBKv9peUJMBHixthRlBeD6uII=
github.com/jfreymuth/vorbis v1.0.2/go.mod h1:DoftRo4AznKnShRl1GxiTFCseHr4zR9BN3TWXyuzrqQ=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
github.com/tslocum/ggpo v0.0.0-20230130182545-117bb42db30c h1:1v2Y8nTboGMkQHLw2qSPaAPWOOfJLNjLele5c3M0G3U=
github.com/tslocum/ggpo v0.0.0-20230130182545-117bb42db30c/go.mod h1:ZKiAYEZgxDlGHGeP/VZsv1+xIRo9kQpgUFmjP/PR0lQ=
github.com/tslocum/ggpo v0.0.0-20230130182804-1305e6c3c0a3 h1:WjkdK27nitflybdJXWynouKvQ+smSyzzc4O94UpkfaY=
github.com/tslocum/ggpo v0.0.0-20230130182804-1305e6c3c0a3/go.mod h1:ZKiAYEZgxDlGHGeP/VZsv1+xIRo9kQpgUFmjP/PR0lQ=
github.com/tslocum/ggpo v0.0.0-20230130195722-77a97f52346b h1:sPLVnLxMKsU7uRJilRehkXUntNSFlNcJyxyTGw1hko4=
github.com/tslocum/ggpo v0.0.0-20230130195722-77a97f52346b/go.mod h1:ZKiAYEZgxDlGHGeP/VZsv1+xIRo9kQpgUFmjP/PR0lQ=
github.com/tslocum/ggpo v0.0.0-20230130200335-1d917276333c h1:54/fASLOQkgzXtNVF6KxsuM9GdRo+QXXa276PCD90VU=
github.com/tslocum/ggpo v0.0.0-20230130200335-1d917276333c/go.mod h1:ZKiAYEZgxDlGHGeP/VZsv1+xIRo9kQpgUFmjP/PR0lQ=
github.com/tslocum/ggpo v0.0.0-20230130201804-ad8718f40bb5 h1:UdqjU43QxR7tSFo6Uv4ZfdD6mSYoTWmOWrgNAOsL4iU=
github.com/tslocum/ggpo v0.0.0-20230130201804-ad8718f40bb5/go.mod h1:ZKiAYEZgxDlGHGeP/VZsv1+xIRo9kQpgUFmjP/PR0lQ=
github.com/tslocum/ggpo v0.0.0-20230130201923-e5224269097d h1:r7pD6MDZ7b1OugxMxW6K8QoDecxvTKORRoRbYkWk884=
github.com/tslocum/ggpo v0.0.0-20230130201923-e5224269097d/go.mod h1:ZKiAYEZgxDlGHGeP/VZsv1+xIRo9kQpgUFmjP/PR0lQ=
github.com/tslocum/ggpo v0.0.0-20230130204355-fa282e75280f h1:nslfC9NXlf2YcnMDRXYrQiP9oCfJ8hxrI/Bvu9Rmy4w=
github.com/tslocum/ggpo v0.0.0-20230130204355-fa282e75280f/go.mod h1:ZKiAYEZgxDlGHGeP/VZsv1+xIRo9kQpgUFmjP/PR0lQ=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@ -38,10 +52,10 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
golang.org/x/exp v0.0.0-20230108222341-4b8118a2686a h1:tlXy25amD5A7gOfbXdqCGN5k8ESEed/Ee1E5RcrYnqU=
golang.org/x/exp v0.0.0-20230108222341-4b8118a2686a/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp/shiny v0.0.0-20230108222341-4b8118a2686a h1:mTWP1/jZnkR5zmffmGg9HfL6w81dS/u6ZJSOa4i8ot8=
golang.org/x/exp/shiny v0.0.0-20230108222341-4b8118a2686a/go.mod h1:UH99kUObWAZkDnWqppdQe5ZhPYESUw8I0zVV1uWBR+0=
golang.org/x/exp v0.0.0-20230129154200-a960b3787bd2 h1:5sPMf9HJXrvBWIamTw+rTST0bZ3Mho2n1p58M0+W99c=
golang.org/x/exp v0.0.0-20230129154200-a960b3787bd2/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
golang.org/x/exp/shiny v0.0.0-20230129154200-a960b3787bd2 h1:xiw7QDza+jS0x7vU7fwNbRSDE/QreNk9f9CZmXHs+Uw=
golang.org/x/exp/shiny v0.0.0-20230129154200-a960b3787bd2/go.mod h1:UH99kUObWAZkDnWqppdQe5ZhPYESUw8I0zVV1uWBR+0=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.1.0/go.mod h1:iyPr49SD/G/TBxYVB/9RRtGUT5eNbo2u4NamWeQcD5c=

View File

@ -64,6 +64,8 @@ var (
Local bool // Playing against computer
AI AIType // AI configuration
LocalIP = "0.0.0.0"
Backend ggpo.Backend
// These variables are cached to prevent race conditions.