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

Pages: [1]
1
SFML projects / Re: Bullet Hell Game
« on: April 30, 2020, 05:29:49 pm »
Update:
A new feature has been added to the game: Actions
Actions are a series of commands that are bound to certain keys. They can be used to automatically execute commands for cheats, or to help automate tasks for mod development. Of course, to be used to require cheats to be enabled. Actions are define in config.lua

In config.lua, to use actions you must define a table named "actions". Inside the actions table, to define an action, define a table with the action name. The table must have two members, one for the keys that the action is bound to, and the other for the commands to be executed when the action is run. For example, an actions table might look like this:

actions = {
        advance = {
                keys = {Keys.RShift, Keys.A},
                commands = {"set time 0.01", "set position 200 0"}
        }
        accelerate = {
                keys = {Keys.RShift, Keys.E},
                commands = {"set invincible true", "set tps 500"}
        }
        decelerate = {
                keys = {Keys.RShift, Keys.R},
                commands = {"set invincible false", "set tps 60"}
        }
        invincableon = {
                keys = {Keys.RShift, Keys.I},
                commands = {"set invincible true"}
        }
        invincableoff = {
                keys = {Keys.RShift, Keys.O},
                commands = {"set invincible false"}
        }
}
 

The keys table is an array, where each key in the array must be pressed to execute the action. The commands table is an array of command strings to run, which will be run in order when the action is run. The name of the action for now has no purpose, and you can name your actions whatever you want. However, I do have plans for it in the future.

2
SFML projects / Re: Bullet Hell Game
« on: April 20, 2020, 08:57:12 pm »
I realized that after viewing the page when not logged in, I should probably fix it. Unfortunately, the game doesn't have any music or sound right now, because I felt that it was beyond the scope of the original project, and I wasn't sure how to go about making / obtaining music for a game like this. Maybe one day I'll get around to adding some though  :).

3
SFML projects / Re: Bullet Hell Game
« on: April 20, 2020, 06:42:10 pm »
Yes, the player is the black square

4
SFML projects / Bullet Hell Game
« on: April 09, 2020, 09:25:52 pm »
Recently I've been working on a bullet hell style game with SFML. The game features "waves" where the player dodges the oncoming projectiles from the top of the screen.

Github repo (game can be downloaded here):
https://github.com/NipIsTrue/SFML-Bullet-Hell-Game


Features:
  • Mod System allowing for custom content in lua (documentation still in progress)
  • Procedurally generated waves for unique gameplay (still being improved upon)
  • Admin Console where commands can be entered
  • 12 enemy types with more being made
  • Customizable keybinds

This is my first time making a full game on anywhere near this scale, and I would appreciate any feedback. The game is still in progress, and I am working on documentation for the mod system.

Screenshots are attached to the post.

5
Graphics / Re: OpenGL error INVALID_OPERATION occurring for no reason?
« on: February 12, 2020, 04:53:41 am »
I am working on a simple 2d game in sfml, and I recently ran into a problem when trying to write a mod system for the game. Basically, the mod system works by loading a dll into memory, and calling functions from it that return a subclass of one defined in my game. The loading works fine and the object is instantiated correctly, but it appears to have broken part of my rendering code that worked before, namely this part:


void Environment::render(sf::RenderWindow& window) {
        for (Spawner* spawner : m_spawners) {
                spawner->render(window);
        }

        for (Enemy* enemy : m_enemies) {
                enemy->render(window);
        }

        m_player.render(window);

        sf::RectangleShape shape(sf::Vector2f(20, 400));
        shape.setFillColor(sf::Color::Black);
        window.draw(shape);

        shape.setPosition(420, 0);
        window.draw(shape);

        shape.setSize(sf::Vector2f(400, 20));
        shape.setPosition(0, 0);
        window.draw(shape);

        shape.setPosition(20, 420);
        window.draw(shape);
}

While the spawners are rendering, the console prints a bunch of opengl errors. After further investigation with the debugger (visual studio). It appears that my spawner->render() function is never being called, which is odd. I'm not entirely sure what is happening here as this code works fine with spawners that are instantiated in the executable and not loaded from the dll. I'm new to loading a dll at runtime, is there some sort of problem I'm missing here?

It is quite hard to see what's happening, but before I would ask for info about what does what, the fact that spawner->render is not called when it should be is enough to start debugging the problem urself. Put a break pointer on the for loop and look into the memory at m_spawners

I did do this when testing with the debugger, the memory at these locations was normal, a vector of valid spawner objects that were not null pointers.

In the end, I was not able to figure this out, and decided to take a different approach to modding and embed the lua interpreter in my game instead, and that has been working great. So I guess consider this solved.

6
Graphics / OpenGL error INVALID_OPERATION occurring for no reason?
« on: February 07, 2020, 01:49:58 pm »
I am working on a simple 2d game in sfml, and I recently ran into a problem when trying to write a mod system for the game. Basically, the mod system works by loading a dll into memory, and calling functions from it that return a subclass of one defined in my game. The loading works fine and the object is instantiated correctly, but it appears to have broken part of my rendering code that worked before, namely this part:


void Environment::render(sf::RenderWindow& window) {
        for (Spawner* spawner : m_spawners) {
                spawner->render(window);
        }

        for (Enemy* enemy : m_enemies) {
                enemy->render(window);
        }

        m_player.render(window);

        sf::RectangleShape shape(sf::Vector2f(20, 400));
        shape.setFillColor(sf::Color::Black);
        window.draw(shape);

        shape.setPosition(420, 0);
        window.draw(shape);

        shape.setSize(sf::Vector2f(400, 20));
        shape.setPosition(0, 0);
        window.draw(shape);

        shape.setPosition(20, 420);
        window.draw(shape);
}

While the spawners are rendering, the console prints a bunch of opengl errors. After further investigation with the debugger (visual studio). It appears that my spawner->render() function is never being called, which is odd. I'm not entirely sure what is happening here as this code works fine with spawners that are instantiated in the executable and not loaded from the dll. I'm new to loading a dll at runtime, is there some sort of problem I'm missing here?

7
Graphics / Re: Assertion failed after trying to draw text to a window
« on: October 05, 2019, 05:04:54 pm »
When I clicked retry, it triggered a breakpoint that I did not place after
window.draw(shape)
and when I continued it just exited with no message. I have no idea how to interpret that. However, after messing with breakpoints, the message shows up after
window.draw(text)
and the program it originated from was my executable, not any of the sfml or c++ runtime dlls. I'm also not quite sure how to interpret this. As for compiling sfml, I can give that a try, I was using precompiled binaries.

8
Graphics / Re: Assertion failed after trying to draw text to a window
« on: October 04, 2019, 01:38:14 am »
Also forgot to add:
When I made the text object a member of the Editor class, and called
text.setFont(font);
text.setString("Test");
text.setFillColor(sf::Color::White);
text.setPosition(100, 100);
 
once in the constructor, then called
window.draw(text);
in Editor::render() then I get this:
Debug Error!

R6025
- pure virtual function call


(Press Retry to debug the application)

Once again it is happening after window.draw(text) is called

9
Graphics / Re: Assertion failed after trying to draw text to a window
« on: October 04, 2019, 01:31:20 am »
I don't think so? If you are asking about linking the right libraries I am sure I am doing that right. How can I check about the symbols though?

10
Graphics / Re: Assertion failed after trying to draw text to a window
« on: October 01, 2019, 02:06:01 am »
Yes, I tried and was unable to re-create the problem. I was able to successfully render the text. However, I have no idea what could be wrong with my dlls. I used the same settings for both projects.

11
Graphics / Re: Assertion failed after trying to draw text to a window
« on: September 30, 2019, 01:24:54 pm »
I did not manually include xtree, so my best guess is that sfml is including it somewhere? I am not using any std::maps so I also presume sfml is using it somewhere? Here is the call stack:
    sfml-graphics-d-2.dll!00007ff865d312ad()   Unknown
    sfml-graphics-d-2.dll!00007ff865d36f3f()   Unknown
    sfml-graphics-d-2.dll!00007ff865d2c74a()   Unknown
    sfml-graphics-d-2.dll!00007ff865d1bf48()   Unknown
    sfml-graphics-d-2.dll!00007ff865da539d()   Unknown
    sfml-graphics-d-2.dll!00007ff865da51f5()   Unknown
    sfml-graphics-d-2.dll!00007ff865d6bd49()   Unknown
As for recreating the text object every frame, this is my first time attempting to draw text, so thanks for the tip. I'll try storing the text object as a member of the class.

12
Graphics / Assertion failed after trying to draw text to a window
« on: September 18, 2019, 10:46:59 pm »
So I am trying to draw some simple text to a window, and when debugged, I get an assertion error that looks like this:
Debug Assertion Failed!

Program: C:\WINDOWS\SYSTEM32\MSVCP120D.dll
File: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\xtree
Line: 327

Expression: map/set iterators incompatible

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts.

after
window.draw(text);

Here is the code that causes the assertion:

void Editor::render(sf::RenderWindow& window) {
        sf::RectangleShape shape(sf::Vector2f(500, 500));
        shape.setPosition(50, 50);
        shape.setFillColor(sf::Color(30, 30, 30));
        window.draw(shape);

        sf::Text text;
        text.setFont(font);
        text.setString("Test");
        text.setFillColor(sf::Color::White);
        text.setPosition(100, 100);
        window.draw(text);
}
 

font is a member of the Editor class, and loadFromFile() is called in the constructor, and appears to work fine.

When built and ran in release mode, I get an access violation exception, if that means anything.

13
Window / Re: RenderWindow::pollEvent() appears to not be working
« on: August 21, 2019, 10:29:20 pm »
Thank you, that fixed it!

14
Window / Re: RenderWindow::pollEvent() appears to not be working
« on: August 21, 2019, 08:00:44 pm »
Yes I  am, this is what the code for launching that thread looks like:

app.getWindow().setActive(false);
auto t = std::async(std::launch::async, &yee::Application::run, &app);
t.get();
 

15
Window / RenderWindow::pollEvent() appears to not be working
« on: August 19, 2019, 05:54:57 pm »
The window.pollEvent() function in my game loop appears to not be handling any events, and the created window won't respond to anything. Here is the code for my game loop:
void Application::run()
        {
                sf::Context context;
                window.setFramerateLimit(60);

                while (window.isOpen())
                {
                        sf::Event e;
                        std::cout  << "loop" << std::endl;
                        while (window.pollEvent(e))
                        {
                                std::cout << "event" << std::endl;
                                handleEvent(e);
                        }

                        update();

                        render();
                }
        }
 

The print statement never prints "event", but "loop" prints repeatedly, so I know the loop is running. The result is that the window won't respond if I try to resize it or close it, and eventually windows marks it as "not responding". I am using the snapshot from    13-May-2019 19:49 from the download page.

Pages: [1]