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

Pages: [1] 2 3 ... 720
1
Window / Re: Restart Window inside isOpen loop
« on: April 12, 2024, 06:45:08 pm »
If you close and directly re-create the window, you won't just drop out of the loop, but by the time you hit the while condition again, it will already be reported as open again, so you won't leave the loop :)

2
"optimized" and "debug" have to be provided as link targets from somewhere, might just be cached.

Make sure to clean your build directory and do a clean CMake configure again.

3
I believe the primary slow down of things are currently the multiple copies of textures you're doing (explicitly and implicitly). If you reduce that, it should probably be possible to do it in the main loop with minimal lag.

Do you want to reuse the textures or just save it to disk?

If you just want to render some images to disk, I suggest to not first render all the textures and then save it, but to get the RenderTexture's texture, save that, then render the next one. This will remove the copying of the RenderTexture's texture into another texture instance and also remove the need for a storage container.
What you then could consider, is moving the texture data into memory first, then use std::async to write the data from RAM to disk async, to not block on slow IO operations.

If you do want to store the texture somehow for reuse, then I'd suggest std::vector<std::unique_ptr<sf::Texture>> as a container. If you use C++17 and above, you should benefit from guaranteed copy elision, as such, you should be able to return the full vector.
I'd suggest to try and spread the rendering across multiple frames, if that's at all possible, so you leave enough frametime for the reset of the loop.

4
The short answer: Don't ;D

The explanation: OpenGL isn't actually multi-thread capable, so all the commands you issue, essentially end up in the same command queue and thus there's generally little to gain from doing things in a separate thread.
Additionally, you need to have an active context per thread, which means you'd have to create a new context, which by itself can be rather expensive.

For SFML 2 your code is additionally problematic, as you use a non-stable container (i.e. vector) to store textures, so when you add a new texture, what can happen is that all the textures need to be moved somewhere else, which is done through a copy (as SFML 2 has no move semantics), which means the texture data is downloade from VRAM to RAM and then uploaded again to VRAM, thus very expensive.

It's also recommended to use as few textures as possible to prevent texture swapping and when possible to just use different sections of the same texture instead. As such it's questionable to split the different renderings into multiple texture instances, which btw. is again a texture copy (VRAM -> RAM -> VRAM).

My suggestion would be to render everything to one large RenderTexture and then store a list of texture rects that tell you which sections of the large texture you should use and doing everything in the main loop.
I don't know the rest of your program, but this should be fast enough.

The error message itself sounds rather odd. Maybe you're not properly protecting shared resources, thus running into some undefined behavior?

5
Can you count the amount of events produced per frame?

One thing we've seen in the past is that broken gamepad drivers can cause havoc on the event loop.
Make sure you don't have some weird gamepad plugged in or devices that somehow get registered as gamepads or virtual drivers that are hacked together.

There has also been issues with certain Corsair keyboard drivers causing massive lags. Check that your drivers are up to date.

And finally, don't forget that FPS isn't linear, so you might see faster drops for small changes processing times.

6
How are you measuring FPS?

8
Graphics / Re: VertexBuffer caching for chunks rendering
« on: April 06, 2024, 05:32:02 pm »
The reason the internet advises to write games not engines is because when writing games, you naturally run into the necessary limits, so you can write code that matches the game and aren't just randomly guessing and most likely totally overestimating your requirements.

As such, I recommend to sit down and think about what kind of game you want to make - pick something very small - and then decide how much tiles you realistically need.

Secondly, writing performance optimized code without having actual profiling results, rarely works out.
Are you really struggling with frametime and is the vertex transfer really the bottleneck? Or could your dynamic_cast actually have a way heavier tax on the CPU for example?

Never optimize in a vacuum, which however means, you'd need a realistic load, which means, you'd have to have a game to run, instead of just an engine, thus see my first point. ;)

Nobody here, can give you a number that isn't just a random guess, since we don't know the game or what the performance profile looks like.

9
Graphics / Re: gluBuild2Dmipmaps indefined
« on: April 06, 2024, 05:20:25 pm »
Any reason you're not using the graphics module but do your own OpenGL coding?

I wouldn't recommend GLU, instead you may want to use GLAD: http://glad.sh

As for the error, if it can't find some GLU function, it's somehow not defined or misspelled, check the GLU documentation.

10
General / Re: Mouse Movements
« on: April 06, 2024, 05:05:23 pm »
To me it's rather unclear what problem you're seeing. The mouse can only move at a certain speed over your window. If it's a 1:1 mapping then it would just move as fast as you see your mouse move, I don't understand why you think this is too fast, nor what it has to do with the view.

Maybe post some code and explain what you want to achieve, so we can understand the problem.

Personally, I'd recommend using events to track mouse position, instead of using sf::Mouse::getPosition()

11
Audio / Re: Help with running the package
« on: April 06, 2024, 04:51:45 pm »
And what's NEON supposed to be? Never heard of that.

12
System / Re: error when trying to build (gcc + codeblocks)
« on: April 06, 2024, 04:47:13 pm »
It says "unless", which means, if you're not using the latest version of VS, which you aren't so it also applies to you. ;)

13
System / Re: error when trying to build (gcc + codeblocks)
« on: April 06, 2024, 04:23:56 pm »
If you use the pre-built SFML libraries, you missed the big read box on the download page saying:

Quote
Unless you are using a newer version of Visual Studio, the compiler versions have to match 100%!

Given the download is made for MinGW WinLibs Edition (x86 / x64) 13.1.0 and your error mentions 13.2.0

If you want to avoid all of that, you can use the SFML CMake template: https://github.com/SFML/cmake-sfml-project

14
System / Re: Small isKeyPressed question
« on: March 30, 2024, 01:06:29 pm »
Event handling and real-time input checks are two different concepts.

Whenever possible we recommend to handle events.

15
No, SFML doesn't offer such a functionality, but there are various libraries that have implemented this in some way or another.

https://github.com/mlabbe/nativefiledialog
https://sourceforge.net/projects/tinyfiledialogs/

Pages: [1] 2 3 ... 720