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

Pages: [1] 2 3
Audio / Re: sf::SoundStream linking error?
« on: October 18, 2013, 06:49:44 pm »
Problem resolved. I was linking but the linking order was wrong.


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 / Re: sf::SoundBuffer getDuration() returns incorrect value
« on: October 11, 2013, 08:58:03 pm »
Thanks! The bug fix will come on the SFML 2.2?

Audio / Re: sf::SoundBuffer getDuration() returns incorrect value
« on: October 11, 2013, 09:15:48 am »

So at least MPC gets the right length, which I guess means the file isn't corrupted?

Yeap. It isn't corrupted. I exported it using Reaper. Aprofessional audio production soft.

Audio / Re: sf::SoundBuffer getDuration() returns incorrect value
« on: October 11, 2013, 08:32:31 am »

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 / Re: How sf::Music internally works
« on: October 11, 2013, 04:33:38 am »
I will give a look. Someone knows the size of the buffer chunks? My current ideia is use a custom soundStream that apply the effects at each chunk update.

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 / Re: Authoritative server physics update
« on: September 17, 2013, 11:33:21 pm »
I'll make good read of the articles and I will try the two ways. I think it can be helpful for others.. It's a very important point on network programming that don't have much material on the internet.


Network / Re: Authoritative server physics update
« on: September 17, 2013, 09:20:12 am »
He says:
Each character object has its physics advanced ahead in time individually as input rpcs are received from the client that owns it. This means that the physics state of different client characters are slightly out of phase on the server, some clients being a little bit ahead and others a little bit behind in time. Overall however, the different client characters advance ahead roughly in sync with each other.

I really don't understand how the updatePhysics method that he use works. Why it needs the currentTime?

Maybe I will need to run the collisions individually for each client at each input arrived?

For me the second option still seems simpler...

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?



Graphics / Re: Isometric Depth?
« on: December 25, 2012, 06:58:09 am »
I'm trying to do it now and my solution is use a priority queue with pairs that contains a pointer to a sf::Drawable and a unsigned int that represents the depth. I made own classes with drawing members that when invoked, instead of draw in the RenderWindow,  it pushs to the queue. The queue will be sort by depth, so at the end of the "step" I draw all the content of the queue.

Network / Re: Problens to use network of sfml2
« on: July 12, 2012, 04:09:14 am »
Very thanks man! Now it's working!

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!

Pages: [1] 2 3