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.


Topics - lolz123

Pages: 1 [2]
16
SFML projects / NEAT Visualizer
« on: December 06, 2012, 03:03:29 am »
Hello,

I have recently been experimenting around with some AI, and ended up writing an implementation of the Neuro-Evolution of Augmenting Topologies (NEAT) algorithm. This algorithm uses a genetic algorithm to evolve neural network structure and weighting simultaneously. The resulting network uses integrate-and-fire neurons and can be recurrent.

The NEAT algorithm itself does not use SFML, but I wrote a visualization system that uses another genetic algorithm to organize images of otherwise dimensionless neural networks using SFML to draw them. The demo evolves a network that mimics a XOR, and then gives you an image of it.

The NEAT implementation and the visualizer are both pretty generic, so feel free to use it in any of your own projects. The source code for the demo is included (Main.cpp).

Download link: https://sourceforge.net/projects/neatvisualizers/

Here is the paper I followed to write this algorithm: http://nn.cs.utexas.edu/downloads/papers/stanley.ec02.pdf

An example:
- Green nodes are inputs
- Black nodes are hidden
- Yellow nodes are outputs
- The red side of a connection is the side where it acts as an input to the connected node

Here is a video of this NEAT package used in a game to control the limbs of a mech for a fluid, natural looking animation:




17
Graphics / Destruction of the OpenGL context
« on: January 21, 2012, 04:22:08 am »
Hello,

I have been plagued for a while by some destruction order issues.
When the program closes, it gives me a memory access violation and points me to line 110 in WglContex.cpp. I assume that the OpenGL context is destroying before sf::Texture and sf::RenderTextures are destroyed, but they are still making calls to the context to delete the textures.  The only solution I have had so far is allocating textures on the heap and explicitly deleting them. Is there a way around this?

18
SFML projects / SFML Light System - Let There Be Light
« on: December 31, 2011, 04:17:53 am »
Let There Be Light is a 2D dynamic soft shadows system that uses SFML.

Here are some features:
- Physically accurate soft shadows
- Quad tree scene graph
- Light texture caching
- Emissive lights
- Light beams
- Directional lights
- Adjustable light color, attenuation, spread, source size, cone angle, bloom, and cone edge softness
- Ambient light setting
- Extendable light shape rendering
- Light bloom rendering

Feel free to use this system in a game. Please put me in the credits somewhere :).

Download (includes demo): https://sourceforge.net/projects/letthebelight/

The light system in action in the game "Gore Factor":


19
SFML projects / Alone in the Shadows: Ludum Dare #22 Entry
« on: December 24, 2011, 11:18:55 pm »
Here is a link to my entry to the Ludum Dare #22. It uses SFML for windowing, render textures, text, and sound.

Download link: https://sourceforge.net/projects/aloneshadows/

As always, you will need the VS2010 runtime environment, linked in the readme.

Here is a screenshot:


20
Graphics / Maximum Render Texture Size
« on: November 05, 2011, 06:02:08 pm »
Hello,

I have created a 2D lighting system that pre-calculates the lights and stores them in render images. However, for very large lights, the image is clipped, even though I am well below the sf::Image GetMaximumSize() (texture size) limit. Do render images (render textures in the latest version of SFML2) have a limit of their own? If so, how can I find it? Splitting it into lots of smaller textures isn't and option considering it takes like 1 second to create just one render image (see topic: http://www.sfml-dev.org/forum/viewtopic.php?t=4832&sid=a0b8815426b72f69f077c9bde2dda9cd)

Here is a picture of the clipping:



Thank you for any help you can offer.

21
Graphics / Shadow Occlusion Rendering
« on: September 14, 2011, 11:20:27 pm »
Hello,

I create a 2D dynamic shadows algorithm that uses a quad tree to store lights and shadow hulls.

For those unfamiliar with what 2D dynamic shadows are check this out:

http://archive.gamedev.net/archive/reference/articles/article2032.html

This allows me to quickly access which lights are affecting which hulls. However, I would now also like to do something similar to occlusion culling except with shadows.

If a hull is in a shadow of another hull, it doesn't have to render the shadow since it is already dark anyways. In the image below, the shadow of the shadow hull on the bottom left doesn't actually need to be rendered since it is in the shadow of the hull to the top left of it:



However, to do this effectively, I need to perform a "reverse painter" algorithm with the quad tree somehow, where things closer to the light are drawn first. Any ideas on how to do this would be helpful.

Also, for the shadow occlusion itself, is there a way to detect if a certain z buffer value is currently in a particular region in the z buffer? I believe that that this is how hardware accelerated occlusion culling systems work, but I do not know how to do it in OpenGL.

Any help would be appreciated.

[EDIT]:

Well, I found out a way to do the occlusion culling part. However, the problem of sorting the objects according to the distance from the light source still remains.

22
Graphics / SFML 2 Water Shader Problem
« on: August 19, 2011, 05:24:41 am »
Hello,

I am pretty new to GLSL, but I was able to create a full screen water distortion effect by setting the pixel colors to that of pixels whose positions are dictated by offsets which are derived from a tiling noise texture. Here is how it looks:



Here is the shader. Time is wrapped to be in the range [0, 256) in order to have the water "flow" without any stutter as the noise texture repeats.

Code: [Select]
uniform sampler2D screenTex;

uniform sampler2D noiseTex;

uniform float time;

void main()
{
// Get the color of the noise texture at a position the current fragment position offset by the time
vec4 noiseTexCol = texture2D(noiseTex, vec2(gl_TexCoord[0].x + time, gl_TexCoord[0].y + time));

// Reduce the offset
float reducedOffset = noiseTexCol.x / 70;

// Get the color of the screen at the offset location
    vec4 col = texture2D(screenTex,  gl_TexCoord[0].xy + vec2(reducedOffset, reducedOffset));

// Set the fragment color
gl_FragColor = col;
}


But now I would like to apply that only to a specific region in order to create a body of water. I would like to simply distort a region and apply a blue overlay. I tried binding the shader while I drew a simple blue box, but when I run it what was once a blue box flickers seemingly random colors from the screen texture. I am not sure that I understand the GLSL texture coordinate system properly. Perhaps the lack of texture coordinates on the primitives is causing the color flicker.

Here is the code I am using to draw the body of water:

Code: [Select]
  // Render the water shape with the shader applied
sf::Image screen;
screen.CopyScreen(appWindow);
waterShader.SetTexture("screenTex", screen);
waterShader.SetParameter("time", time / 256.0f);

glColor4f(0.2f, 0.2f, 1.0f, 0.4f);

glDisable(GL_TEXTURE_2D);

waterShader.Bind();

Renderb2Body(body, 80.0f);

waterShader.Unbind();

glEnable(GL_TEXTURE_2D);

glColor4f(1.0f, 1.0f, 1.0f, 1.0f);


Renderb2Body just draws a box. It works fine without the shader.

Any help on this matter is appreciated.

23
Graphics / Render Image Anti-aliasing
« on: August 17, 2011, 12:05:12 am »
Hello everybody,

Does anybody know how to perform anti-aliasing on a render image?
I have found some older posts here about this issue, but they did not actually present a solution to this problem. I also found some threads about a newer OpenGL extension which permits FBO anti-aliasing, but I am not sure how to implement it. Also, I read that it is not possible at all when using a p-buffer.

I would appreciate any help you can offer!

24
Graphics / sf::RenderImage::Create extremely slow
« on: May 14, 2011, 08:17:05 pm »
I have a game in which I have a tile map and I want to render blood splatters to a set of RenderImages (so the blood splatters remain permanently attatched to the walls). They RenderImages are created dynamically, but the game pauses for about 1- 2 seconds every time I call .create (the dimensions are 128 x 128, so it is not that much). When not created dynamically, it takes my machine like 5 minutes to create enough textures for the entire map. What could be causing it to create the textures so extremely slowly?

Code: [Select]
// Check to see if must create a new texture (texture already in place has no dimensions)
if(pImg->GetWidth() == 0)
{
pImg->Create(128, 128, false);
pImg->Clear(sf::Color(0, 0, 0, 0));
}

25
Graphics / sf::Text not rendering properly
« on: May 08, 2011, 04:08:11 pm »
Hello,

I have created a game using SFML and OpenGL directly, and I wanted to display the script console in the game. However, when I try to render the text, it either uses the previously bound texture (if textures are enabled) or just renders the polygon on which the character is supposed to appear with a solid colored background (textures disabled). In order to mix the SFML OpenGL implementation and my own, I used the sf::RenderTarget functions SaveGLStates and RestoreGLStates to preserve the OpenGL state. The code show below gives me textured boxes instead of text:

Code: [Select]
// Render text
text.SetFont(sf::Font::GetDefaultFont());
text.SetString("bla bla bla");
text.SetColor(sf::Color(18, 128, 34));
text.SetStyle(sf::Text::Regular);

appRenderer.SaveGLStates();
appWindow.Draw(text);
appRenderer.RestoreGLStates();


What could be causing this problem?

26
SFML projects / Gore Factor SFML
« on: April 13, 2011, 11:28:38 pm »
Hello everybody,

Here is a project I am currently working on that uses SFML for window handling, sound, and some rendering stuff.

It is a remake of the game "Thing Thing" by Diseased Productions (flash).

So far, all you can do is run around the map and shoot stuff with your trusty AR.

Features:
- 2D Dynamic Shadows
- Box2D physics
- Compound vector/sprite and frame independent animations
- Water
- Lua Scripting
- Quad Tree Scene Graph



Download link: https://sourceforge.net/projects/gorefactorsfml/
VS2010 Redistributable Package REQUIRED: http://www.microsoft.com/downloads/en/details.aspx?familyid=A7B7A05E-6DE6-4D3A-A423-37BF0912DB84&displaylang=en

YouTube Video:



Controls:
- Mouse to aim, click to shoot.
- Move with WASD.
- Reload with R.
- Hold space for slow motion
- Shift + ~ to open the Lua command console

27
General / Startup Error
« on: April 08, 2011, 10:18:24 pm »
Hello,

I was able to run the tutorials, but after converting an old SDL project to SFML, I get the error:

Quote
The application was unable to start correctly (0xc000007b). Click
OK to close the application.


when trying to run the program. I am using SFML 2 in VS2010, and I did recompile the library. Again, it worked for the tutorials.

Any ideas what may be the cause of this?

28
Window / Memory Access Violation After Calling App.Close();
« on: September 05, 2010, 04:17:07 pm »
Hello,

I am new to SFML (just switched over from SDL) and programming in general, so this might be a pretty stupid question, but here it goes:

I tried code from the Window Events as well as the Window Creation tutorials, but while running either of them I get:

Code: [Select]
Unhandled exception at 0x6903a39d in ThingThingSFML.exe: 0xC0000005: Access violation reading location 0x00000054.

I narrowed down the code to:

Code: [Select]
#include <SFML/Window.hpp>

int main()
{
    sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
App.Close();

    return EXIT_SUCCESS;
}


yet I still get the same error. It opens a window perfectly, but it gets a memory access violation when Close(); is called. All other examples that do not use the Window class seem to work fine. I was using SFML2.0, so I tried the same with SFML1.6 with no luck (same error)

Compiler: VS2010

I linked to the dynamic versions of the libraries. I tried using sfml-main as well, I can't see how that could possibly make a difference anyways.

What could possibly cause this error?

Thank you for any help you can offer!

Pages: 1 [2]
anything