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

Pages: [1]
1
General / Best way to create a game updater.
« on: August 28, 2016, 11:21:53 am »
This is mainly for an mmorpg style game (one that will probably never be complete like many of my personal projects :P)

I'm wondering what the best way to create an in-game update is.
Should i use FTP, or HTTP, or just create my own file transfer server and send the data manually?
Without spending money, http seems like the best method, i could just shove my updates onto a random free website from 000webhost and have the client download updates from that link if the server says that an update is required.

What would be the best option? What is most commonly used for this?

2
Network / Second messagelost on certain computer.
« on: March 03, 2016, 10:35:54 pm »
Basically, i send two messages straight after each other, and the second is not received by the client at all, here is my code:

Quote
         for (int i = 0; i < WC.clients.size(); i++)
         {
            if (WC.clients == nullptr || i == foundEmpty)
               continue;
            mapData.clear();
            mapData << (sf::Int32)2 << (sf::Int32)0 << (sf::Int32)i;
            WC.clients[foundEmpty]->send(mapData);
            cout << "(2) Sending " << i << " to " << foundEmpty << endl;
         }   
foundempty is the ID of the client's socket in the array, this code is on the server and successfully prints:
Quote
(2) Sending 0 to 2
(2) Sending 1 to 2

On the client there is this code to receive the data:

Quote
         sf::Packet recievedata;
         if(WC.socket.receive(recievedata) == sf::Socket::Done)
         {
            sf::Int32 messageType;
            recievedata >> messageType;
            switch (messageType)
            {
            case 2://Other Player
               sf::Int32 oPlayerMessage;
               recievedata >> oPlayerMessage;
               {
                  switch (oPlayerMessage)
                  {
                  case 0://create new player
                  {
                     sf::Int32 OPID;
                     recievedata >> OPID;
                     cout << "Player created: " << OPID << endl;
                     if(WC.otherPlayers[OPID] == nullptr)
                        WC.otherPlayers[OPID] = new otherPlayer(WC);
                     break;
                  }
                  }
               }
            }
         }

This prints:

Quote
Player created: 0

The sockets are non-blocking, and this code runs on a loop.
If i decide to send the information later, it works, it just does not work as it is in this code, i could probably do a workaround by sending all the players in one packet, but i need to know why it's broken before continuing...

Sorry for the messy code, ill try to create a minimal code example later.

Also, these packets successfully get received on my computer at home, but on this computer it does not.
Only one packet gets received.

3
Audio / Playing sound at precise timing.
« on: November 21, 2015, 06:22:44 am »
Because of my game's framerate, playing a sound at a certain time will only trigger at a frame after that time, so i cannot get it precise. I've had the idea of adding some empty sound to the start of the sound (50ms or so) and playing it 50ms before and taking away the offset when it actually gets called to play, however, i have many small sounds which would cause my program to have an even greater RAM usage (even if it's only 50ms, it may still end up being a lot when i have 731 small sounds)
So my question is, can i make a sound play at a precise time independent of the game's framerate? (Possibly seeking negatively before the sound?)

4
I've always used "renderTexture.display();" after recreating an entire renderTexture, should i also be using it after only slightly altering a rendertexture? For example, if there is already lots of information in a renderTexture, and i decide to draw one extra pixel on it, should i then call display?
I've never encountered problems when not using display in this case, AS OF YET.

5
General / Opening and closing fraps causes program to crash.
« on: June 14, 2015, 02:48:19 am »
I just realized this when i was trying to find a cause of a crash in my program, but when i use fraps to measure the FPS of my program, after i close fraps, my program crashes a few seconds later.
I tested this on more than one of my games that have no relation, so it shouldn't be a bug with my game.
Considering fraps doesn't crash any other game, could this possibly be a bug in SFML?

6
I've been testing my game on computers with little video memory, and because my game uses a lot of rendertextures, after a while an error shows up "failed to share opengl context" - or something like that
So, is there a way for me to see if there is enough video memory available to create one, or is there a way to see if it correctly got created after creating it, and then disabling the error message that gets shown when it is created.

Sorry if this question has already been answered elsewhere, i didn't quite know how to word it.

7
Graphics / [SOLVED] Copying texture from rendertexture.
« on: February 22, 2015, 01:08:03 pm »
I want to use one rendertexture multiple times to create different images (As i've found deleting and creating new render textures to create massive memory leaks)
Basically i want to copy the 'texture' data from the rendertexture into a new sf::Texture.
I saw that you could save a render texture's texture to file, and then load it again into a new texture, however this would be pretty inefficient for per-step events.

Sorry if there is a simple function for this, i did look for a few minutes, but found no 'completely obvious' functions that do this.
As RenderTexture.GetTexture() will change as the render-texture changes.
As i was writing this, i thought of doing:
sf::Texture TestTexture;
TestTexture = RenderTexture.GetTexture();
Would this copy the texture data? or would it also keep a pointer to the texture data. I don't exactly have time to test it right now, so, sorry for a seemingly stupid question which i should probably hold off until i test that code myself.

8
Graphics / Memory leak with Sf::RenderTexture, help! [Solved]
« on: January 12, 2015, 03:04:36 pm »
I'm relatively new to trying to preserve memory by eliminating memory leaks.
Anyways, i was watching the memory of my program and i realized that the memory used by my RenderTextures was not getting released or cleared, so every time the map changed, more and more memory was being used up.
I've recreated my situation in this while loop statement below, as it would be too hard to write out my entire code, however using this code produces the same memory leak.

       
std::vector <sf::RenderTexture*> overlaySurfaces;
int mapWidth=2000;
int gridOverlaySquared=256;
int mapHeight=2000;
while(true){
    int Xmax_=ceil((double)mapWidth/(double)gridOverlaySquared);
    int Ymax_=ceil((double)mapHeight/(double)gridOverlaySquared);
    overlaySurfaces=vector<sf::RenderTexture*> (Xmax_*Ymax_);
    for(int i=0; i<overlaySurfaces.size(); i++)
    {
    overlaySurfaces[i]=new sf::RenderTexture;
    overlaySurfaces[i]->create(gridOverlaySquared,gridOverlaySquared);
    }
    for(int i=0; i<overlaySurfaces.size(); i++)
        delete overlaySurfaces[i];
    overlaySurfaces.clear();
    }

As i said, i'm pretty new to this, so how am i meant to properly delete the RenderTexture when they are in a pointer vector.

This code quickly uses a lot of RAM.

P.S. Now obviously this code is completely inefficient, trust me, my game is not this bad haha, even with the memory leak it would not use much ram probably. But i want to learn how to fix it, or if i can't fix it, then i can easily work around it.

9
General / Problem starting SFML 2.0 with CodeBlocks
« on: January 22, 2013, 09:36:28 am »
When i try to run a program using the sample code in the setup tutorial, the program starts then straight away has an error.
I am using codeblocks with SFML 2.0 made for codeblocks.
The error is the "name.exe has stopped working"
I'm using SFML_STATIC, and i linked the libraries like this in release mode:
sfml-graphics-s
sfml-window-s
sfml-system-s

I copied all the DLLs to the folder.
Here is my main.cpp:

Quote
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    sf::CircleShape shape(100.f);
    shape.setFillColor(sf::Color::Green);

    while (window.isOpen())
    {
        sf::Event event;
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();
        }

        window.clear();
        window.draw(shape);
        window.display();
    }

    return 0;
}


10
General / Help installing SFML 2.0 in codeblocks
« on: January 22, 2013, 09:24:05 am »
I've tried installing SFML 2.0 in codeblocks using the tutorial. (I can get it to work in microsoft visual studios 2010)

Heres my error log:
Quote
-------------- Build: Release in smfltest3 (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -Wall -fexceptions -DSFML_DYNAMIC  -O2     -ID:\SFML\include  -c "G:\KE\C++ projects\Projects\codeblocks projects\smfltest3\main.cpp" -o obj\Release\main.o
mingw32-g++.exe -LD:\SFML\lib  -o bin\Release\smfltest3.exe obj\Release\main.o   -s  -lsfml-graphics -lsfml-window -lsfml-system
obj\Release\main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0x1): undefined reference to `_imp___ZTVN2sf11CircleShapeE'
obj\Release\main.o:main.cpp:(.text$_ZN2sf11CircleShapeD1Ev[__ZN2sf11CircleShapeD1Ev]+0x11): undefined reference to `_imp___ZN2sf5ShapeD2Ev'
obj\Release\main.o:main.cpp:(.text.startup+0xe2): undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'
obj\Release\main.o:main.cpp:(.text.startup+0x11c): undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKSsjRKNS_15ContextSettingsE'
obj\Release\main.o:main.cpp:(.text.startup+0x14f): undefined reference to `_imp___ZN2sf11CircleShapeC1Efj'
obj\Release\main.o:main.cpp:(.text.startup+0x157): undefined reference to `_imp___ZN2sf5Color5GreenE'
obj\Release\main.o:main.cpp:(.text.startup+0x170): undefined reference to `_imp___ZN2sf5Shape12setFillColorERKNS_5ColorE'
obj\Release\main.o:main.cpp:(.text.startup+0x18a): undefined reference to `_imp___ZNK2sf6Window6isOpenEv'
obj\Release\main.o:main.cpp:(.text.startup+0x1b3): undefined reference to `_imp___ZN2sf6Window9pollEventERNS_5EventE'
obj\Release\main.o:main.cpp:(.text.startup+0x1d7): undefined reference to `_imp___ZN2sf6Window5closeEv'
obj\Release\main.o:main.cpp:(.text.startup+0x207): undefined reference to `_imp___ZN2sf5ColorC1Ehhhh'
obj\Release\main.o:main.cpp:(.text.startup+0x21f): undefined reference to `_imp___ZN2sf12RenderTarget5clearERKNS_5ColorE'
obj\Release\main.o:main.cpp:(.text.startup+0x225): undefined reference to `_imp___ZN2sf12RenderStates7DefaultE'
obj\Release\main.o:main.cpp:(.text.startup+0x23e): undefined reference to `_imp___ZN2sf12RenderTarget4drawERKNS_8DrawableERKNS_12RenderStatesE'
obj\Release\main.o:main.cpp:(.text.startup+0x24d): undefined reference to `_imp___ZN2sf6Window7displayEv'
obj\Release\main.o:main.cpp:(.text.startup+0x27d): undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
obj\Release\main.o:main.cpp:(.text.startup+0x2e8): undefined reference to `_imp___ZN2sf12RenderWindowD1Ev'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
17 errors, 0 warnings (0 minutes, 0 seconds)

Most of my settings can be seen in the error message above, tell me if I'm missing anything :)

Pages: [1]