SFML community forums

General => SFML projects => Topic started by: daemon on July 15, 2013, 03:58:35 pm

Title: [Minigame] GoPlanets
Post by: daemon on July 15, 2013, 03:58:35 pm
I'd like to introduce you to a little project of mine called GoPlanets. I started this as part of my little Go playground but then it turned into an actual game. The idea behind this game isn't really new and I'm sure you're already familiar with this concept ;).

(https://dl.dropboxusercontent.com/u/32050233/goplanets.jpeg)

It's still unfinished and the AI is rather dumb but I think its quite fun to watch.

Download (Windows 32bit) (https://bitbucket.org/krepa098/goplanets/downloads)
Source (https://bitbucket.org/krepa098/goplanets/src)

As the title suggests, the game is written in Go so please tell me how it performs on your PC and of course everything else you can think of.
Enjoy!
Title: Re: [Minigame] GoPlanets
Post by: eXpl0it3r on July 15, 2013, 05:54:38 pm
This is really a great game! Reminds me a lot of Risk (https://en.wikipedia.org/wiki/Risk_(game)). ;)

Btw you've forgotten to package openal32.dll and libsndfile-1.dll.
It would be great to get a quick introduction to what the aim is and how it works. Also the menu should be more intuitive to use, i.e. highlight when you're over something you can interact with. And as you said yourself, the AI is not the smartest, so it's relatively easy to win.

It's quite nice how the ships are avoiding the planets and the other ships and I think you've quite some space to add some really nice effects etc. But so far I like it! :)

Regarding the AI:
It will in most cases attack grey planets, thus feel free to attack them directly.
Title: Re: [Minigame] GoPlanets
Post by: Euphemios on July 15, 2013, 10:50:13 pm
This is a very good "Galcon Fusion" clone. I like the idea with the solar system. Well done :)
Title: Re: [Minigame] GoPlanets
Post by: Foaly on July 18, 2013, 12:41:46 pm
I played a game similar to this a while back on a friends computer and liked it a lot, but it was on OS X and closed source and you had to pay for it. Its awesome to see this (very good!) clone.
There is a lot of potential in this! It would be fantastic if you develop it further!
Title: Re: [Minigame] GoPlanets
Post by: eXpl0it3r on July 18, 2013, 02:32:48 pm
I love it when you can cripple the FPS with a few hundred ships. :D

(http://i.imgur.com/c4l8uUY.png)

I wonder though how high one could go, until one would hit an overflow...

(http://i.imgur.com/xlNiG0p.png)


As for the AI, I wish it was just a bit better. Currently you can win nearly all rounds by simply attacking the enemy directly as fast as possible, because the AI will first go an try to conquer the neutral planets, by which he'll automatically lose some part of his power. I mean if I attack the AI, I'll not only reduce the AI's ship count, but also slowly take over planets, however if I'd attack an empty planet, my ships would just die out from attacking the neutral planets without damaging the AI's fleet. Maybe one would have to implement two phases. In the first one will conquer the neutral planets and afterwards start the attack.
Personally I think there should also exist a small chance of being able to regain power. For example if the enemy manages to take you down to one planet with a low count of ships, it's impossible to fight back. An idea would be, that the refresh rate increases the lower your ship count is or the other way around. You could also think about a overall maximum limit and a planet limit.

Anyways I don't want to spoil your ideas, it's just a few things I've noticed when playing it a few times.

Btw. sometimes ships get stuck behind a planet and it takes them a while to break free (see first image).
Title: Re: [Minigame] GoPlanets
Post by: daemon on July 18, 2013, 04:53:47 pm
Thanks for the valuable feedback  :). I will probably do some improvements like a better AI, a more complete UI and possibly some visual gimmicks but don't expect an update any time soon and no I won't turn it into a full-blown Galcon clone. Anyway, I'll try to incorporate some of your ideas.

@exploiter
I'm surprised it's still running  ;D
I'll see what I can do to avoid ships getting stuck. Maybe that's the reason why Galcon performs the collision only between ships in the same attacking group.
Title: Re: [Minigame] GoPlanets
Post by: daemon on July 30, 2013, 12:48:22 pm
Update!  :)

Changes since the first build:

Solar systems are still on my todo list.   :-\

Download (https://bitbucket.org/krepa098/goplanets/downloads)

The new menu
(http://db.tt/aq3mM5LX)

Some gameplay
(http://db.tt/rUhNfDHa)
Title: Re: [Minigame] GoPlanets
Post by: eXpl0it3r on July 30, 2013, 03:30:17 pm
Yes! An update! :D

I'd call it a bug, not sure what you'd call it, but the round shouldn't end when only one color is in control of the planets, but it should end when only ships of one color exist. For example if you send out a huge fleet to take over a planet and in the same action the enemy steals your planet. Your huge fleet could still grab the next planet, but since the round ends when one color is in control of all planets, the fleet never reaches the destination...

I like the new impact effect. And yes it's much harder to fight against the AI, especially since it now always runs for the smallest population numbers.
Title: Re: [Minigame] GoPlanets
Post by: FRex on July 30, 2013, 03:53:52 pm
On wine it runs only when I change fragment shader to just output black, with it it crashes:
Quote
Failed to compile fragment shader:
0:23(73): error: Could not implicitly convert operands to arithmetic operator
0:0(0): error: no matching function for call to `pow(float, )'
0:0(0): error: candidates are: float pow(float, float)
0:0(0): error:                 float pow(float, float)
0:0(0): error:                 vec2 pow(vec2, vec2)
0:0(0): error:                 vec3 pow(vec3, vec3)
0:0(0): error:                 vec4 pow(vec4, vec4)
0:23(74): error: Operands to arithmetic operators must be numeric
0:23(14): error: cannot construct `vec3' from a non-numeric data type

fatal error: malloc/free - deadlock
[signal 0xc0000005 code=0x1 addr=0x2f0 pc=0x42d9b8]

goroutine 1 [syscall]:
[fp=0x3a11a0] return()
   C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist934530519/go/src/pkg/runtime/asm_386.s:472
[fp=0x3a11c8] runtime.cgocall(0x49f584, 0x3a11d4)
   C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist934530519/go/src/pkg/runtime/cgocall.c:162 +0x10a
[fp=0x3a11d4] bitbucket.org/krepa098/gosfml2._Cfunc_sfShader_setFloat2Parameter(0x0, 0x13ca38, 0x44800000, 0x44400000)
   C:/Users/paul/AppData/Local/Temp/go-build931663947/bitbucket.org/krepa098/gosfml2/_obj/_cgo_defun.c:2377 +0x31
[fp=0x3a11f4] bitbucket.org/krepa098/gosfml2.(*Shader).SetFloatParameter(0x41e305a8, 0x4fe978, 0xa, 0x3a1218, 0x2, ...)
   font.go:1883 +0xe2
[fp=0x3a1258] main.(*Nebula).SetParams(0x41e30598, 0x44800000, 0x44400000, 0x4951a3f0, 0x3f8ea3fc, ...)
   C:/Users/paul/Desktop/krepa098-goplanets-cb9dce2581e1/nebula.go:45 +0x89
[fp=0x3a1778] main.NewGame(0x400, 0x300, 0x420100, 0x42866c)
   C:/Users/paul/Desktop/krepa098-goplanets-cb9dce2581e1/game.go:226 +0x1dbf
[fp=0x3a17c4] main.main()
   C:/Users/paul/Desktop/krepa098-goplanets-cb9dce2581e1/main.go:52 +0x1a2
[fp=0x3a17dc] runtime.main()
   C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist934530519/go/src/pkg/runtime/proc.c:182 +0x8e
[fp=0x3a17e0] runtime.goexit()
   C:/Users/ADMINI~1/AppData/Local/Temp/2/bindist934530519/go/src/pkg/runtime/proc.c:1223

goroutine 2 [syscall]:

goroutine 4 [chan receive]:
main.func·003(0x0)
   C:/Users/paul/Desktop/krepa098-goplanets-cb9dce2581e1/physics.go:74 +0x8b
created by main.NewPhysicsManager
   C:/Users/paul/Desktop/krepa098-goplanets-cb9dce2581e1/physics.go:76 +0xff

goroutine 5 [chan receive]:
main.func·003(0x1)
   C:/Users/paul/Desktop/krepa098-goplanets-cb9dce2581e1/physics.go:74 +0x8b
created by main.NewPhysicsManager
   C:/Users/paul/Desktop/krepa098-goplanets-cb9dce2581e1/physics.go:76 +0xff

goroutine 7 [chan receive]:
main.(*SoundManager).FadeIn(0x41e8f000, 0x41e70a80, 0x41e30568)
   C:/Users/paul/Desktop/krepa098-goplanets-cb9dce2581e1/soundManager.go:174 +0x4c
main.func·005()
   C:/Users/paul/Desktop/krepa098-goplanets-cb9dce2581e1/soundManager.go:194 +0x82
created by main.(*SoundManager).FadeWorker
   C:/Users/paul/Desktop/krepa098-goplanets-cb9dce2581e1/soundManager.go:200 +0x5f
AL lib: (WW) FreeContext: (0x7ce60fd8) Deleting 67 Source(s)
AL lib: (WW) FreeDevice: (0x7cd32930) Deleting 3 Buffer(s)
Title: Re: [Minigame] GoPlanets
Post by: eXpl0it3r on July 30, 2013, 04:10:35 pm
On wine it runs only when I change fragment shader to just output black, with it it crashes:
Not sure why it should be the devs job to fix Wine's problems... ::)

Also the project is open source (https://bitbucket.org/krepa098/goplanets/src), so feel free to build your own Linux binary. ;)
Title: Re: [Minigame] GoPlanets
Post by: FRex on July 30, 2013, 04:43:37 pm
It's not just wine problem, shader is not compiling in c++ either.
This:
  color.rgb = vec3(     1.0-pow(l,pow((1.0-sin(length(pos)))*colorSeed.r,2)*2),
                        1.0-pow(l,pow((1.0-sin(length(pos)))*colorSeed.g,2)*1.4),
                        1.0-pow(l,pow((sin(length(pos)))*colorSeed.b,2)*1.2)  );
changed to this:
  color.rgb = vec3(     1.0-pow(l,pow((1.0-sin(length(pos)))*colorSeed.r,2)*2.0),
                        1.0-pow(l,pow((1.0-sin(length(pos)))*colorSeed.g,2)*1.4),
                        1.0-pow(l,pow((sin(length(pos)))*colorSeed.b,2)*1.2)  );
works, because C(++) Linux and GL aren't C#, Windows and D3D so we get inconsistencies like that and more. ::)
I always make floats end in .0 because things like that tend to happen...
Title: Re: [Minigame] GoPlanets
Post by: daemon on July 30, 2013, 05:52:19 pm
Thanks for the feedback.

On wine it runs only when I change fragment shader to just output black, with it it crashes:
My bad. I somehow missed the warnings during shader compilation. Btw. I've uploaded a linux binary as you probably don't want to pull the whole Go toolchain   ;)

I'd call it a bug, not sure what you'd call it, but the round shouldn't end when only one color is in control of the planets, but it should end when only ships of one color exist. For example if you send out a huge fleet to take over a planet and in the same action the enemy steals your planet. Your huge fleet could still grab the next planet, but since the round ends when one color is in control of all planets, the fleet never reaches the destination...
Yep... indeed. I'll change that in the final release.
Title: Re: [Minigame] GoPlanets
Post by: FRex on July 30, 2013, 06:04:47 pm
It ran fine on wine and I use 32 bit linux. ;D
Really anything with SFML runs fine on wine(compared to old windows games that use DirectX 8 or 9 that just die after launch, blackscreen, miss sounds etc.), I ran Zloxx 2(for hours) and one other SFML game and there were no problems.
Title: Re: [Minigame] GoPlanets
Post by: Yemeni Cpluspluser on July 30, 2013, 07:24:54 pm
Very fun and exciting, I played it for 16 minutes ^_^
Title: Re: [Minigame] GoPlanets
Post by: Foaly on August 02, 2013, 10:30:55 am
The update looks very nice! I have to try it as soon as I get home!
Title: Re: [Minigame] GoPlanets
Post by: daemon on August 12, 2013, 09:59:44 am
I did some changes to the artwork and well I'd like to hear whether you like it or not  ;D. I think it looks quite clean (and non-Galcon like) but I'm a bit worried that I is too colorful.

EDIT:
old pics: [1] (https://dl.dropboxusercontent.com/u/32050233/goplanets2_newgfx1.jpeg) [2] (https://dl.dropboxusercontent.com/u/32050233/goplanets2_newgfx2.jpeg)

Did some changes as suggested by K-Bal. Planets now also have a subtle glow.

(https://dl.dropboxusercontent.com/u/32050233/goplanets2_newgfx3.jpeg)

(https://dl.dropboxusercontent.com/u/32050233/goplanets2_newgfx4.jpeg)
Title: Re: [Minigame] GoPlanets
Post by: K-Bal on August 12, 2013, 10:58:20 am
Maybe you shouldn't use such intense red/green/blue contrasts. Take a look at Eufloria for example.
Title: Re: [Minigame] GoPlanets
Post by: StormWingDelta on August 14, 2013, 11:58:06 pm
Might want to implement a zoom feature and camera scrolling since the solar system maps are too far out to see the numbers.  Also you could add a group selection feature like dragging the mouse to draw a box and select several planets at once.


Just a few things that might help.  Nice game though. :p
Title: Re: [Minigame] GoPlanets
Post by: daemon on August 19, 2013, 03:41:27 pm
Might want to implement a zoom feature and camera scrolling since the solar system maps are too far out to see the numbers.  Also you could add a group selection feature like dragging the mouse to draw a box and select several planets at once.


Just a few things that might help.  Nice game though. :p

Thanks. Camera zooming an scrolling is actually present since the first release (scrolling: WASD/arrow keys, zooming: mouse wheel). ;)

Anyway I just uploaded the final build.

Changelog v1.98 -> 2.0

Title: Re: [Minigame] GoPlanets
Post by: Krssst on August 19, 2013, 09:42:34 pm
Played it a little: really nice game :-)
I like how we can order several planets in the same time by just hovering them with the cursor. Tried it with 4 AIs with a lot of planets and I was completely destroyed in a few minutes, so I think I have to progress.

I imagine a lot of people already told you this, but multiplayer in this kind of game would make it really nice :-) But that also seems really tricky to do right...
Title: Re: [Minigame] GoPlanets
Post by: Jungletoe on August 20, 2013, 01:39:48 am
I imagine a lot of people already told you this, but multiplayer in this kind of game would make it really nice :-) But that also seems really tricky to do right...

I actually think it would be somewhat easy to do, compared to other games. Just keep a central game lobby server and have it calculate how many ships each planet has and where they're sending them. It would be pretty awesome too.

Good job with this. It was really fun and the music blended nicely :)
Title: Re: [Minigame] GoPlanets
Post by: grok on December 22, 2014, 04:14:19 pm
Hi.

I have discovered a bug (it repeated many times).
I have built Golang v 1.4, SFML 2.2, CSFML, Goplanets, everything is up to date.
It occurs when I change the resolution in the settings menu, and restart the game.

Here's the execution log:

Quote
varnie@localhost:~/thrash/gopath/src/bitbucket.org/krepa098/goplanets$ ./goplanets
[xcb] Unknown request in queue while dequeuing
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
goplanets: ../../src/xcb_io.c:179: dequeue_pending_request: Assertion `!xcb_xlib_unknown_req_in_deq' failed.
SIGABRT: abort
PC=0xb7735424
signal arrived during cgo execution

goroutine 4 [syscall, locked to thread]:
runtime.cgocall_errno(0x8057130, 0x94faef78, 0x0)
   /home/varnie/.gvm/gos/go1.4/src/runtime/cgocall.go:130 +0xcd fp=0x94faef68 sp=0x94faef50
bitbucket.org/krepa098/gosfml2._Cfunc_sfContext_setActive(0xa1a69d0, 0x1)
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/gosfml2/:417 +0x3f fp=0x94faef78 sp=0x94faef68
bitbucket.org/krepa098/gosfml2.(*Context).SetActive(0x94fa2188, 0x301)
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/gosfml2/context.go:41 +0x3d fp=0x94faef84 sp=0x94faef78
bitbucket.org/krepa098/gosfml2.globalCtxSetActive(0xa424601)
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/gosfml2/helpers.go:68 +0x48 fp=0x94faef90 sp=0x94faef84
bitbucket.org/krepa098/gosfml2.(*RenderTexture).destroy(0x9506a110)
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/gosfml2/renderTexture.go:57 +0x25 fp=0x94faef98 sp=0x94faef90
runtime.call16(0x824084c, 0x9506a000, 0x8, 0x8)
   /home/varnie/.gvm/gos/go1.4/src/runtime/asm_386.s:412 +0x41 fp=0x94faefac sp=0x94faef98
runtime.runfinq()
   /home/varnie/.gvm/gos/go1.4/src/runtime/malloc.go:769 +0x228 fp=0x94faeff0 sp=0x94faefac
runtime.goexit()
   /home/varnie/.gvm/gos/go1.4/src/runtime/asm_386.s:2287 +0x1 fp=0x94faeff4 sp=0x94faeff0
created by runtime.createfing
   /home/varnie/.gvm/gos/go1.4/src/runtime/malloc.go:707 +0x59

goroutine 1 [syscall, locked to thread]:
bitbucket.org/krepa098/gosfml2._Cfunc_sfKeyboard_isKeyPressed(0x47, 0x0)
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/gosfml2/:813 +0x3f
bitbucket.org/krepa098/gosfml2.KeyboardIsKeyPressed(0x47, 0xe)
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/gosfml2/keyboard.go:130 +0x28
main.(*InputManager).IsKeyDown(0x94fcc340, 0x47, 0x54982623)
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/goplanets/input.go:62 +0x28
main.(*RtsView).Update(0x94fcc3c0)
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/goplanets/rtsview.go:56 +0x33
main.(*Game).GameLoop(0x94fd22d0)
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/goplanets/game.go:366 +0x46d
main.(*Game).Run(0x94fd22d0)
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/goplanets/game.go:297 +0x5c
main.main()
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/goplanets/main.go:62 +0x1f2

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
   /home/varnie/.gvm/gos/go1.4/src/runtime/asm_386.s:2287 +0x1

goroutine 5 [chan receive]:
main.func·007(0x0)
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/goplanets/physics.go:72 +0xc7
created by main.NewPhysicsManager
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/goplanets/physics.go:74 +0x18f

goroutine 6 [chan receive]:
main.func·007(0x1)
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/goplanets/physics.go:72 +0xc7
created by main.NewPhysicsManager
   /home/varnie/thrash/gopath/src/bitbucket.org/krepa098/goplanets/physics.go:74 +0x18f

eax     0x0
ebx     0x1b29
ecx     0x1b55
edx     0x6
edi     0xb76c2000
esi     0x7e700000
ebp     0x0
esp     0x7d3fdf04
eip     0xb7735424
eflags  0x202
cs      0x73
fs      0x0
gs      0x33
Title: Re: [Minigame] GoPlanets
Post by: Laurent on December 22, 2014, 05:54:30 pm
Quote
XInitThreads has not been called
So... you must call XInitThreads (from Xlib.h) ;)