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

Pages: [1] 2
1
Graphics / Large tile maps with many non-tile-entities, Best Practice?
« on: April 21, 2021, 02:48:52 pm »
Hey everyone,

this is maybe rather a design problem than a "technical" problem, yet still, I think I lack some technical knowledge about how to deal with it:

Imagine a 200*200 tilemap with 100px*100px tiles. We can do that, probably in a single draw call (even though splitting it up might be helpful?). But that part is not the problem. Now assume that - in the worst case - each tile has an Entity occupying it with its own sprite (or maybe 2-3 Sprites, if they have additional icons displaying their status). Thats 200*200*2 = 80.000 Render Calls. That's a lot. Probably not gonna happen.

So, how to solve? Do I only use a sprite array of screenSize/100 sprites and panning over the map reloads the sprites of different entities into the array? So basically I dont move the view over the tiles, but instead move the index or range of entities for which the sprites should be shown right now.
Or should I just make it 2 giga-large vertex arrays, one for the map and one for all the entity sprites? They might be overlapping though, there's no useful way to quickly generate overlapping textures for tile maps, right?

Also: Given that there could be about 1000 different entity sprites each 80px by 150px, there's not way but to atlas them, is there?

2
Graphics / Using SFML should I care about texture binds?
« on: April 21, 2021, 02:38:40 pm »
Hey everyone,

there's this one thing I never really understood: In how far do I need to manage texture binds? I'm using SFML out of the box, mostly just window, sprite and texture classes (sometimes VertexArrays).

Are all textures bound that are loaded as texture? Or only those bound to a sprite? Or only those which have been drawn at least once? What if I bind 30 gb worth of texture data? Are they loaded and bound one after the other? Will it just crash? Will it miss rendercalls? Render only the textures that can be stored? Will it simply take 3 seconds to render a single frame?
Should I unload every texture that is not needed asap?
Should I build texture atlases even though I dont use tilesets?
Are there texture binds happening for off screen sprites? What for partial offscreen Sprites? (Imagine a 20.000*20.000 image, will it actually bind and render the whole thing or only the pixels inside the view?)

3
Oh. Yeah. Embarrassing. Thanks this solved my problem. I think I need to start a new account so people dont think I'm the idiot I am lol. Still, thanks for taking time to answer something as basic as that. :)

4
DotNet / Any newline characters for text class implemented right now?
« on: April 05, 2021, 12:04:25 pm »
Hey everyone,

for C++ the /n character inserts a line break into a text element. When I try it in C# its a "/n" in plain text and doesnt change the format. Any way to line break by inserting a character or do I have to use a second text object?

5
Hey everyone,

not sure if it's a help request, it's more like a "what do you think about" kind of thingy, so I hope the general category fits.

I try to develop for lower end machines and I use C#. Hate me, hunt me, but I got my reasons :) Most of my game ideas include about 5-15 small icons and bars and such for buffs, resistances etc of RPG like creatures or player characters. Given 10-30 units on screen at once that's kind of too many render calls and its a mess to manage all the offsets.

Many games do similar things though - how? What does best practice look like in those cases? Is each unit a vertexarray with the upper quads of the array being reserved for icons? Categorizing different vertexarray quads for different uses seems to be tedious as well. Is it just me being lazy and more of the RenPy/RPGMaker-Guy?

6
General / Is fading a single tile of a tilemap in and out efficient?
« on: November 09, 2020, 11:40:49 am »
Hey everyone,

this is kind of a broad question with probably no "100% accurate" way to answer "the right way". Yet I struggle a lot to find a solution for this problem:

I got a tilemap grid thingy. My game world is about 200*200 Tiles of Size 120*120 big. The efficient way to render those is by putting the relevant tiles in proximity to the camera in a vertex array as can be seen in the tutorial.
Yet I need things to move on top of those tiles. And while they are on top, they should keep fading in and out, and the tile should do the same as well, just "anti-synchronic" (sorry, I lack the english words to be more precise here). So while the Actor on Top is totally opaque, the tile is totally transparent, while the thing on top is transparent, the tile is opaque. Both alphas are changed with a sine function with an x-Offset of +1, their sum is always 1.

The actual problem: In order for this to work I need to check all the occupied tiles, change their color and therefore have to re-calculate the whole vertex array, right? This is probably less efficient, than going back to a sprite for each tile?
Sprite for each tile still seems really unpleasant performance wise. Can anyone give me advice on how to solve this issue? I would be really grateful!

7
Audio / Re: SoundRecorder::getAvailableDevices() only prints "true"
« on: November 01, 2019, 04:01:56 pm »
Very same problem here, while isAvailable() returns true, the vector<std::string> has a size of 0. Any way to solve or workaround? Or does audio recording simply not work?

8
Graphics / Re: Setting Text origin driving me insane
« on: August 04, 2018, 10:40:19 pm »
Did you realise that you're adding numRect.top but subtracting numRect.left ?
Yea, that were at least the signs, that pushed the text into the write direction :D

Quote
Note that a circle's local boundary is another case where left and top is not guaranteed to be zero. The width will take into account the outline so you'll need left and top of the local boundary too.
Try it without circle outlines to confirm that that is what is happening.

Thanks. I love you. That solved it :D


9
Graphics / Setting Text origin driving me insane
« on: August 04, 2018, 07:36:21 pm »
Hey folks,

trying to set the origin of a text to its center in order to place it in the middle of a circle. Text tends to be quite off to the bottom right.

Read the thread https://en.sfml-dev.org/forums/index.php?topic=19447.0 , but that didn't work for me either.

Here's the code:

Code: [Select]
                //Some Circle Shape
lifeBackground = new sf::CircleShape();

lifeBackground->setFillColor(sf::Color::Red);
lifeBackground->setOutlineThickness(4);
lifeBackground->setOutlineColor(sf::Color::Black);
lifeBackground->setRadius(20);

lifeBackground->setOrigin(lifeBackground->getLocalBounds().width/2, lifeBackground->getLocalBounds().height / 2);

                //Text should go into center of circle shape
lifelabel = new sf::Text();
lifelabel->setFont(font);
lifelabel->setCharacterSize(25);
lifelabel->setOutlineThickness(3);
lifelabel->setString(std::to_string(life));
lifelabel->setFillColor(sf::Color::Yellow);
lifelabel->setOutlineColor(sf::Color::Black);

sf::FloatRect numRect = lifelabel->getLocalBounds();
sf::Vector2f numRectCenter(numRect.width / 2.0 - numRect.left, numRect.height / 2.0 + numRect.top);
lifelabel->setOrigin(numRectCenter);


See the RED circle in the attachment. The Text within the BLUE one is centered by hand and therefore not resolution-independent.

Would be glad for any help!

10
Graphics / Does sprite.setColor() use additional shaders internally?
« on: July 08, 2017, 01:04:17 pm »
This is a question of efficiency I guess. If I set the color of a single sprite to a new Color, does the rendering require the GPU to switch shaders? Does every colored object has its own shader? Would it be of any use, to pool Objects colored in the same color regarding their draw-calls?

Thanks in advance!

11
https://www.sfml-dev.org/tutorials/2.4/window-opengl.php

OpenGL + SFML = 3D
Don't think it is going to be as easy as you want it to be though.

Yep, i already tried openGL, actually i managed to import and render a model, but actually I did a lot of copy paste from different tutorials, since I didnt really understand much (well, I discovered that modifying shaders is a lot of fun though :D). I would really like to try this again, if there only was a copy-paste-like-tutorial for skeleton animations. I watched like 50 REALLY bad tutorials on that topic and tried about 15 code snippets I found on github, yet none of those did work out. So if you know any source for that, I will happily follow your advice :D

Alternatively you could try and export your 3D models and animations as 2D spritesheets and render those.
Or use something like Spriter or Spine to do the animation part.

I did think about this as well for a short moment, the 3d-to-2d-spritesheet thing. Thats basically how pre-diabloII-era games did it, right? But regarding the usual 1920*1080 resolution... doesnt this way of rendering eat up a huuuuuuuge load of RAM? And since its still textures on OpenGL-Surfaces (it is, right?) it needs to be VRAM, which seems to be quite limited, in contrast to regular ram.

12
Hello everyone!

I know, that SFML is supposed to be a 2d engine, and basically I am totally fine with that. In fact: I really love how simplistic and intuitive SFML works: I love the input handling, the really basic Text and Sprite Classes and so on. But since I suck at 2d Animations, I really need my game to be 3d, in order to become finished any time in the future.

I tried UE, Irrlicht, Unity, Esenthel, ... and all of those are really annoying for the fact that they force you to include so ridiculously many crappy scene graphs and bloated input- and event handlers and whatsoever.

Therefore I am looking for an easy (by easy I mean: My math sucks) way, to get basic 3d models and skeletal animations up running in my SFML-Window, so that I can combine them with my selfmade SFML-UI-Components and my simplistic game loop and resource handling.

Does someone know of any library that fits those requirements?

13
Graphics / Re: Texture Manager, how to make sprites take pointers?
« on: June 07, 2017, 10:08:15 pm »
Quote
It crashes because your pointer is a nullptr (and that probably just because you're running it in debug mode and the memory was zero-padded).

Neither nor. As I told, if i check for  std::cout << texture.size().x; it prints 100, which is the correct size of the png-file. This is possible right before I try to feed the pointer to the sprite. Mentioned that in the comment line as well. Running in Release Mode, checked this already.

Quote
Just because you think that the application flow should run fine, doesn't mean it actually does.
Dont mean to sound offensive, but where does this actually come from? Did I state something the like?

Quote
or you never assign the texture to the other pointer (no match for the switch-case) or you have left out important code.
As i told, i can cout the size of the thing the pointer points to, so I am _really_ confident about the assignment of that one. Theres a lot of code in the program which I didnt post, since its waaaay to extensive to expect other people to read I guess. But I really cant imagine, which part of it could possibly interfere right between the cout statement and the sprite.setTexture();

14
Graphics / Re: Texture Manager, how to make sprites take pointers?
« on: June 07, 2017, 09:37:40 pm »
Alright, I think its perfectly reasonable in my situation, to use this kind of bad style, since the pointers should exist from the programs start to its termination and should be accessible from everywhere. Therefore doing it this way saves a lot of time passing around references and doesnt really have a downside.

Can someone help me with my problem from the opening post? I really cant figure it out. Much appreciated.

15
Graphics / Re: Texture Manager, how to make sprites take pointers?
« on: June 07, 2017, 09:22:24 pm »
Why not? And is this technically a problem or just regarded as bad style for most situations?

Pages: [1] 2
anything