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

Pages: [1]
1
Graphics / VertexArray
« on: November 16, 2012, 10:32:29 am »
Hey there :)

From what I gathered in the various posts I read here, there is some black magic available to draw tile maps, and that is the VertexArray.

I understand this is a kind of Graal for many 2D games, so I'll try to understand it a little better.

Some people said I could divide the world in big chunks, with a vertexArray for each chunk, and use these chunks for culling.
So how exactly does it work ? Here are my thoughts.

- Each chunk represents a static part of the map. So it's set once at first, and never ever edited again.
- The visible chunks are picked and drawn. Since the visible part of the map can move (or we wouldn't need culling in the first place), it means we have to translate the chunks to their correct position. But the documentation says VertexArrays are not transformable.

Does this mean we can't translate the whole array ?
If we can't, then will we need to translate each vertex individually ? But then we lose the "set once, don't touch again" property of these chunks...

Now, I'll propose another solution. Since I didn't see it mentioned in the threads I read, I'll assume that's because I missed something, and I'll be glad if you can show it to me.

We'll start from a VertexArray-less situation, with the usual per-tile culling, and where we draw each tile individually.
Now, let's just replace the single-sprite drawing call with one that adds a quad to the vertex array, with the position it would have been drawn to.
In the end, the vertex array just acts as a gatherer for all the draw calls, and bath them all in the end.

Was I too unclear ?
If not, would it even work ?
If it would, would it be much slower than the other method ? In the end, we only have one draw() call, and tile-precise culling.

2
Audio / Questions about sound in a game
« on: July 01, 2012, 11:29:58 am »
Hey there :)

I'm considering using SFML audio classes to handle sounds and music in a game. I have a few questions about this.

- I want to play a music, and automatically starts a new music when this one is done. Is there a way to know when the streamed music is about to end ? Like a callback or something ?
- I want to play a sound everytime someone shoots. So one SoundBuffer for all of them, but how do I dynamically create the Sound objects ? Do I need to keep a list of all active sounds, and delete them when they're finished ? Is there some auto-delete flag ?

All I really want is the ability to chain musics, and to starts sounds at anytime, without knowing in advance how many Sound object I will need.

I'm not decided on a version yet, so I'll probably go with 2.0 if nothing's wrong with it.

Thanks :)

3
Graphics / Tiles : many sprites or many moves ? [SOLVED]
« on: November 24, 2009, 10:55:48 pm »
Hello !
I have to draw a grid with many little sprites ; yet I have a question : would it be better to have only a few sprites (one for each kind of cell) and move & draw them repeatedly, or to have many sprites (one for each cell) and change their image each time, or to have many many many sprites (one for each kind of cell for each cell) and just choose wich one to draw ?

Thanks !

EDIT : the grid would not have to move, it's just a game board.

4
General / SFML with pkg-config ?
« on: June 25, 2009, 10:59:25 am »
Hello !
Do you have any idea how to make sfml work with pkg-config ?

Pages: [1]