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
SFML projects / Let There Be Light 2
« on: November 29, 2014, 10:59:36 pm »
Hello everyone,

As I mentioned in the original LTBL thread, I am currently (finally) remaking LTBL with clean code, more features, higher performance, and greater ease of use. It now uses only SFML as a dependency.

New features include:
- Directional lights
- Codeless light types
- Antumbras
- Superior performance
- Transparency

Follow the repository here: https://github.com/222464/LTBL2

Demo available here: https://drive.google.com/file/d/0B2btNvgW7MHUQ0JfQTQ4ZndmNHc/view?usp=sharing

Here is an example of antumbra rendering so far (this was impossible in the original LTBL):

« on: November 11, 2014, 01:58:48 am »

I have recently been working on some hierarchical temporal memory (HTM) stuff, and developed my own variant called continuous HTM (CHTM).

HTM is an algorithm for simulating the functions of the neocortex.

My CHTM implementation performs reinforcement learning (learning towards a goal). It runs entirely on the GPU using OpenCL.

I made a visualization of my CHTM using SFML's graphics system. It is essentially a volume renderer, composed of many stacked 2D slices. It doesn't use raw OpenGL, since I didn't need it (I wanted an orthographic projection).

Here is a video of the cortical tissue volume in action. It isn't shown in the video, but the system is learning to balance a pole.


As usual, it is free open source software. It is available here: https://github.com/222464/ContinuousHTMGPU

For those who want to learn more about HTM, you can read the following paper: http://numenta.org/resources/HTM_CorticalLearningAlgorithms.pdf

SFML projects / My AI Collection Using SFML for Visualization
« on: September 24, 2014, 04:54:14 am »

As some of you may know, I am really into AI, especially reinforcement learning.
I use SFML to set up experimentation environments and to visualize them.
So, I thought I should post here about what is now a rather large collection of reinforcement learning agents.
I am still using the same cart-pole balancing simulation and mountain car problems, but I recently also added a maze.

Perhaps some of you find it useful for a game or research!

Link to repository: https://github.com/222464/AILib

Here is the list of available agents and components of the agents, as of 9/23/2014:
  • APSSC - ant colony optimization based labeler
  • Evolved CTRNN - a second-order recursive neural network used for evolution
  • ConvNet - 2D convolutional neural network for feature extraction using restricted boltzmann machiness
  • Autoencoder - unsupervised learning and feature compression
  • DBN - deep belief network (stacked RBM)
  • DSOM - deep self-organizing map for massive feature reduction
  • FA- function approximator (standard multi-layer perceptron)
  • FERL - free-energy based reinforcement learner. Simplest learner in this library
  • RBM - generic restricted boltzmann machine
  • DNF - dynamic neural field reinforcement learner (hebbian based)
  • Elman - simple Elman network implementation
  • TDFalcon - ART (adaptive resonance theory) based reinforcement learning
  • HTM - hierarchical temporal memory
  • HTMRL - continuous action and state POMDP reinforcement learner
  • HTMRLDiscreteAction - discrete action and continuous state POMDP reinforcement learner
  • Bayesian Optimizer - simple implementation
  • HyperNet - proto-ERL
  • LSTMG - generalized LSTM implementation
  • LSTMActorCritic - actor-critic using LSTMG
  • LSTMRL- simpler version of LSTM discrete action reinforcement learner
  • ActorCriticAgent - backprop critic, hebbian actor
  • CACLA - continuous actor-critic learning automaton
  • MemoryActor - actor portion only with hebbian learning and memory cells
  • MultiQ - simple Q learner with function approximation and discrete actions
  • NCPSOAgent - no critic particle swarm optimization agent
  • PSOAgent - critic included particle swarm optimization agent
  • QAgent - continuous state and action Q learner using iterative policy derivation
  • RLLSTMAgent - simplified LSTM continuous action and state reinforcement learner
  • SOM - simple Kohonen self-organizing map
  • SOMQAgent - SOM-based state discretizing Q learner
  • TabularQ - simplest possible discrete state and action Q learner
  • RAAHN - real-time autoencoder augmented hebbian network

SFML projects / ERL
« on: July 01, 2014, 06:54:01 am »

I have yet another AI project that uses SFML to share with you!
It is still in very early stages, but I thought I should post early, in case some of you want to help with the development  ;)

ERL stands for Evolved Reinforcement Learner. It is a attempt at creating large scale artificial general intelligence. ERL follows a different philosophy from existing AGI approaches. Instead of trying to study the brain and re-create it, it uses evolution to evolve a brain from scratch that is hopefully better suited for computer simulation.

ERL essentially sets up a "brain sandbox", in which vast numbers of different learning algorithms and architectures can exist. It then evolves to find the individual that maximizes cumulative reward on a set of experiments. So, it evolves a reinforcement learning (reward-seeking) agent, giving it its name.

In order to speed things up, ERL uses OpenCL for executing the brain in parallel.

ERL uses SFML (or will use, it is still early on  ::) ) to display information on the AI itself, a plot of the gathered reward, and the experiments that are being run. Depending on how complicated it ends up getting, we may use something like SFGUI to help out with the interface. If any of you SFML coders out there would like to lend a hand and help develop the visualization system, please let me know!

ERL was conceived in an AGI discussion group. It has around 70 members. If you would like to join the group, PM me! (we use Slack for chat)

For more technical details on how ERL works as well as access to the source, see the GitHub project: https://github.com/222464/ERL (the readme has a more in-depth description of how ERL works)

The following features have been implemented so far:
  • OpenCL framework
  • Compositional pattern producing network generation, evolution, and CL code generation
  • Brain Genotype and corresponding OpenCL kernel compiler
  • CMake support

ERL uses OpenCL meta-programming to support genetic programming (evolved code). Here is some example generated code:


Generated OpenCL kernel

// Dimensions of field
constant int fieldWidth = 10;
constant int fieldHeight = 10;
constant float fieldWidthInv = 0.100000;
constant float fieldHeightInv = 0.100000;

// Connection offsets
constant char2 offsets[25] = {
        (char2)(-2, -2), (char2)(-2, -1), (char2)(-2, 0), (char2)(-2, 1), (char2)(-2, 2),
        (char2)(-1, -2), (char2)(-1, -1), (char2)(-1, 0), (char2)(-1, 1), (char2)(-1, 2),
        (char2)(0, -2), (char2)(0, -1), (char2)(0, 0), (char2)(0, 1), (char2)(0, 2),
        (char2)(1, -2), (char2)(1, -1), (char2)(1, 0), (char2)(1, 1), (char2)(1, 2),
        (char2)(2, -2), (char2)(2, -1), (char2)(2, 0), (char2)(2, 1), (char2)(2, 2)

// Connection update rule
void connectionRule(float input0, float input1, float input2, float* output3) {
        *output3 = sin(-3.295338 * input0 + 5.266167 * input1 + -3.366515 * input2 + 1.680196);

// Activation update rule
void activationRule(float input0, float input1, float input2, float* output3) {
        *output3 = sigmoid(-3.536474 * input0 + 4.128592 * input1 + 2.613249 * input2 + 3.062753);

// Data sizes
constant int nodeAndConnectionsSize = 78;
constant int connectionSize = 3;
constant int nodeSize = 3;

// The kernel
void kernel nodeUpdate(global const float* source, global float* destination, read_only image2d_t randomImage, float2 randomSeed) {
        int nodeIndex = get_global_id(0);
        int nodeStartOffset = nodeIndex * nodeAndConnectionsSize;
        int connectionsStartOffset = nodeStartOffset + nodeSize;
        int2 nodePosition = (int2)(nodeIndex % fieldWidth, nodeIndex / fieldHeight);
        float2 normalizedCoords = (float2)nodePosition * float2(fieldWidthInv, fieldHeightInv);

        // Update connections
        float responseSum0 = 0;

        for (int ci = 0; ci < numConnections; ci++) {
                int2 connectionNodePosition = nodePosition + offsets[ci]

                // Wrap the coordinates around
                connectionNodePosition.x = connectionNodePosition.x % fieldWidth;
                connectionNodePosition.y = connectionNodePosition.x % fieldHeight;
                connectionNodePosition.x = connectionNodePosition.x < 0 ? connectionNodePosition.x + fieldWidth : connectionNodePosition.x;
                connectionNodePosition.y = connectionNodePosition.y < 0 ? connectionNodePosition.y + fieldHeight : connectionNodePosition.y;

                int connectionNodeIndex = connectionNodePosition.x + connectionNodePosition.y * fieldWidth;
                int connectionNodeStartOffset = connectionNodeIndex * nodeAndConnectionSize;
                int connectionStartOffset = connectionsStartOffset + ci * connectionSize;

                float response0;

                connectionRule(source[connectionStartOffset + 0], source[connectionStartOffset + 1], read_imagef(randomImage, connectionNodePosition + nodePosition).x, &response0);

                // Add response to sum and assign to destination buffer
                destination[connectionNodeStartOffset + 0] = response0;

                // Accumulate response
                responseSum0 += response0;

                // Assign recurrent values to destination buffer

        float output0;

        activationRule(responseSum0, source[nodeStartOffset + 1], read_imagef(randomImage, nodePosition + int2(-1, -1)).x, &output0);

        // Assign to destination buffer
        destination[nodeStartOffset + 0] = output0;

        // Assign recurrent values to destination buffer

SFML projects / Unnamed "Tug-Of-War" Strategy Game
« on: June 02, 2014, 11:38:54 pm »
Hello all,

I am currently working on a larger project with some friends, and I thought I should share the progress so far. Criticisms of all kinds are welcome, whether it be about the game idea itself, the graphics, or something else.

I don't have a working demo for you guys to try yet, but I have a few screenshots to share. I will post in this thread when new features are added to hopefully get some feedback on them. So, there might not be much to comment on now, but hopefully there will be soon.

The game is a strategy game, based on the Starcraft 2 mod "Colonial Line Wars". Both teams build buildings that automatically spawn units in waves. The goal is to push back the enemy all the way to their base, such that you can destroy their command center. It is sort of like a tug-of-war, where you need to build certain units to counter enemy units as well as achieve the proper formation to maximize effectiveness.

However, there is a twist. If you have seen my past forum posts, then you probably know that I love artificial intelligence. So, in this game, each wave the player rates their units. The next wave is then bred based on those ratings using an evolutionary algorithm. This way, you can indirectly micromanage your units by fine-tuning their AI.

The AI has a large number of sensors and can even speak audibly to other units. They invent a language through a combination of reinforcement learning as well as the player's selections. Right now I have some generated audio of beeps and boops that are modulated by the AI.

For those interested in what AI techniques it uses: It uses Long-Short Term Memory neural networks (LSTM) so that the AIs can form memories. These are placed into an actor-critic architecture, and are updated similarly to the networks in the Continuous Actor-Critic Learning Automaton (CACLA).

The game uses the D3D (Deferred 3D) engine I posted about a while ago, which uses SFML for audio, 2D rendering, windowing, and texture loading. The engine's parallel processing on the scene objects allows us to run hundreds of AIs in real-time.

Here are some pictures of an early test battle. Please ignore the UI, it is a placeholder.

The environment:

General / (SFML + OpenGL) GL_INVALID_OPERATION on glLinkProgram
« on: May 01, 2014, 07:53:45 pm »

I am having some difficulties resolving a OpenGL related error. I am posting on these forums since I never had these issues with SDL, but with SFML I do, so it might be related to SFML.

Basically, I made a custom shader loader (the same one I used to use with SDL), but glLinkProgram generates GL_INVALID_VALUE.

The specs say:

GL_INVALID_VALUE is generated if program is not a value generated by OpenGL.

for glLinkProgram.

This would seem to indicate that the program handle I passed it is bogus. But, I generated the ID a mere 8 lines before that, and it is non-zero.

Loading the shader is first thing my application does after opening a window and calling glewInit.

This error does not affect the program for my machine, it runs fine, but it doesn't work on others. It runs on mine (ATI) but not on that of my friend (NVidia). However, my machine does still throw the error, but it only shows itself when I am running it through gDEBugger.

I also noticed through gDEBugger that SFML is creating 3 OpenGL contexts for some reason.

Anybody have any ideas as to what may be going on?

Feature requests / My (Possibly stupid) Ideas for the Future of SFML
« on: April 22, 2014, 08:30:29 pm »
Hello everyone,

I would like to share with you some ideas for new features for SFML. I hope the new development team takes some of these into consideration. That said, the following ideas may be impractical or not fit with SFML's design philosophy. Also keep in mind that I have not extensively studied SFML's source. I also know that a lot of these features would require major alterations to SFML, so think of these features as being part of SFML Version 8.0 or something  :D

I think SFML should be less of an abstraction of OpenGL and more of an interface for it. Think of something like OpenTK. Basically, wrappers that simplify using OpenGL, but do not obscure OpenGL functionality from the user. It could still supply functions for making handling 2D easier, but they should not make interfacing with OpenGL code a pain like they currently do (you may disagree, this is just from my experience). The 2D helper functions would have to have well-defined GL states (documented), and should make as few GL State transitions as possible. It might also be a good idea to include a GL state tracking system.

binary1248's SFNUL library looks awesome. I wouldn't mind seeing it become part of SFML.

I would drop the current threading system in favor of the C++11 threading system.

AI Module?
Here is a totally crazy idea. I am obsessed with AI, so there is an obvious amount of bias here. Perhaps SFML could have some AI related functionality. Some basic pathfinding, state machines, descision trees, and perhaps even some more hardcore machine learning algorithms (LSTM-RL is my current favorite  ;D). There are not really many decent AI libraries out there, so I think SFML could get some edge over the competition by offering AI functionality. Does this fit with SFML's design philosophy? Perhaps not. But from what I can tell SFML is used mostly for games, and games need AI.

SFML projects / My Most Exotic SFML Application
« on: March 27, 2014, 03:26:35 am »
Hello all,

I recently got into some robotics with Arcbotics's Hexy, a Kickstarted hexapod robot.
It came with a simple movement controller that cannot combine movements and is very stiff looking.
So I decided to make my own inverse kinematics controller for Hexy. After that, I wanted a way to control it manually.

I had a Xbox controller sitting around, so I decided to make it communicate over serial and send commands dictated by the Xbox controller. It should work with Bluetooth too, haven't tested it yet though.

So where does SFML come in here? Well, I needed some library to handle joystick input, and I love SFML, so I decided to use that. I know, not the greatest and fullest application of SFML, but I felt it was still worth sharing here (especially since it is such a weird application of SFML  ;) )

Here's the download: https://sourceforge.net/projects/hexyik/?source=navbar

And here's a video of it in action:


SFML projects / d3d (Deferred 3D) - A 3D Engine Using SFML
« on: March 17, 2014, 06:29:56 pm »
Hello all,

I originally wrote a 3D game engine with SDL + OpenGL + Bullet + Ogg + Vorbis + OpenAL + LUA. This original version had a lot of features, but was not very user-friendly. So I decided to re-write it, this time using SFML  ;D

The new version is especially different in that all game logic can be executed in parallel: there is a thread pool (using C++11 threading) that runs game entities all at once. It double-buffers the game logic and has special buffer-shifting smart pointers to make working in such an engine relatively simple.

The aim is to use only the most modern C++ as well as only the most modern OpenGL. The engine never uses raw new/delete or primitive arrays and only uses OpenGL 4+ features.

Here is an example of voxel terrain (it can do overhangs) with massive amounts of grass rendering.

Here is the engine's real-time global illumination in action:

Finally, here is a link to the bitbucket repository:


SFML projects / Alife - Artificial Life Simulation
« on: December 31, 2013, 06:59:20 am »

I made an artificial life simulation just for fun and I thought I should share it. It is still nowhere near done (I only worked on it for 3 days so far  :P), and still quite buggy, but it is already possible to witness some interesting patterns!  :)

So far I have seen simple gathering, competing for food, predators, baby-eating (nerfed), timed grazing intervals (a swarm of creatures moving on a clock), upgrading agility to eat before the rest of the swarm arrives, and lots of dying.

I aim to make one of the most complex artificial life simulations ever (big ambitions I know, I can dream :)) ).

Here is how it works so far:

Each creature gets a fixed number of points. These points can be allotted to 15 different attributes:

  • Health
  • Armor
  • Main Damage
  • Piercing Damage
  • Speed
  • Agility
  • Energy Consumption
  • Starting Energy
  • Reproduction Rate
  • Reproduction Energy Loss
  • Range
  • Healing
  • Max Life Span
  • Size
  • Attack Rate

The way these points are allotted is evolved over time. Creatures can reproduce either with binary fission or with sex. A creature can lay down pheromones to help remember where things are (stigmergy). Creatures can evolve which pheromone type they lay down as well.

Each creature is controlled by 2 neural networks: A dopamine distributing network that defines the reward that the second actor network receives. The former is evolved, and the later both learns in its lifetime through hedonistic synapse modification and evolution (knowledge is not lost). As inputs, the neural network receives the creature's velocity, the grid around it, the nearest N creatures with information about them (direction, health, size, similarity), and the nearest food source. The creatures then decide how to move, attack, mate, and eat.

For the AI, I used my NNBrain library: http://en.sfml-dev.org/forums/index.php?topic=13449.0

Creatures can evolve to become either carnivores or herbivores. There are no omnivores at the moment.

Right now, there are major balancing issues in the stats. I also want to add construction (block placement), omnivores, and more complex fighting, among other things.

Here is the download link: https://sourceforge.net/projects/alifennplasticity/?source=navbar

Be warned though, it is incredibly processing intensive! I get only like 20 fps on my rig. The reason is that there are simply too many creatures (and I need to add a spatial tree).

There are typically around 1000 creatures at once if I had to guess.

It's not exactly visually stunning, but here is an image of it (each colored square is a creature):

SFML projects / NNBrain SFML Demo
« on: November 02, 2013, 10:02:00 pm »

Hello all,

I would like to present to you my new self-learning AI library, NNBrain!
It includes a demo that uses SFML to visualize the cart-pole balancing problem.

Right now, there are 3 agents (AI's), 1 of which is well know while the other two are more original in implementation:

  • Actor-Critic
  • Neural-Q

All agents are applicable to both continuous and discrete task domains.

Feel free to use it in a game or other application to hopefully get some awesome self-improving AI!

Download Link: https://sourceforge.net/projects/nnbrain/?source=navbar

SFML projects / GLLight2D
« on: June 21, 2013, 09:22:19 pm »

The development of GLLight2D has resumed! Development might still be a bit slow (since I have a lot of other projects too  ;D), but I decided to work on GLLight2D (the "sequel" to Let There Be Light) some more during down times with my other projects. It has absolutely nothing in common with the original codebase I put on Github though, since it is now a 2D adaptation of my real-time path tracer, instead of just a cleaner and more generic version of LTBL.

Since it is a path tracer, it has full blown global illumination!

GitHub page: https://github.com/222464/GLLight2D

Here is an image of the progress so far:

SFML projects / Real-time Path Tracer
« on: May 30, 2013, 09:54:42 pm »

I started developing a real-time path tracer with SFML + raw OpenGL, and would like to share my results so far.
These renders are full of visual artifacts caused by bugs in the tracer, but as soon as I iron out those bugs I will upload an executable as well as the source code  ;)

All the ray tracing is done in a GLSL shader, and the scene is uploaded as a set of texture buffers containing the spatial partitioning tree and the geometry/material data.

It loads .obj models, and has multi-bounce global illumination.

A version with more samples:

Feature requests / Texture ID Accessor
« on: April 29, 2013, 09:44:29 pm »

I cannot seem to find the getTextureID function in the latest version of SFML anymore. Not having this function makes it rather difficult to use SFML with OpenGL. Why not have such an accessor?

SFML projects / Ludum Dare 25 Entry - Hero Must Die
« on: December 18, 2012, 03:46:04 am »

I took part in the LD25 Jam, and here is my entry:


It uses SFML for windowing, sound, and threading.

It uses the NEAT algorithm from the visualization program I previously posted about on this forum: http://en.sfml-dev.org/forums/index.php?topic=9897.0

The AI powered by these neural networks tries to beat levels that you set up with obstacles. You must stop the AI from reaching the princess.

Here is a screenshot:

Pages: [1] 2