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 - lolz123

Pages: 1 2 3 [4] 5 6 ... 18
46
SFML projects / Re: Unnamed "Tug-Of-War" Strategy Game
« on: June 03, 2014, 08:24:58 pm »
@Nexus: I played Warcraft III a long time ago, but I cannot remember if I played that particular mod. The game will have a VS AI mode, where the AI uses its own reward function. It would be cool though to see the battle play itself out on its own though  :)

The development of D3D has not halted, it gets new features as needed to make this game.

@Peteck: Deferred shading is good for post-processing effects like SSAO, which is used here. Additionally, if we want a nighttime scene, we will need lights. I also prefer the elegance of deferred shading over forward shading.

The shadows right now use percentage-closer filtering, I might switch over to variance shadow mapping eventually, since then I can use the hardware filtering.

As for the peter panning, I think I went a bit too hard on the bias ;)

47
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:


48
General / Re: (SFML + OpenGL) GL_INVALID_OPERATION on glLinkProgram
« on: May 01, 2014, 08:16:52 pm »
Thanks for the reply.

I am working on a complete minimal example that displays the problem, but this will take some time. Until then, here is the code surrounding the glLingProgram call:

bool Shader::createAsset(const std::string &name) {
        // Name contains vertex shader file name and the fragment shader file name, so extract those
        std::istringstream is(name);

        std::string geomName, fragName, vertName;
        is >> geomName >> vertName >> fragName;

        // Load the shaders
        if(geomName != "NONE")
                if(!loadGeometryShader(geomName, _geomID)) {
                        std::cerr << "Could not load geometry shader!" << std::endl;
                        return false;
                }

        if(vertName != "NONE")
                if(!loadVertexShader(vertName, _vertID)) {
                        std::cerr << "Could not load vertex shader!" << std::endl;
                        return false;
                }

        if(fragName != "NONE")
                if(!loadFragmentShader(fragName, _fragID)) {
                        std::cerr << "Could not load fragment shader!" << std::endl;
                        return false;
                }

        // Create the main shader
        _progID = glCreateProgram();

        // Attach the shader components (vertex and fragment) to the program
        if(_geomID != 0)
                glAttachShader(_progID, _geomID);

        if(_vertID != 0)
                glAttachShader(_progID, _vertID);

        if(_fragID != 0)
                glAttachShader(_progID, _fragID);

        if(!link(_progID)) {
                std::cerr << "- in " << name << std::endl;

                return false;
        }

        D3D_GL_ERROR_CHECK();

        return true;
}
 

the load___shader calls just load and compile a shader, it works fine.

Shader::link looks like this:

bool Shader::link(GLuint id) {
        glLinkProgram(id);

        int result;

        // Check if linking was successful
        glGetProgramiv(id, GL_LINK_STATUS, &result);

        if(result == GL_FALSE) {
                // Not validated, print out the log
                int logLength;

                glGetProgramiv(id, GL_INFO_LOG_LENGTH, &logLength);

                if(logLength <= 0) {
                        std::cerr << "Unable to link program: Error: Invalid log length \"" << logLength << "\": Could not retrieve error log!" << std::endl;

                        return false;
                }

                // Allocate the string
                std::string log;

                log.resize(logLength);

                glGetProgramInfoLog(id, logLength, &result, &log[0]);

                std::cerr << "Unable to link program: " << log << std::endl;

                return false;
        }

        D3D_GL_ERROR_CHECK();

        return true;
}
 

It crashes on the glLinkProgram.

The main looks like this:

int main() {
        std::ofstream out("out.txt");
        std::cout.rdbuf(out.rdbuf());

        std::ofstream err("err.txt");
        std::cerr.rdbuf(err.rdbuf());

        sf::RenderWindow window;
        sf::ContextSettings settings;

        settings.majorVersion = 4;
        settings.minorVersion = 3;
        settings.stencilBits = 0;
        settings.antialiasingLevel = 0;

        window.create(sf::VideoMode(1280, 720), "d3d", sf::Style::Default, settings);

        window.setVerticalSyncEnabled(true);
        window.setFramerateLimit(60);

        GLenum error = glewInit();

        assert(error == GLEW_NO_ERROR);

        // -------------------------------- OpenGL Setup --------------------------------

        d3d::sfmloglSetup();

        glViewport(0, 0, window.getSize().x, window.getSize().y);

        d3d::checkForGLError();

        // -------------------------------- Scene Setup --------------------------------

        std::unique_ptr<d3d::RenderScene> scene(new d3d::RenderScene());

        {
                std::shared_ptr<d3d::Shader> gBufferRender(new d3d::Shader());
                std::shared_ptr<d3d::Shader> gBufferRenderNormal(new d3d::Shader());
                std::shared_ptr<d3d::Shader> gBufferRenderHeightNormal(new d3d::Shader());
                std::shared_ptr<d3d::Texture2D> whiteTexture(new d3d::Texture2D());

                gBufferRender->createAsset("NONE resources/shaders/gbufferrender/gBufferRender.vert resources/shaders/gbufferrender/gBufferRender.frag");
                gBufferRenderNormal->createAsset("NONE resources/shaders/gbufferrender/gBufferRenderBump.vert resources/shaders/gbufferrender/gBufferRenderBump.frag");
                gBufferRenderHeightNormal->createAsset("NONE resources/shaders/gbufferrender/gBufferRenderParallax.vert resources/shaders/gbufferrender/gBufferRenderParallax.frag");
                whiteTexture->createAsset("resources/shaders/white.png");

                scene->createRenderScene(8, d3d::AABB3D(d3d::Vec3f(-1.0f, -1.0f, -1.0f), d3d::Vec3f(1.0f, 1.0f, 1.0f)), &window,
                        gBufferRender, gBufferRenderNormal, gBufferRenderHeightNormal, whiteTexture);

                scene->_logicCamera._projectionMatrix = d3d::Matrix4x4f::perspectiveMatrix(d3d::_piOver4, static_cast<float>(window.getSize().x) / static_cast<float>(window.getSize().y), 0.1f, 10000.0f);
                scene->_logicCamera._position = d3d::Vec3f(1.5f, 1.5f, 1.5f);
                scene->_logicCamera._rotation = d3d::Quaternion::getFromMatrix(d3d::Matrix4x4f::cameraDirectionMatrix(-scene->_logicCamera._position.normalized(), d3d::Vec3f(0.0f, 1.0f, 0.0f)));
        }
 

the crash occurs when trying to load the first shader.

sfmloglSetup just sets some GL states like so:

void d3d::sfmloglSetup() {
        glGenVertexArrays(1, &_vaoID);
        glBindVertexArray(_vaoID);

        glEnableVertexAttribArray(D3D_ATTRIB_POSITION);
        glEnableVertexAttribArray(D3D_ATTRIB_NORMAL);
        glEnableVertexAttribArray(D3D_ATTRIB_TEXCOORD);

        glFrontFace(GL_CCW);

        glEnable(GL_CULL_FACE);

        glClearDepth(1.0f);
        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);

        glDepthFunc(GL_LESS);
        glEnable(GL_DEPTH_TEST);
}
 

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

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:

Quote
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?

50
Feature requests / Re: Mipmapping for OpenGL texture creation?
« on: April 25, 2014, 05:34:48 pm »
Mipmaps definitely help, even in 2D. I made a simulation called ALife (it's on these forums) where you can zoom in and out of the map. It looked absolutely terrible without mipmaps when zoomed out, but great with them.

Mipmaps apply whenever the image on the screen is scaled down from its actual resolution, something that also applies to 2D.

So yes, I am in favor of adding mipmaps to SFML  :D

51
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

Graphics:
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.

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

System:
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.

52
SFML projects / Re: d3d (Deferred 3D) - A 3D Engine Using SFML
« on: April 17, 2014, 05:38:41 am »
Physically based shading with screen space reflections! Parallax occlusion mapping!


53
SFML projects / Re: d3d (Deferred 3D) - A 3D Engine Using SFML
« on: April 14, 2014, 02:42:44 am »
Another update!

I added 3 new post-processing effects, SSAO, Depth of Field, and Light Scattering.

Here is a picture! More effects to come!


54
SFML projects / Re: d3d (Deferred 3D) - A 3D Engine Using SFML
« on: April 11, 2014, 07:19:49 pm »
Thanks! If you have any questions, I will gladly answer them!

55
SFML projects / Re: d3d (Deferred 3D) - A 3D Engine Using SFML
« on: April 11, 2014, 06:39:07 pm »
Hello again!

I have been working on d3d a lot, mostly adding new features, but also improving some existing functionality.

Here is a new screenshot:



Also, virtual creatures make a return, and I integrated SFGUI (great lib so far  ;D)!



56
General discussions / Re: Future release of SFML 2.2 (feedback needed)
« on: April 11, 2014, 03:31:40 am »
Getters for OpenGL object handles please  :)

57
SFML projects / Re: SFGUI (0.2.3 released)
« on: April 08, 2014, 05:48:55 am »
I'm using VS2013, works perfectly for me! Just integrated it into D3D  :) Great lib!

58
SFML projects / Re: d3d (Deferred 3D) - A 3D Engine Using SFML
« on: April 03, 2014, 06:52:11 pm »
Yeah, I have read papers on their technique before. From what I gather, it is basically like doing Minecraft lighting (a flooding algorithm).

Cryengine didn't *really* have global illumination until 3 AFAIK, they only had some screen space effects.
The technique seems good, not as accurate as the raytraced version though. Cryengine 3 in its entirety, however, is a total mess from what I have seen  :-X Unreal Engine 4 blows it out of the water in my opinion, especially code quality-wise. Cryengine 3 was clearly not made with indie development in mind.

Unreal Engine 4 uses voxel cone tracing, it is more accurate than Light Propagation Volumes but less accurate than full-blown polygonal path tracing  ;)

I am sure my technique can be improved upon A LOT, since I know my dream game engine Brigade 3 runs in real time, and for low-res GI you only need a fraction of the capabilities it has.

Here is a link to Brigade 3, the ultimate graphics engine IMO: http://icelaglace.com/portfolio-type/brigade-3-0/ (and no, it is not a scam, they released a demo for Brigade 2 (I tried it), which also looks fantastic already)

59
SFML projects / Re: d3d (Deferred 3D) - A 3D Engine Using SFML
« on: April 03, 2014, 05:09:18 pm »
Sure!

I sort of made up my own global illumination technique (I like to think I did anyways  ;D ), it is based on path tracing.
I compile the scene into a KD-tree, and then convert that tree into a OpenGL texture buffer object (TBO) so I can read it in a shader. I then path trace at a low resolution, and then blur the results with a special blur that keeps edge details intact.

Performance is not bad, I get 60fps on that simple scene, but I haven't gotten it to work at all (like, nothing shows up) on large scenes for some reason. I think my KD-tree is broken somehow  :P.

The grass isn't too special really  ;) basically I just generate it using the voxel data, and then group the grass into chunks and compile it into a VBO. The vertex shader animates it to sway a bit.

60
SFML projects / Re: d3d (Deferred 3D) - A 3D Engine Using SFML
« on: April 03, 2014, 02:18:10 am »
Cascaded shadow maps!


Pages: 1 2 3 [4] 5 6 ... 18
anything