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

Pages: [1] 2
1
SFML projects / 3 'Free to play" games I made with SFML
« on: January 28, 2024, 04:28:27 pm »
Not sure if it is related to SFML projects, since it's just an announcement :D

I changed all my 3 games to "Free to play"

https://store.steampowered.com/search/?developer=Achpile

Related topics:

https://en.sfml-dev.org/forums/index.php?topic=20444.0
https://en.sfml-dev.org/forums/index.php?topic=22570.0
https://en.sfml-dev.org/forums/index.php?topic=22171.0

I'm not sure if I ever open my code tho, sorry.

2
Audio / [SOLVED, i am idiot] Music stops playing sometimes
« on: January 20, 2021, 02:48:35 pm »
Good day. I've encountered a weird bug, which I have no idea how to reproduce in "small example"...
It happened in windows (built with mingw 32bit).

So I start music like this:

track->stop();
track->openFromFile(...);
track->setLoop(loop);
track->play();
track->setPlayingOffset(cache->musics[current]);
 

After this I added the log:
Loop = true
Offset = 4739
Length = 96000
 

So the output is getLoop(), getPlayingOffset() and getDuration().

And sometimes it just stops playing... I added a log:

Track loop = true
Offset = 0
Length = 96000
Status = Stopped
 

Have anyone had this bug, or have any ideas what could cause it? Thanks

3
Graphics / OSX - failed to compile fragment shader
« on: December 29, 2020, 09:32:16 am »
Good day. I'm not expirienced OSX user, so have no idea about it.

I'm getting this error:
Failed to compile fragment shader:
ERROR: 0:1: 'f' : syntax error: syntax error

Failed to compile fragment shader:
ERROR: 0:1: 'f' : syntax error: syntax error

Failed to compile fragment shader:
ERROR: 0:1: 'f' : syntax error: syntax error
 

SFML version is 2.5.1

There's no such error on Linux 32/64 nor Windows 32/64

Shaders are:

#define SHADER_INVERT                                         \
        "uniform sampler2D texture;                             " \
        "                                                       " \
        "void main() {                                          " \
        "    vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);" \
        "                                                       " \
        "    pixel.r = 1.0f - pixel.r;                          " \
        "    pixel.g = 1.0f - pixel.g;                          " \
        "    pixel.b = 1.0f - pixel.b;                          " \
        "                                                       " \
        "    gl_FragColor = pixel;                              " \
        "}                                                      "



#define SHADER_WHITE                                          \
        "uniform sampler2D texture;                             " \
        "                                                       " \
        "void main() {                                          " \
        "    vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);" \
        "                                                       " \
        "    pixel.r = 1.0f;                                    " \
        "    pixel.g = 1.0f;                                    " \
        "    pixel.b = 1.0f;                                    " \
        "                                                       " \
        "    gl_FragColor = pixel;                              " \
        "}                                                      "



#define SHADER_GREY                                           \
        "uniform sampler2D texture;                             " \
        "                                                       " \
        "void main() {                                          " \
        "    vec4 pixel = texture2D(texture, gl_TexCoord[0].xy);" \
        "                                                       " \
        "    gl_FragColor.r = (pixel.r+pixel.g+pixel.b) / 3.0f; " \
        "    gl_FragColor.g = gl_FragColor.r;                   " \
        "    gl_FragColor.b = gl_FragColor.r;                   " \
        "    gl_FragColor.a = pixel.a;                          " \
        "}                                                      "

 

Loading code:
        shaders.white.loadFromMemory (SHADER_WHITE , sf::Shader::Fragment);
        shaders.grey.loadFromMemory  (SHADER_GREY  , sf::Shader::Fragment);
        shaders.invert.loadFromMemory(SHADER_INVERT, sf::Shader::Fragment);
 

Bonus question bonus not related to graphics, but related to Mac OS X:
After app start i got this:
"We got a keyboard without any keys (1)"

I use Mac mini with standart usb keyboard attached

4
SFML projects / Dispersio 3
« on: April 09, 2019, 01:00:37 pm »
Actually it's 3, but i renamed the 2 to 3, so it's 2 now  ;D
So i decided to take a short break on my previous project and i will probably release this one earlier - so I had to rename them  :D

This game will be very similar to the first one, but instead of different abilities on each level you will face different obstacles. I hope to make it as good as first one - and same hard as well  ;D

http://www.youtube.com/watch?v=fSVzTsDdxMg

5
Graphics / sf::Rect
« on: September 10, 2018, 08:24:07 pm »
Hey guys! Just got an issue with rect class.... Can someone explain this please?
Commit:

commit 082a928555125e37cc52a80c11cf286f0b03dee5
Author: LaurentGom <LaurentGom@4e206d99-4929-0410-ac5d-dfc041789085>
Date:   Fri Apr 9 13:04:49 2010 +0000

    *important* sf::Rect now uses Width/Height instead of Right/Bottom
    Removed Offset, GetSize and GetCenter functions from sf::Rect
    Added a sf::Rect constructor taking two Vector2 parameters
    Updated the API documentation of the sf::Rect class
 

 template <typename T>
 bool Rect<T>::Contains(T x, T y) const
 {
-    return (x >= Left) && (x <= Right) && (y >= Top) && (y <= Bottom);
+    return (x >= Left) && (x < Left + Width) && (y >= Top) && (y < Top + Height);
 }
 

Why changed "<=" to "<"?

6
SFML projects / Neural Network + Genetic Algorithm
« on: December 06, 2017, 03:23:09 pm »
After watching a lot of videos on YouTube I had some fun playing with neural networks + genetic algorithm. Don't know what else to say  :D

Source code: https://github.com/achpile/neural

http://www.youtube.com/watch?v=cAr90JQVxaI

http://www.youtube.com/watch?v=oeJ7Gw_vO_8

7
Graphics / Mac OS X - High Sierra - RenderTexture::clear
« on: November 13, 2017, 03:58:50 pm »
Hey guys! I have some troubles with clearing render textures (or may be RenderWindow). And made some investigations. Here's the code:

#include "include/SFML/Graphics.hpp"

int main() {
        sf::RenderWindow app(sf::VideoMode(400,400), "test");
        sf::RectangleShape a(sf::Vector2f(10,10)), b(sf::Vector2f(1,1));

        sf::RenderTexture tex;
        sf::Sprite spr;

        tex.create(400,400);
        tex.setActive();
        tex.clear(sf::Color(0,0,0,0));
        int pos = 10;
        spr.setTexture(tex.getTexture());

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

                pos += 1;
                a.setPosition(sf::Vector2f(pos, 10));

                app.clear();

                // Uncomment this to fix
                //app.draw(b);

                tex.draw(a);
                tex.display();
                app.draw(spr);

                tex.clear();
                app.display();
        }
}

 

If there's no draw calls on RenderWindow except the one with drawing RenderTexture it leads to some artifacts.
I attached the image from my game and from the example. As you can see - there's kinda trail, but it is not the same as without "clear" call.

And there were no such issues before High Sierra update.

8
SFML website / SFMLProjects
« on: November 04, 2017, 12:21:02 pm »
I can't remember if i saw a topic here or just was talking about it with Exploiter long ago, but maybe it's a good idea to provide a link to sfmlprojects.org at Community page.  :)

9
Graphics / sf::RenderTexture without 'display' call.
« on: October 30, 2017, 02:21:56 pm »
Don't know if it's a bug, but if I don't call 'display' function - render texture draws upside down.

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

int main() {
        sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
        sf::Event event;
        sf::Font font;
        sf::Text text;
        sf::RectangleShape shape;
        sf::Sprite spr;
        sf::RenderTexture tex;

        font.loadFromFile("font.ttf");

        text.setFont(font);
        text.setString("HELLO");
        text.setCharacterSize(200);
        text.setFillColor(sf::Color::Black);

        shape.setSize(sf::Vector2f(100,100));
        shape.setPosition(100, 300);
        shape.setFillColor(sf::Color::Black);

        tex.create(800,600);
        tex.setActive(true);

        tex.clear(sf::Color::White);
        tex.draw(text);
        tex.draw(shape);
        //tex.display();

        spr.setTexture(tex.getTexture());

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

                window.clear(sf::Color::White);
                window.draw(spr);
                window.display();
        }

        return 0;
}
 

1.png - with 'display' call
2.png - without

10
Graphics / sf::Text and Outline
« on: October 24, 2017, 10:30:38 am »
Hello  :) Is there a way to make outline only outer space with text? As you can see it works fine with shapes, but text outlined inside and outside.

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

int main() {
        sf::RenderWindow window(sf::VideoMode(800, 600), "My window");
        sf::Event event;
        sf::Font font;
        sf::Text text;
        sf::RectangleShape shape;

        font.loadFromFile("font.ttf");

        text.setFont(font);
        text.setString("HELLO");
        text.setCharacterSize(200);
        text.setFillColor(sf::Color(255,0,0,128));
        text.setOutlineColor(sf::Color(0,0,0,128));
        text.setOutlineThickness(5);

        shape.setSize(sf::Vector2f(100,100));
        shape.setPosition(100, 300);
        shape.setFillColor(sf::Color(255,0,0,128));
        shape.setOutlineColor(sf::Color(0,0,0,128));
        shape.setOutlineThickness(5);

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

                window.clear(sf::Color::White);
                window.draw(text);
                window.draw(shape);
                window.display();
        }

        return 0;
}
 


11
SFML projects / AchBall is now available on Steam
« on: September 27, 2017, 06:38:19 pm »
I decided to remaster a game I made 7-8 years ago :D Gameplay is very simple - you must hit the target by the ball. Each wall hit gives you 10 points. Yeah, that's all ;D

To make gameplay more interesting there are different achievements, leaderboards and some different things on stages, like moving platforms, fragile blocks etc.

Steam store page: http://store.steampowered.com/app/739180

http://www.youtube.com/watch?v=CUZGqqZisF8

12
SFML projects / Dispersio 2
« on: June 28, 2017, 02:38:20 pm »
Engine is almost finished, so here's a tech-demo :) Now it's time to start making content: locations, enemies, bosses etc. Probably I will post here screenshots later :)

http://www.youtube.com/watch?v=PRJwGcadf_U

13
SFML projects / Dispersio is now available on Steam!
« on: June 16, 2016, 11:17:29 pm »
Dispersio is now available on steam!

http://store.steampowered.com/app/563180

Story
After a disastrous geological experiment, the Earth was ruptured into dozens of asteroids, some of which hold remnants of what humanity had left behind. Many space travelers explore these asteroids in search of treasures and ancient relics. It took approximately twenty years to gather information about the location of the mysterious ancient crystal, which will give arcane power to whoever first obtains it - and so our brave hero seizes the chance to go on a perilous adventure and be the one to unearth the crystal. Who knows where it will lead?

Gameplay
Dispersio is a retro-styled action platformer. As you progress through the game, you will have to use and combine special abilities, such as dashing, wall-jumping and more.

There's even a hard mode for hardcore players. Can you beat each level without dying?

Features
  • Precisely tuned platforming mechanics
  • Interesting, detailed and challenging maps
  • 7 different abilities
  • Lots of secrets
  • A great unique soundtracks
  • Achievements
  • Gamepad support

http://www.youtube.com/watch?v=Jx254GyFb5I

Greenlight message:
(click to show/hide)

Old message:
(click to show/hide)

14
Feature requests / More Events
« on: April 18, 2016, 01:39:26 pm »
What about to add some more events? For example: DROPFILES and HOTKEY.

15
SFML projects / Timer for speedruns "Stopwatch"
« on: April 18, 2016, 12:02:09 am »
Made it just for one day  :D Coding speedrun  ;D

Well, after browsing web for a good speedrun timer didn't find anything nice for linux and decided to write my own.

More detailed description can be found here: https://github.com/achpile/asplit/releases/tag/v1.0-rc1


Pages: [1] 2