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 - Martin Sand

Pages: [1] 2
That looks awesome! Nice graphics, nice sound effects, seems like a decent game to play.

SFML projects / Re: Stridsvogn : A top down tank game
« on: February 15, 2022, 08:32:12 am »
I was inspired by Firepower, an Amiga game.


SFML projects / Re: Stridsvogn : A top down tank game (unique, I know :P)
« on: February 01, 2022, 11:50:21 am »
I really like it. I was working on a similar game.

SFML projects / Re: At Odds - Space RTS
« on: November 07, 2021, 07:13:19 pm »
Looks very good, I hope there are more updates soon!

SFML projects / Re: Tank Island
« on: May 26, 2021, 10:58:50 am »
Haha, nice! The sound and graphics remind me of C64's Raid on Bungeling Bay.


Graphics / Re: Rendering via a RenderingTexture
« on: May 10, 2019, 04:56:47 pm »
Interesting effect! I really like it.

Yes, I wanted it to look like fire, it is not completely red, small parts in the other channels produce the yellow when they are put together :)

To which other channels do you refer to, G and B? Do you read the R channel and put them on top?

General / Re: Program for making 2D Textures
« on: May 10, 2018, 09:16:03 pm »
Ok, so it seems you want to create sprites instead of textures.

You could use inkscape to create them, here is a good tutorial:

If you want to start directly with pixel art, https://www.aseprite.org/ is a good tool.

You can use the tools above also for animations. You simply create all the frames in the tools and create a sprite sheet (is it called like this?).

General / Re: Program for making 2D Textures
« on: May 10, 2018, 10:09:49 am »
What program i can use to build my own textures and animations that i can use in my SFML code?

Depending on the type of texture you could use a specific program or technique. What do you want to create?

SFML projects / Re: SpaceGO
« on: April 12, 2018, 10:38:32 pm »
Looks very good. That reminds me of Uridium ... https://www.youtube.com/watch?v=N0TfHkNpRNs 
Played this ages ago ;D

Graphics / Re: Is it possible to manipulate each pixel of a texture?
« on: April 05, 2018, 10:20:22 pm »
I agree with eXpl0it3r. If you want to understand the technique to manipulate pixels in an image, here is a code example.
Please note that you need a background.png image

#include <iostream>
#include <SFML/Graphics.hpp>

sf::Color setPixelColor(sf::Texture& texture, int x, int y, sf::Color color){
  // Get texture image
  sf::Image image = texture.copyToImage();

  // Optional show case: read size of image (not used in this function)
  int width = image.getSize().x;
  int height = image.getSize().y;

  // Get color of specific position
  sf::Color imagecolor = image.getPixel(x, y);

  // Just an example: if alpha is above 128, make it green
  if (imagecolor.a > 128){
    imagecolor.g = 255;

  // Set pixel to color
  image.setPixel(x, y, color);

  // Update texture

int main(){
  sf::RenderWindow screen(sf::VideoMode(900, 600), "window");

  sf::Sprite background;
  sf::Texture texture;

  if (!texture.loadFromFile("background.png")){
     std::cout << "Error loading texture" << std::endl;

  while (screen.isOpen()){
    sf::Event event;
    while (screen.pollEvent(event)){
      if (sf::Event::Closed == event.type){

    setPixelColor(texture, 10, 10, sf::Color::Green);


Graphics / Re: Best approach for rendering footprints
« on: February 21, 2018, 11:58:15 pm »
Perfect, did the job  :)

I measured the difference. By design my m_Tracks vector was faster than the VertexArray when it was below ~ 3k sprites. The VertexArray always stayed at the constant render time (at least what I measured through sf::Clock in microseconds). The vector was getting slower and slower beyond 3k sprites (sprite is 21x3 px).

Graphics / [SOLVED] Best approach for rendering footprints
« on: February 18, 2018, 09:28:58 am »
I am currently working on an implementation for footprints etc.

To get this working I have created a struct which I keep in a vector and let it render every frame.
Since the texture does not change but is kept in the GPU memory, I assume it is quite fast although the game will produce thousands of footprints during a level. Every footprint is 1 sprite.

int vectorsize = m_Tracks.size();
for(int iterator = 0; iterator < vectorsize; ++iterator;){

What is the best optimization (rendering time) for this?
  • Create an image and add the footprint every frame (direct manipulation of the pixel via getPixel, setPixel) and apply the image to the render texture of 1 sprite?
  • Use a texturerender instead of direct pixel manipulation?
  • Keep the current implementation and optimize to only render sprites in current view rect?

I coudl not find any good result in the forum search.

Best regards

General / Re: Passing Class by Reference
« on: September 19, 2017, 10:36:06 pm »
Ok, can you give a bit more context? What to you do in the rock class?

And yes, if you need to have the new and current values and they are either held by the player class or are based on values in the player class, you probably need to pass it by reference.

Graphics / Re: Scrolling view causes tiles to blur/flicker
« on: August 27, 2017, 07:31:43 pm »
I am sorry. I watched the video several times but could not see the issue.
What is your current game loop? Do you have a fixed time step with delta time per frame?

General / Re: actions happened too fast ??
« on: July 31, 2017, 10:19:27 am »
You should consider to change to a time-based game loop: https://gafferongames.com/post/fix_your_timestep/

Pages: [1] 2