Welcome, Guest. Please login or register. Did you miss your activation email?

Recent Posts

Pages: [1] 2 3 ... 10
1
SFML projects / Re: 9001
« Last post by Sub on Today at 01:37:34 am »
Here's a video of me rambling for 8 minutes explaining what the game is, how it's played (explained within the first 2 minutes), and where I want to go with the game.

https://www.youtube.com/watch?v=Pc6fKe36Rc0&feature=youtu.be

With that being said, I'm trying to get around 10 people to play and offer feedback on whether or not it runs / whether they could kill an enemy / any thoughts about it in general.  Please post here, DM me, or join the discord to request a Steam key.   

-----
Controls

arrow keys or wasd to move
ctrl or e to teleport
backspace generates a new map
[ ] \ all change player colors
[ changes your color
] changes everyone's color
\ changes the color of the entity you're targeting (the white box)
h turns on an alternate drawing mode which is slightly buggy and not as good
------
wtf?

You're a 2d ragdoll stick figure.  It can fly and teleport.  This costs energy.  Energy is represented by the circle around the player.  The larger the circle, the more energy you have.  If you run out of energy, your circle will disappear and you'll be unable to do anything but freefall for a few seconds. 

White = full energy
red = losing energy
green = gaining energy

Find enemies.  Currently the only way to deal damage is the melee system.  When two players collide, they perform a melee hit.  The loser is damaged and knocked back.  The winner is determined by whoever was moving with more momentum in their opponents direction.  The idea is that you want to outmanuever your opponent and hit then from the side, behind, or at an angle such that your momentum is considered and your opponents momentum is discarded. 

You can regain health if you're far enough away from enemies.  The health bar will start flashing white.  How this works is going to change because it doesn't work well at all right now.
2
Graphics / Re: Interface trouble
« Last post by Hapax on October 21, 2019, 10:56:33 pm »
The top-left co-ordinate of the client section of a window is the view centre minus half of the view size.
e.g.
sf::Vector2f topLeftCoord{ view.getCenter() - view.getSize() / 2.f };

However, there is another approach which makes life a lot easier: use two views instead of one.

Use your main game "scene" view to centre on the player and move around the world (for example).
Then, use a top layer "UI" view to draw the user interface.
This "UI view" would be set to the size required (usually the same size as the client window) and would also never move.
The "scene view" would be moved around as you do already.

Then, you just switch views before drawing (and also before doing anything that takes the view into account such as converting co-ordinates like the mouse position).
e.g.
window.clear();
window.setView(sceneView);
window.draw(map);
window.draw(hero.sprite);
window.setView(uiView);
window.draw(r); // your test rectangle
window.draw(ui); // the rest of the ui you want to draw can be drawn here
window.display();

You can set up the ui view before the main loop and never need to change it (in almost all cases).
3
Graphics / Interface trouble
« Last post by Introhart on October 21, 2019, 07:55:58 pm »
Ok, so... I have a small trouble with drawing of UI.
I have a map, a character etc... everything is working good. But I can't to draw anyting relative to the coordinates of the window. I need it to draw an interface.
( shortly... how to draw a rectangle it always would be located in the top left corner of the window?)



my main file

#include <SFML/Graphics.hpp>
#include "GraphicsLib.cpp"
#include "character.cpp"
#include <iostream>



int main()
{
        sf::RenderWindow window(sf::VideoMode(720, 480), "Tilemap");

        Hero hero;
        sf::View view;

        view.reset(sf::FloatRect(0, 0, 720, 480));
        TileMap map;

        map.load("testMap.txt");
        hero.setWayMap(map.wayMap, map.height, map.width);


        sf::RectangleShape r(sf::Vector2f(120.f, 50.f));
        r.setPosition(sf::Vector2f(10, 0));

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


                window.draw(hero.sprite);
                window.draw(map);
                window.setView(view);
                window.draw(hero.sprite);
                view.setCenter(hero.sprite.getPosition().x + hero.img.getSize().x / 2, hero.sprite.getPosition().y + hero.img.getSize().y / 2);
                hero.move();


                window.draw(r);
                window.display();
        }

        return 0;
}
 
4
Graphics / Re: Array of shapes
« Last post by Rosme on October 21, 2019, 03:16:25 pm »
Honestly, with that kind of FPS, I wouldn't bother. A moment where your computer find something more important could make them drop by a few hundred at that point. They are most probably not accurate and important so high. Don't bother with optimizing something like this.

The auto method is basically the same as the iterator, pointing to a reference instead of the iterator (in fact, it's an iterator under the hood).

Finally, with optimization, the assemble generated is basically the same, so yeah, auto is not slower by any means. Use a real good profiler to compare and not FPS. FPS is not accurate.
5
Window / Re: Resolution Bug after creating window with valid mode
« Last post by Hapax on October 20, 2019, 11:14:53 pm »
You mean the going black while changing monitor's fullscreen resolution? That sounds pretty common to me.
If the problem is the console, it would of course depend on which OS you are using but you should be able to create a window without one.
6
General discussions / Re: Slow performance with Raspberry PI 3B
« Last post by bluszcz on October 20, 2019, 11:31:19 am »
Okay, after advise on IRC I compiled master version. Performance jumped directly to min 25  fps! I needed only replace Quads with TriangleFan. Thanks.
7
It actually increased my loading performance 4  x times when loading the image one time and getting the textures from it.
8
Alright thanks you two I implemented it and it works fine. Wasn't that much effort. :)
9
General discussions / Re: Slow performance with Raspberry PI 3B
« Last post by bluszcz on October 19, 2019, 11:41:40 pm »
I managed to compile and install SFML with OpenGL ES, game compiles but crashing on the linking, any tips?:

[  2%] Linking CXX executable DeerPortal
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::cleanup()'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::update()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::getCapabilities() const'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::getTouchPosition(unsigned int, sf::Window const&)'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::setEnabled(bool)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::initialize()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::update()'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::CursorImpl::~CursorImpl()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::isConnected(unsigned int)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::WindowImplRPi::WindowImplRPi(unsigned long)'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::WindowImplRPi::WindowImplRPi(sf::VideoMode, sf::String const&, unsigned long, sf::ContextSettings const&)'                                        
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::setMousePosition(sf::Vector2<int> const&, sf::Window const&)'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::setMousePosition(sf::Vector2<int> const&)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::VideoModeImpl::getFullscreenModes()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::isTouchDown(unsigned int)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::CursorImpl::loadFromPixels(unsigned char const*, sf::Vector2<unsigned int>, sf::Vector2<unsigned int>)'
                                           
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::close()'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::JoystickImpl()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::setVirtualKeyboardVisible(bool)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::initialize()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::VideoModeImpl::getDesktopMode()'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::getMousePosition(sf::Window const&)'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::ClipboardImpl::getString()'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::close()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::isAvailable(sf::Sensor::Type)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::getMousePosition()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::isMouseButtonPressed(sf::Mouse::Button)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::cleanup()'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::getTouchPosition(unsigned int)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::SensorImpl::open(sf::Sensor::Type)'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::InputImpl::isKeyPressed(sf::Keyboard::Key)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::open(unsigned int)'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::ClipboardImpl::setString(sf::String const&)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::JoystickImpl::getIdentification() const'

/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::CursorImpl::loadFromSystem(sf::Cursor::Type)'
/usr/bin/ld: /home/pi/SFML/lib/libsfml-window.so: undefined reference to `sf::priv::CursorImpl::CursorImpl()'

collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/DeerPortal.dir/build.make:584: DeerPortal] Error 1
make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/DeerPortal.dir/all] Error 2
make: *** [Makefile:152: all] Error 2
 
10
Graphics / Re: Using Texture::loadFromFile(filename. IntRect) to load a spritesheet
« Last post by Laurent on October 19, 2019, 09:24:25 pm »
Quote
in the first case you are loading the same texture over and over again. it's bad at loading time and probably at drawing time too
It's "bad" (depends on texture size and number of spritesheets) at loading time but you can easily avoid loading the same image from disk again and again, by loading it into a sf::Image and then loading all parts into sf::Textures.

At drawing time, I don't think it really makes a difference. Everyone will tell you to use a single texture but in the end it won't make a huge performance difference.
Pages: [1] 2 3 ... 10