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

Pages: 1 2 3 [4] 5 6
46
Audio / Re: Audio Sample Analasis
« on: September 26, 2015, 08:55:06 pm »
I am wanting to get the frequency of the sample. And I wasn't really expecting anyone to explain it i just didn't quite know where to look for the awnser.
Thank you

47
Audio / Audio Sample Analasis
« on: September 26, 2015, 07:13:07 pm »
I have made a data encoder that encodes data into audio using frequency modulation. I am having a main issue though. I directly load the file into the sound buffer and get its samples and im trying to decode it. I have a set amplitude, a set of data, a constant offset and i multiply the data by a multiplayer to make it easier to notice. 
Code: [Select]
void EncodeData(std::string data, int speed, int multiplyer, int offset, unsigned int AMPLITUDE, int mode, std::string filename)
{
    int seconds=(ceil(data.size()/(double)speed));
        std::vector<sf::Int16> encoded;
    const double TWO_PI = 6.28318;
    double FREQUENCY= 0;
    double increment = 0;
    double x = 0;
    double switchtime=ceil((44100*seconds)/(double)data.size());
    std::cout<<44100*seconds <<" switchtime: " <<switchtime <<" datasize: " <<data.size() <<" samplecount: " <<seconds*44100<<"\n";
    _getch();
    double x2;
    for(int sample=0; sample<44100*seconds; sample++)
    {
    FREQUENCY=((int)(data.at((int)floor(sample/switchtime)))*multiplyer)+offset;
    increment=(FREQUENCY)/44100;
    if(sample/switchtime==3.0)
        x2=switchtime;
    sf::Int16 Sample = AMPLITUDE* (sin(TWO_PI*x));
    encoded.push_back(Sample);
    x+=(increment);
    }
    sf::SoundBuffer buffer;
    buffer.loadFromSamples(&encoded[0],encoded.size(),1,44100);
}
I am trying to get the data from the sound samples. I have this so far.

Code: [Select]
bool DecodeFile(std::string filename, int speed, int multiplyer, int offset, int AMPLITUDE, std::string &output)
{
sf::SoundBuffer sb;
sb.loadFromFile(filename);
int rate=sb.getSampleRate();
int seconds=sb.getDuration().asSeconds();
int datasize=seconds*speed;
double switchtime=(44100*seconds)/datasize;
const sf::Int16* samples = sb.getSamples();
std::vector<char> data;
data.resize((int)(ceil(sb.getSampleCount()/switchtime)));
for(unsigned int counter=0; counter<data.size(); counter++)
    data[counter]=' ';
//???????????????????????????
// Here is where im stuck
//??????????????????????????
}

I already know that i need to loop through everything but my main issue is the formula to get the Data. Altogether though i might be totally wrong on everything i did.

48
Network / Re: Sending Binary Files Across A Server
« on: May 19, 2015, 07:52:31 am »
Well the main issue I'm having is I'm not sure how I should send the data. Mainly I'm not sure weather to send it through SF::Packet or raw data. The other thing I'm afraid of is the difference in byte order.  I have tried multiple ways to send the binary data an none have worked

49
Network / Sending Binary Files Across A Server
« on: May 19, 2015, 02:44:51 am »
I am very confused on how to send a binary file across a network using SFML Udp Sockets. Can anyone clairify the topic or give me a hunk of code on how to send and receive. I am talking about files that can fit in the packet, not multi-packet files.

50
SFML projects / Re: Currently Unamed 2d Tile Map RPG Game
« on: March 11, 2015, 03:53:34 am »
Giant update ! Everything is currently being reworked. Most systems will now be dynamic, and almost have iorned out connection errors as well as other issues. I have added a community on kik, for those who want to check it out, #adventuregame, and I will get screenshots to you soon. Entity systems are being worked out.

51
Network / Re: sf::Packet Data Extraction
« on: January 20, 2015, 02:46:55 am »
Cilent
while(!mainpack.endOfPacket())
{
        if(mainpack >>counter1 >> counter2 >>actualx >>actualy >>temp)
        input=0;
    else
    {
        std::cout <<"An error has occured\n";
        std::cout <<"Got Map Data x " <<counter1 <<" y " <<counter2<<" data " <<temp <<" actualx " <<actualx <<" actualy "<<actualy <<"\n";
        counter1= -40; continue;
    }
    std::cout <<"Got Map Data x " <<counter1 <<" y " <<counter2<<" data " <<temp <<" actualx " <<actualx <<" actualy "<<actualy <<"\n";
    if(counter1 > 0 & counter2 > 0 & counter1 <MAP_WIDTH & counter2<MAP_HEIGHT)
    mainmap.block[counter1][counter2]=temp;
    else
    {
        if(counter1 < 1 | counter2 < 1)
    std::cout <<"An Error has Occured Because x " <<counter1 <<" or y " <<counter2 <<" is less than one\n";

        if(counter1 >MAP_WIDTH & counter2 > MAP_HEIGHT)
    std::cout <<"An Error has Occured Because x " << actualx <<" is greater than map width"
    <<MAP_WIDTH <<"\n or y " <<counter2 <<" is greater than map height " <<MAP_HEIGHT <<"\n";
    }

Server:

        upperleftx=10;//(player_.location[counter][1]-VIEW_WIDTH)-1;
        upperlefty=10;//(player_.location[counter][2]-VIEW_HEIGHT)-1;
        lowerrightx=10+VIEW_WIDTH;//(player_.location[counter][1]+VIEW_WIDTH)+1;
        lowerrighty=10+VIEW_HEIGHT;//(player_.location[counter][2]+VIEW_HEIGHT)+1;
        int counterx = upperleftx; int countery = upperlefty;
        int counter2=1; int counter1=0;
while(countery<lowerrighty)
{

    receive <<mainmap.block[counterx][countery];
    std::cout <<"mainmap screenx  " <<counter1 <<" screeny" <<counter2 <<" " << "\nx" <<counterx <<" y" << countery <<"data" <<mainmap.block[counterx][countery] <<"\n";
    counterx++;
    counter1++;
    if(counterx>lowerrightx)
    {
        counterx=upperleftx;
        counter1=1;
        countery++;
        counter2++;
    }
}
if(request.send(receive, receiveip, port) ==sf::Socket::Done)
{
    std::cout <<"Sent Properly \n";
}
else
{
    std::cout <<"An Error Occured While Sending Sending Map to " <<usernametemp <<"\n";
}
        }
 

52
Network / Re: sf::Packet Data Extraction
« on: January 20, 2015, 02:10:58 am »
I am looping to extract data to a map structure. It gets the x and y values from the packet, and tests to make sure they are within map range. If so, it sets the map data [ x ][ y ] to the block received. It loops this until the map reading is complete. I am getting some strange results from this method.

53
Network / sf::Packet Data Extraction
« on: January 20, 2015, 01:56:28 am »
When getting data, must you do all of your extractions in one line of code or can you do one extraction. And then, when you do the next, have it continue where you last were at. Example:

packet <<x <<y;
packet >>x;
packet >>y;

If not, is there any way to do it.

54
General / Re: The Beginning of an MMO
« on: January 19, 2015, 08:34:53 am »
What i am mainly asking is when sending map data to a player should the client make a request to the server and the server sends the map data or the server sends it without request. Also, please someone look over the code, i can pinpoint the problem.

55
General / Re: The Beginning of an MMO
« on: January 19, 2015, 03:32:59 am »
I have a main question. Should the server send information to the client without a request from the cilent. By the way, here is my code in the attachements. Sorry, at the moment they are fairly small and this is the barebones basics. Please help. Also, please report any other problems. Using sfml 2.1. This is truthfully what i think should be included.

56
General / Re: The Beginning of an MMO
« on: January 18, 2015, 05:37:01 am »
I have fixed some of the problem. I have managed to come up with a version that does work in that respect. There are a few more problems i have. The main one. The server receives connection data from the client and the server adds it to a list. It sends a confirmation to the cilent. It then waits for a request. Now, the problem I'm having,. When the client sends a request for map data, thesserver never receives it. Why would this not work, or should I just have the server send data automatically to the client without it requesting map data?

57
General / Re: unique_ptr help
« on: January 18, 2015, 02:29:07 am »
I suggest that you, instead, learn C++ another way. SFML is not a good way to start learning c++. I suggest starting with http://www.cplusplus.com/doc/tutorial/ to learn about c++. I sugest then moving into game design using c++ and sfml.

58
General / Re: The Beginning of an MMO
« on: January 18, 2015, 02:00:49 am »
I previously understood that. It working properly currently. The main problem I am having is having the server sending map information to the client. I have a problem. I dont know how I should package the data and howw it should be received on the cilent side. The size of the map varies from server to server. The size of screen the player can be seen is dependent on VIEW_WIDTH and VIEW_HEIGHT. It is equal on both server and cilent. How should I proceed. Should I package it all in a single packet. If so, how would I package it.

59
General / Re: The Beginning of an MMO
« on: January 17, 2015, 08:12:35 pm »
Thank You All,
I have created many singleplayer games, I have been obsessing over getting better. I truthfully believe im ready. I am ready for making an MMO. About posting on the sfml forums, I am sorry, I thought someone might post SFML based code.

60
General / Re: The Beginning of an MMO
« on: January 17, 2015, 08:27:17 am »
A tutorial would also be verry helpfull but not neccassary.

Pages: 1 2 3 [4] 5 6