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

Pages: [1]
1
SFML projects / The Binding of Isaac Remake
« on: May 17, 2017, 09:10:52 pm »
So I found this lovely game called The Binding of Isaac by Edmund McMillen and Florian Himsl. I thought I'd have a go a making something similar since the basic game play is so simple and thought it would be a good way for me to learn how an entity component system design works within a game.

Before I say anything about this project let me just say that it's an absolute piece of trash, I'm not even going to provide a download link because no one should play this. I really like programming but not so much the art side of things so you know, it's not the best looking game. I learned a lot during the makings of it and I had never used an entity component system design before so the code also isn't the best. I'll link the repository below but I wouldn't advise using the code too much to learn off of. I could go on but who wants to read about that. This game may be awful but it's the first complex game I've finished and I hope it inspires anyone struggling with game development to make their own awesome piece of trash too.

Here's the main room. You control the green guy, he has 8 directional movement and 4 directional shooting. The map of the floor in the lower left is randomly generated for each floor just like in the actual game. Once you kill every enemy on the floor that dark grey box in the middle will open and you can move onto the next one.



Every time you kill an enemy you get a coin which can be used to buy the items you can see in the room. I wanted to fill this room up with different items and have them randomly chosen upon generating the floor but I lost interest in further development so I only implemented four lol.


Bombs now explode into projectiles?


I wanted to make the items work together like the actual game so if you pick up the range upgrade item, not only will your bullets travel farther but so will the bullets that come out of the bomb.

The rooms are randomly pulled from a premade set and they are full of various enemies that all behave differently.


Here's a gameplay video. I'm not sure why the video gets choppy when the player transitions from room to room. It runs at a smooth 60fps, it must be some settings in the screen recording software.


Lastly, I just wanted to personally thank Laurent Gomila and the SFML development team for making such a great game library.

https://github.com/KyleNBurke/TheBindingOfIsaac

2
General / Strange Movement with Fixed Timestep
« on: August 11, 2016, 08:02:20 am »
So the movement in my game isn't smooth. It looks like every tenth of a second the game freezes for a very short period of time then continues along until it freezes again.

You can see here as the rectangle moves, it stops for a short while then continues along.



Here is my code for updating and rendering the game:

float dt = 1.0 / 60.0f;
float accumulator = 0.0f;

while (window.isOpen())
{
        float frameTime = clock.restart().asSeconds();
        accumulator += frameTime;

        while(accumulator >= dt)
        {
                pollEvents();
                updateStates(dt);
                clearInput();

                accumulator -= dt;
        }

        window.clear();
        drawStates(window);
        window.display();
}
 

Is my code flawed in someway and is this behavior a result of it? Or should this create smooth movement and thus the problem is with something else?

3
Graphics / Sprite::getGlobalBounds() returning incorrect values
« on: August 09, 2016, 07:46:00 am »
sf::Sprite s(playerSpriteSheet, sf::IntRect(1, 1, 7, 6));
s.setScale(9.0f, 9.0f);
s.setOrigin(s.getLocalBounds().width / 2, s.getLocalBounds().height / 2);
s.setPosition(400.0f, 50.0f);
s.setRotation(180.0f);

I'm initializing a sprite with the above code. If I was to then find the value for the top of the global bounds I should get 23 and here's how: Since the scale of the sprite is 9 the height would be 6 x 9 or 54. The origin of the sprite is in the very center so the center of the sprite globally is 400, 50. To get the top of the global bounds you'd subtract half of the height from 50: 50 - 54 / 2 = 23. So when I call s.getGlobalBounds().top I should get 23 but I actually get 22.9999962 and when I call s.getGlobalBounds().height I should get 54 but instead I get 54.0000038.

I'm aware that since the sprite is rotated 180 degrees some floating point arithmetic is involved and thus gives me incorrect numbers because of the inherit problems with floating point arithmetic. But what if I was to tell you that the incorrect value are only present when the position of the sprite on the y axis is less than 92? When I set the y position of the sprite to 92 the correct values are returned, but when I set the y position of the sprite to 91, I then get values that are slightly off like mentioned above.

It's so strange to me that the values are only incorrect when the sprite's y position is less than 92. Why is this the case and is there anything I can do to ensure I'll always get the correct values regardless of the sprites position?

4
General / Application Builds but VS's Error List Shows Errors
« on: December 22, 2014, 02:33:58 am »
I've created a project with the minimal amount of code required to reproduce this issue on my machine. It was created with the default Microsoft Visual Studio C++ application wizard settings so it has an precompiled header file. The I've created one class:

GameManager.h
#pragma once

#include "stdafx.h"

class GameManager
{
public:
        GameManager();

private:
        sf::RenderWindow window;
};
 

GameManager.cpp
#include "stdafx.h"
#include "GameManager.h"

GameManager::GameManager() : window(sf::VideoMode(800, 600), "Testing") {}
 

I can assure you, I've got the proper SFML files downloaded and linked to my project correctly.

When I build my application the output shows that the project succeeded in building however the error list shows a total of 6 errors that all say "no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list". Visual Studio says 4 of them are from the Window.hpp SFML file and the other two are from the RenderWindow.hpp SFML file.

This baffles me because there is nothing wrong with the construction of the render window variable and I have no idea why Visual Studio would give me 6 errors but still build the application.

Anyone know what is going on and how I can get these errors fixed?

Pages: [1]
anything