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

Pages: [1] 2
Audio / sf::SoundStream linking error?
« on: October 17, 2013, 06:41:29 am »
Hello guys.

The sf::SoundStream appears to show a linking error with sf::Thread

This is the code I am trying to compile:

#pragma once

#include <string>
#include <SFML/System.hpp>
#include <SFML/Audio.hpp>

class audioStream : public sf::SoundStream {
        void setFile(std::string file);
        bool startLoading();
        bool isLoaded();

        void load();
        bool onGetData(Chunk& chunk);
        void onSeek(unsigned int timeOffset);

    sf::SoundBuffer buffer;

    std::string m_file;
    bool m_loaded;
    sf::Thread *m_loadThread;
    sf::Mutex m_loadMutex;

    int streamPosition;
    int fileSize;



#include "audioStream.hpp"

bool audioStream::onGetData(Chunk& chunk) {
    return 0;

void audioStream::onSeek(unsigned int timeOffset) {}

audioStream::audioStream() {}

Build Messages:
C:\SFML-2.1\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj)||In function `ZN2sf11SoundStreamD2Ev':|
D:\downloads\SFML-2.1\src\SFML\Audio\SoundStream.cpp|56|undefined reference to `sf::Thread::~Thread()'|
D:\downloads\SFML-2.1\src\SFML\Audio\SoundStream.cpp|56|undefined reference to `sf::Thread::~Thread()'|
C:\SFML-2.1\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj)||In function `ZN2sf11SoundStream4playEv':|
D:\downloads\SFML-2.1\src\SFML\Audio\SoundStream.cpp|105|undefined reference to `sf::Thread::launch()'|
C:\SFML-2.1\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj)||In function `ZN2sf11SoundStream4stopEv':|
D:\downloads\SFML-2.1\src\SFML\Audio\SoundStream.cpp|121|undefined reference to `sf::Thread::wait()'|
C:\SFML-2.1\lib\libsfml-audio-s-d.a(SoundStream.cpp.obj)||In function `ZN2sf11SoundStream16setPlayingOffsetENS_4TimeE':|
D:\downloads\SFML-2.1\src\SFML\Audio\SoundStream.cpp|164|undefined reference to `sf::Thread::launch()'|
||=== Build finished: 5 errors, 0 warnings (0 minutes, 0 seconds) ===|


Audio / sf::SoundBuffer getDuration() returns incorrect value
« on: October 11, 2013, 08:17:22 am »
Hello. I'm loading a .ogg music that has 3 minutes and the getDuration() is returning a incorrect value for the duration.

sf::SoundBuffer sb;

std::cout << sb.getDuration().asMilliseconds() << '\n';

this is returning something like 23xxxms, ~23s.

This happens with other files too.

I made this code to get the percentage of played sound:

sf::Sound s(sb);

double time = 100.0*s.getPlayingOffset().asMilliseconds()/(double)sb.getDuration().asMilliseconds();

And time get bigger than 100 after 23s :). So, appears that the sf::Sound getPlayingOffset() works great but something wrongs happens with the sf::SoundBuffer getDuration()

Music file: https://docs.google.com/file/d/0B87ZIbsLOhJ3NVA2OHp6cHFPQm8/edit?usp=sharing

**This is for a audio software. I know when use sf::Music..


Audio / How sf::Music internally works
« on: October 10, 2013, 09:39:59 pm »
Hello guys. How the sf::Music internally works? It uses a double buffer? Whilte playing one it push the data to the other and swap than each x samples?

I wanna make a "audio editing" software that you can put effects in real time, so my idea is to apply the effects over the standby buffer so when it get swaped it will player with affects already applyed. After each swap I go and apply the effect again over the standby buffer.

SFML have some way to make this work? maybe I can make it directly using openAL?


Network / Authoritative server physics update
« on: September 17, 2013, 08:36:40 am »
Hello guys. I'm starting a network based game with a authoritative server. The clients will send the inputs states 30 times/second and the server will broadcast the new game state at 10 times/second.

How do you think is the best way to update the server states with the received inputs?

1 - Each new input the server receives, it updates that player state (position, rotation....) and before broadcast the new states, run the collisions. (the problem here is that the physics will not run at fixed time steps because it can receive more than one input from the same client before the physics runs).

2 - Queue all the inputs received from clients and run only one client update each player for each physics update/broadcast. (The problem here is that the updates can go out of sync because the queues. At each physics step at average the queues will have three client inputs but it can accumulate more and go out of sync).

For me the best is the second option with a simple trick: if the queues get more than 3 inputs I can run more than one physics step before broadcast to get the queue back in sync. Maybe it works...)

What are your opinions?

Thanks. Gregory.

Network / Sockets Receive Buffer Queue
« on: September 10, 2013, 01:54:00 am »
Hello guys. I'm studdyng to make a netowkr based game that will use UDP sockets. The server will be authoritative and will handle all the physics.

I'm planning the server to broadcast at 10hz, the physics will run in constant time-step of something like ~33ms or so (3 physics step for each broadcast step) this will run on a single thread.

To receive the clients information I was thinking to have all the sockets at NOblokingMode and when some socket has some information it puts the information on a queue that will be used at the nest physics simulation. This appear to be a good aproach? (I know about the UDP and the security layer I will need to implement above it).

My main question is: what is the size of the kernels internal socket queue? It is enought to store some data that can come in between each socket polling?



Network / Problens to use network of sfml2
« on: July 11, 2012, 11:52:13 pm »
I made de static compilation of the sfml2 with cmake and mingw. It's working well for graphics, open windows, handle events... but when I try to use network I'm get this errors:

My test code:
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/System.hpp>

#include <SFML/Network.hpp>

sf::TcpSocket sock;

int main() {
    sf::RenderWindow wnd;

    return 0;

Code blocks errors:
F:\sfml2\lib/libsfml-network-s.a(Packet.cpp.obj):Packet.cpp:(.text+0x779): undefined reference to `sf::String::clear()'
F:\sfml2\lib/libsfml-network-s.a(Packet.cpp.obj):Packet.cpp:(.text+0x804): undefined reference to `sf::String::String(unsigned int)'

F:\sfml2\lib/libsfml-network-s.a(Packet.cpp.obj):Packet.cpp:(.text+0x81d): undefined reference to `sf::String::operator+=(sf::String const&)'
F:\sfml2\lib/libsfml-network-s.a(Packet.cpp.obj):Packet.cpp:(.text+0x87d): undefined reference to `sf::String::clear()'

F:\sfml2\lib/libsfml-network-s.a(Packet.cpp.obj):Packet.cpp:(.text+0xf4b): undefined reference to `sf::String::getSize() const'
F:\sfml2\lib/libsfml-network-s.a(Packet.cpp.obj):Packet.cpp:(.text+0xf9f): undefined reference to `sf::String::begin() const'

F:\sfml2\lib/libsfml-network-s.a(Packet.cpp.obj):Packet.cpp:(.text+0xfba): undefined reference to `sf::String::end() const'

Maybe someone can help me. Thanks!

General / Line in box collision
« on: November 06, 2010, 07:17:18 pm »
Hey guys!? how can i check if have a intersect/collision of a line in a rectangle?

i made this code, but is very slow for a lot of lines and rectangles:

Code: [Select]
bool line_collision(int x1, int y1,int x2,int y2,const gameobj& other,int precise) {
    int x,y,angle,dist;
    angle = point_direction(x1,y1,x2,y2);
    dist = point_distance(x1,y1,x2,y2);
    for(int i = 0 ; i < dist ; i+=precise) {
        x = (x1-cos(angle*(DEG))*i);
        y = (y1-sin(angle*(DEG))*i);
        if (x >= other.x + other.rect.Left and x <= other.x + other.rect.Right) {
            if (y >= other.y + other.rect.Top and y <= other.y + other.rect.Bottom) {
                return 1;
    return 0;

i think that have others ways to do this, can you help me?

Audio / Error in sfml::audio?
« on: November 05, 2010, 09:58:13 pm »
hey guys, i think that have an error in the sfml::audio. when i load big files or make a file transport by http the game crash, but if I change the audio buffer size the problem don't happens but in some computers the error continue happens.

Network / download image from html
« on: October 31, 2010, 01:51:35 am »
is possible?

C / problen dll
« on: October 28, 2010, 02:40:01 am »
i am making a DLL with some function to facility: point_direction, distance, format_text.. a error apear when i compile the project that i use to test the dll, not the dll project. i think that is because i don't know what i need to put for link, with sfml we put : -lsfml-graphics... but with my dll i dont know what need

Audio / probem in load sounds
« on: October 16, 2010, 07:57:04 pm »
i am thinking that my game have a problem with the sounds, if a run the game at first time it run ok, but when i close and run again when the game load the sounds it crash, the computer not only the game but for play the game again i need to restart the computer

*it have a lot of sounds buffer


i discovered that the problem is in the musics, i have one to the menu and another to the game, but in computers with low hardware this system crash

Audio / A lot of sf::Sounds
« on: October 16, 2010, 03:47:26 am »
hey guys! in my top down view game, for the enemys's shoot sound i have one "main" sf::SoundBuffer and each enemy have sf::Sound but some times when the enemy shoot his soud dont play

Window / get open filename
« on: June 08, 2010, 11:17:15 pm »
how I make the "get open/save filename" of the window API with a window of SFML?

SFML projects / Pro Shoot Strike
« on: February 21, 2010, 05:47:48 am »
Hey guys! I'm here to show you the beta of my first and new game in C++ using SFML, the Pro Shoot Striker

This is a very nice TDS game, isn't completed, I need to complet the online mode, same bugs and a big bug in the songs oO

The game has a banckmarck mode for test the computer ( this mode ins't translated to english )

The carrer mode isn't completed, if you will play, click in Choose Map, not in New Game.

The choose map have a auto map load that load all maps in the directory maps, automatic, I should to make maps and you download and past to maps directory and the game load automatic.


Move the player: W,A,S,D
Move the player to mouse position: space
Shoot: Left mouse button
Bomb: Right mouse button, has a force bar




Thank you for all! and sorry my english, I'm brazilian. Bye!

Graphics / draw ellipses
« on: January 05, 2010, 09:43:54 pm »
How can I draw ellipses?

Pages: [1] 2