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

Pages: [1]
1
SFML projects / Sprite Animation Editor based on Thor
« on: September 30, 2018, 11:15:59 am »
Hey there,

I decided it was time to make another editor, this one for sprite animations. It is built directly upon the animation module from the Thor library extension and has features as:
  • Sprite sheet selection
  • Grid generation for sprite sheets based on tile size
  • Export animation data directly to animation files
The editor is very simple and thus easy to use, you can literally make an animation in a matter of seconds. Here are a few screenshots from the editor:





Integration steps can be found on the front and wiki page of the Github repository:

Github: https://github.com/Jakobzzz/SpriteAnimator

*** Notes ***

I ran into some limitations when using the Thor animation module as there were no support for:
  • Remove animations
  • Change the duration of an existing animation
  • Query the size of the animation map
Those were all trivial things to implement and were added to AnimationMap.hpp and AnimationMap.inl in the animation module for Thor.

2
SFML projects / Re: Particle Editor based on the Thor library extension
« on: September 19, 2018, 11:48:43 pm »
Yes, pretty much everything was easy to work with and it's all fairly simple but of course it becomes a bit more tedious when you have to create an editor for it as you for instance have to check the numeric limits of properties. I haven't tried the animation part yet but one thing that could be a limitation is the possibility to simulate explosion effects more easily. The firework example on Git is good but when you try to achieve the same effect with an editor it quickly becomes a lot harder ;D

3
SFML projects / Particle Editor based on the Thor library extension
« on: September 04, 2018, 07:51:53 pm »
Hello,

I recently created a particle editor based on the Thor library extension to speed up the development of my own projects with SFML and Thor. The editor covers most of the features from the Thor particle module and has additional support for:
  • Save particle data to a json file
  • Open an exisiting json file with particle data
  • Change particle texture with file browsing
The editor can be seen in the following screenshot:



Integrating the saved particle data into a project is very easy and example code can be found at the github repository.

Github: https://github.com/Jakobzzz/ParticleEditor

4
Graphics / Re: Scrolling view causes tiles to blur/flicker
« on: August 29, 2017, 10:50:21 am »
Oh, I thought there wasn't any functionality for this within SFML and I had to write my own by setting up a framebuffer etc, but as there is, it seems rather easy!

Edit: Tried with render to texture and the results were the same, as the problem was actually  connected to a line where I updated the position of the player next to the draw call. Decoupling them solved it of course... Although the render to texture solution won't be necessary, it seems to reduce the process memory of the application as it is pre-rendered which means I'll stick to it anyways :).

Quote
If Kairos is doing anything strange (not described above), it needs fixing!

Well, I might have done something wrong so it's likely more of my fault than yours! Don't worry about it ;)
Thanks for all the help Hapax :)

5
Graphics / Re: Scrolling view causes tiles to blur/flicker
« on: August 28, 2017, 11:10:52 am »
Quote
Rounding the positions of everything displayed in addition to the view being rounded would reduce some of these artifacts to a greater degree.

It seems like your right as rounding the position of the player sprite improves the quality slightly. Even though not as smooth as one would want. This also seems like a very tedious process to carry on with as you have to round all positions of all the entities in the game. I thought there would be an easy solution!  :'(

Quote
I'm not sure of which implementation you speak. Maybe it's the Tilemap as it can pre-render the map first (although it does have other bonuses too!).

Yup, pleasant to meet the author too! I only checked it out for a brief moment and I might come to use your tilemap setup if everything doesn't work out. Even though I would like to write my own implementation like the one you did with the render to texture, but as my OpenGL is a bit rusty (I have worked a bit too much with DirectX11 for the last few months), it will probably take a while.

Quote
Anyway, fixed timestep is all well and good but is it rigidly fixed, uncoupled from rendering rate, and interpolated with previous state for smooth motion?

Embarassing to say it's simply a sf::clock which is created in main and then passed as clock.restart() to the update function of my Game class. The usage will then be to multiply with the passed deltatime (dt.asSeconds()). I also tried Kairos' timestep but it only made the problem worse, perhaps could have sometime to do with the fact that I'm using box2d for physics when moving the player.

6
Graphics / Re: Scrolling view causes tiles to blur/flicker
« on: August 27, 2017, 08:32:05 pm »
Alright, that seems to have fixed the problem partly, by using the following code before setting the view:

m_view.setCenter(sf::Vector2f(std::round(m_viewPosition.x), std::round(m_viewPosition.y)));

Although it seems like the player sprite is not so smooth anymore, might be related to the fact that the viewpostion is based on the player's position?

if (player.getPosition().x > (float)WIDTH / 2.f)
        m_viewPosition.x = player.getPosition().x;

if (player.getPosition().y < (float)HEIGHT / 2.f)
        m_viewPosition.y = player.getPosition().y;


7
Graphics / Re: Scrolling view causes tiles to blur/flicker
« on: August 27, 2017, 08:02:58 pm »
I had a little hard time myself to see the issue but it is there if you don't watch in fullscreen and are aware of the issue. And yes I have fixed time step as well having v-sync enabled.

8
Graphics / Scrolling view causes tiles to blur/flicker [SOLVED]
« on: August 27, 2017, 06:46:23 pm »
Hello,

I'm currently loading tilemaps from Tiled using https://github.com/fallahn/sfml-tmxloader and it works as expected. However when the view moves with the player the tiles in the loaded tilemap appears to blur/flicker which from my understanding is caused by rounding issues related to the view and the nearest tiles?

The issue can be seen in the following video: https://www.youtube.com/watch?v=PQ4SpWTb_xQ&feature=youtu.be

I read that there is an implementation fix for this with SelbaWard, but I just don't want to just change my system just yet if there might be a solution for the current setup. Has anyone encountered this problem and know of any possible solutions?  :)

9
Graphics / Re: Animate sprite back to idle state
« on: August 20, 2017, 02:40:45 pm »
I believe I solved it by doing what I did above but instead of adding the idle state, I added the last frame on the animation cycle when the key is released. Because if I don't and have the idle state, the animation will start from the idle state and therefore play the idle frame one more time  :-\.

10
Graphics / Animate sprite back to idle state
« on: August 19, 2017, 06:59:58 pm »
Hey!

I have recently picked up SFML and decided to try out the extension, "Thor", which comes with some handy
functionality. Although I'm experiencing some problems when I'm trying to animate my sprite i.e return it to idle state when I have released the key which should trigger the movement. The code up to this point looks like this:

void Player::UpdateInput(sf::Time dt)
{
        float velocity = m_movementSpeed * dt.asSeconds();

        if (Input::GetActionMap().isActive("walkRight"))
        {
                if (!m_animator.isPlayingAnimation())
                        m_animator.playAnimation("walkRight");

                if (m_animator.getPlayingAnimation() != "walkLeft")
                        m_playerSprite.move(velocity, 0.0f);
                else
                        m_animator.stopAnimation();
        }

        if (Input::GetActionMap().isActive("walkLeft"))
        {
                if (!m_animator.isPlayingAnimation())
                        m_animator.playAnimation("walkLeft");

                if (m_animator.getPlayingAnimation() != "walkRight")
                        m_playerSprite.move(-velocity, 0.0f);
                else
                        m_animator.stopAnimation();
        }
}

Now the behaviour is perfectly fine except from that the sprite doesn't stop animating directly when I release the chosen movement key, something which could be solved by setting up a release event like this:

if (Input::GetActionMap().isActive("stopRight"))
{
        if (m_animator.isPlayingAnimation() && m_animator.getPlayingAnimation() == "walkRight")
        {
                m_animator.stopAnimation();
                m_animator.playAnimation("idleRight");
        }
}

What will happen now is that when I move right for example, the sprite will stop animating and then return to idle. However the movement of the sprite will not be in sync with the animation since the idleRight animation is still set to one second. Reducing it to around 0.1 seconds solves the problems but allows the player to simply glide along when you tap the movement key  :'(. I have a feeling there is a more elegant solution to this, perhaps I should look into blend trees for animating?


Pages: [1]