Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - daemon

Pages: [1] 2
1
SFML projects / Re: [Minigame] GoPlanets
« 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
  • New artwork
  • Added a new widget showing the strength of each player
  • The winner-check-routine now takes into account the amount of ships owned by each player
  • AI tweaks
  • Removed the real solar systems mode
  • Double clicking enemy planets will result in a global attack order
  • Fixed ships getting stuck (hopefully)
  • Fixed ships disappearing randomly (caused by too big rotation values)


2
SFML projects / Re: [Minigame] GoPlanets
« 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] [2]

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




3
SFML projects / Re: [Minigame] GoPlanets
« 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.

4
SFML projects / Re: [Minigame] GoPlanets
« on: July 30, 2013, 12:48:22 pm »
Update!  :)

Changes since the first build:
  • New nebula shader
  • New impact effect
  • A visual indicator is displayed when conquering a planet
  • A new AI (slightly better but still vulnerable to early game harass)
  • Revamped UI
  • Ships move slower but the spawn rates are higher (too slow?)
  • Collision is done per fleet (ships don't get stuck anymore)
  • Fixed a nasty bug in the quadtree (it's much smoother now)
  • Hopefully better performance

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

Download

The new menu


Some gameplay

5
Window / Re: Slow Event Polling (Linux x64)
« on: July 26, 2013, 04:36:58 pm »
Everything works fine here on my Arch Linux x64 machine. I'm running kernel 3.10.2 and SFML2 from the official repo.

6
SFML projects / Re: [Minigame] GoPlanets
« 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.

7
SFML projects / [Minigame] GoPlanets
« 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 ;).



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

Download (Windows 32bit)
Source

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!

8
GoSFML2
*Language: Go
*Author: krepa098
*Website: https://bitbucket.org/krepa098/gosfml2, https://bitbucket.org/krepa098/gosfml2-samples (samples)
*Status: Currently close to no progress as I'm working on an other project. I keep it compilable with sfml-git though.

9
Graphics / Re: 2D Water
« on: February 14, 2013, 07:06:50 pm »
Unfortunately I can't provide windows binaries as I'm using linux but I put all the code an images into an archive so that you can compile it on your own. Feel free to provide an exe for other users. Oh, and don't ask me about the math. There is a lot of trial and error in it ;).

I don't understand. How is taking a different background fix the problem?
It doesn't. But using a symmetrical background is a workaround... sort of.

10
Graphics / Re: 2D Water
« on: February 13, 2013, 06:11:56 pm »
I added some stuff from http://habibs.wordpress.com/lake to achieve a more glossy look. And this is what I got:

Too bad you can't see it in motion ;D. The math is probably wrong but I'm pleased by the results.

Do you mean that if I use vec2 pos = gl_FragCoords[0]; the texture is flipped? If so, yes that happens for me to.
Yes. So I'll just pick an other background ;)

11
Graphics / Re: 2D Water
« on: February 12, 2013, 07:20:36 pm »
You're welcome.  :)
Teta is the texture size but depending on the background texture using different values (e.g. 0.5*texturesize) yields better results. Actually I think the whole thing really depends on the quality of the background texture. Sadly I haven't had much time recently to dig any deeper.

I also don't understand the last line. Why is max(xDiff,yDiff) * vec4(hue,hue,hue,0.0) added to the output value? What does the hue do? And what values should it be set to? What does adding max(xDiff,yDiff) do?
Forget about that line :D. My intention was to create some sort of "shiny" appearance.
Do you also have this upside down problem? Missing an .update() call?

12
Graphics / Re: 2D Water
« on: February 09, 2013, 11:54:36 am »
Uhh... so many questions and I'm not the opengl guy so my explanation could be plain wrong  :-[.

So about the green channel:
The algorithm spits out negative numbers which you can't simply store as pixel color as they get clamped between 0 and 1 using 8bit precision. So if you store lets say -0.5 and read it back next frame you get 0.  So I store the negative values in g an apply them back in the velocity calculation.

About the disappearing ripples:
Yes they also disappear. I tried hard to figure out why and I think its due to a lack of precision. SFML is using GL_RGBA8 textures so the precision is quite limited. I changed it to GL_RGBA16 for testing and the ripples disappear way slower.

About the 3 buffers:
Actually I managed to get the same result using 2 buffers.
func main() {
        ...
        firstBuffer := sf.NewRenderTexture(size, size, false)
        secondBuffer := sf.NewRenderTexture(size, size, false)

        firstBuffer.Clear(sf.ColorBlack())
        secondBuffer.Clear(sf.ColorBlack())

        renderSprite := sf.NewSprite(nil)

        //load shaders
        ...
       
        //render states
        ...

        for wnd.IsOpen() {
                //mouse input
                ...

                waterShaderRaw.SetTextureParameter("textureTwoFramesAgo", firstBuffer.GetTexture())
                waterShaderRaw.SetTextureParameter("textureOneFrameAgo", secondBuffer.GetTexture())

                secondBuffer.Display()

                renderSprite.SetTexture(secondBuffer.GetTexture(), false)

                firstBuffer.Draw(renderSprite, &rsRaw)

                wnd.Clear(sf.ColorBlack())
                wnd.Draw(renderSprite, nil)
                wnd.Display()

                //swap buffers
                firstBuffer, secondBuffer = secondBuffer, firstBuffer
        }
}
 
Although it's not highly tested. Just an experiment.

13
Graphics / Re: 2D Water
« on: February 08, 2013, 11:35:49 am »
Using code from the article above I managed to get this:



Yep it still needs some tweaks but we are getting close  :)
(Looks far more impressive in motion!)

water_heightfield.glsl
uniform sampler2D inputTex;
uniform sampler2D backgroundTex;

uniform float teta;
uniform float hue;
const float rIndex = 2.0;

void main()
{
    vec4 output;
    vec2 pos = vec2(gl_TexCoord[0].x, 1.0-gl_TexCoord[0].y); // "unflip" the texture
   
    float xDiff = (texture2D(inputTex,pos + vec2(1.0/teta,0.0)).r - texture2D(inputTex,pos).r);
    float yDiff = (texture2D(inputTex,pos + vec2(0.0,1.0/teta)).r - texture2D(inputTex,pos).r);
   
    float xAngle = atan(xDiff);
    float xRefraction = asin(sin(xAngle) / rIndex);
    float xDisplace = tan(xRefraction) * xDiff;
   
    float yAngle = atan(yDiff);
    float yRefraction = asin(sin(yAngle) / rIndex);
    float yDisplace = tan(yRefraction) * yDiff;
   
    if(xDiff < 0.0) {
      if(yDiff < 0.0)
        output = texture2D(backgroundTex,vec2(pos.x-xDisplace,pos.y-yDisplace));
      else
        output = texture2D(backgroundTex,vec2(pos.x-xDisplace,pos.y+yDisplace));
    }
    else
    {
      if(yDiff < 0.0)
        output = texture2D(backgroundTex,vec2(pos.x+xDisplace,pos.y-yDisplace));
      else
        output = texture2D(backgroundTex,vec2(pos.x+xDisplace,pos.y+yDisplace));
    }
   
    gl_FragColor = output + max(xDiff,yDiff) * vec4(hue,hue,hue,0.0);
}
 

14
Graphics / Re: 2D Water
« on: February 07, 2013, 07:55:03 pm »
Alright. Here's some code:

package main

import (
        sf "bitbucket.org/krepa098/gosfml2"
        "fmt"
)

const size = 500

func main() {
        fmt.Println("Hello World")

        wnd := sf.NewRenderWindow(sf.VideoMode{size, size, 32}, "Water", sf.Style_DefaultStyle, nil)
        wnd.SetFramerateLimit(60)

        firstBuffer := sf.NewRenderTexture(size, size, false)
        secondBuffer := sf.NewRenderTexture(size, size, false)
        finalBuffer := sf.NewRenderTexture(size, size, false)

        //load shaders
        waterShaderRaw, _ := sf.NewShaderFromFile("", "water_raw.glsl")
        waterShaderRaw.SetFloatParameter("textureSize", size, size)
        waterShaderHeightfield, _ := sf.NewShaderFromFile("", "water_heightfield.glsl")

        secondSprite := sf.NewSprite(secondBuffer.GetTexture())
        finalSprite := sf.NewSprite(finalBuffer.GetTexture())

        //debug output
        firstSpriteDbg := sf.NewSprite(firstBuffer.GetTexture())
        firstSpriteDbg.SetScale(sf.Vector2f{0.25, 0.25})

        //render states
        rsRaw := sf.MakeRenderStates(sf.Blend_None, sf.TransformIdentity(), nil, waterShaderRaw)
        rsHeightfield := sf.MakeRenderStates(sf.Blend_None, sf.TransformIdentity(), nil, waterShaderHeightfield)

        for wnd.IsOpen() {

                for ev := wnd.PollEvent(); ev != nil; ev = wnd.PollEvent() {
                        switch ev.(type) {
                        case sf.EventClosed:
                                wnd.Close()
                        }
                }

                //mouse input
                waterShaderRaw.SetFloatParameter("mousePosition", -1, -1)
                if sf.IsMouseButtonPressed(sf.MouseLeft) {
                        mousePos := sf.MouseGetPosition(wnd)
                        if mousePos.X < size && mousePos.Y < size {
                                mx := float32(mousePos.X) / size
                                my := 1.0 - float32(mousePos.Y)/size

                                waterShaderRaw.SetFloatParameter("mousePosition", mx, my)
                        }
                }

                waterShaderRaw.SetTextureParameter("textureTwoFramesAgo", firstBuffer.GetTexture())
                waterShaderRaw.SetTextureParameter("textureOneFrameAgo", secondBuffer.GetTexture())

                secondBuffer.Display()
                finalBuffer.Clear(sf.ColorBlack())

                finalBuffer.Draw(secondSprite, &rsRaw)
                finalBuffer.Display()

                secondSprite.SetTexture(secondBuffer.GetTexture(), false)
                finalSprite.SetTexture(finalBuffer.GetTexture(), false)

                wnd.Clear(sf.ColorBlack())
                wnd.Draw(finalSprite, &rsHeightfield)
                wnd.Draw(firstSpriteDbg, nil) // raw output
                wnd.Display()

                //swap buffers
                firstBuffer, secondBuffer, finalBuffer = secondBuffer, finalBuffer, firstBuffer
        }
}
 
Yeah it's written in Go. I'm sorry.  :P
I didn't change much. Your rendering code is correct.

water_raw.glsl:
uniform sampler2D textureTwoFramesAgo;
uniform sampler2D textureOneFrameAgo;
uniform vec2 mousePosition;
uniform vec2 textureSize;

const float damping = 0.999;

void main()
{
    // pixels position
    vec2 position = gl_TexCoord[0].xy;

    vec4 smoothed =   (texture2D(textureOneFrameAgo, vec2(position.x - 1.0/textureSize.x, position.y)) +
                       texture2D(textureOneFrameAgo, vec2(position.x + 1.0/textureSize.x, position.y)) +
                       texture2D(textureOneFrameAgo, vec2(position.x, position.y + 1.0/textureSize.y)) +
                       texture2D(textureOneFrameAgo, vec2(position.x, position.y - 1.0/textureSize.y))) / 4.0;
                       
               
    float velocity = texture2D(textureTwoFramesAgo, position).g - texture2D(textureTwoFramesAgo, position).r; // <-- @FRex

    smoothed.r = smoothed.r*2.0 + velocity;
    smoothed.g = -smoothed.r;
    smoothed.g *= damping;
    smoothed.r *= damping;

    // add new ripples
    if(mousePosition.x > 0.0)
        if(distance(position, mousePosition) < 1.0/textureSize.x * 5.0)
            smoothed.r = 0.9;

           
    gl_FragColor = vec4(smoothed.r, smoothed.g, 0.0, 1.0);
}
 

water_heightfield.glsl:
uniform sampler2D inputTex;

const vec4 baseColorL = vec4(0.0,0.0,0.0,1.0);
const vec4 baseColorH = vec4(1.0,1.0,1.0,1.0);

void main()
{
    vec4 color = mix(baseColorL,baseColorH,(texture2D(inputTex,(gl_TexCoord[0].xy)).r+1.0)/2.0);
    gl_FragColor = color;
}
 

This should generate a nice heightfield.

@FRex
Have a look at line 19. Your waves disappear because you're actually losing the negative part (correct me if I'm wrong) of the waves intensity which I store in the green channel.

@Foaly
Yes the output in red is the raw output. Though you can still apply whatever transformations you like.

15
Graphics / Re: 2D Water
« on: February 07, 2013, 02:44:46 pm »
I was toying around with your code a little bit and I came up with this:

Is this the expected behaviour? I'm not really sure what you're looking for.

Pages: [1] 2
anything