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

Pages: [1] 2
Network / Re: UDP socket connection over WAN
« on: October 23, 2018, 11:15:23 pm »
Thanks for the quick response.

So does this mean I'll have to use a separate server for connecting them if I want them to connect no matter what? And how exactly does that work? Could you, perhaps, just send all the information you need over something like discord, or is there more to it than just transferring the information?

Network / UDP socket connection over WAN
« on: October 23, 2018, 09:29:12 pm »

I’ve been working on an online game for around a month and a half now, and I have made a lot of progress. I have a whole system in place for connecting different machines over LAN, sending packets full of player data to the server and then sending all the data to other players, and all the other basics of online games. I thought it was impossible to connect UDP sockets over WAN without some form of NAT traversal, like UDP hole punching, but I was looking through some tutorials and I found out this might not be the case.

How exactly would this work in SFML, and what would I need to do this? Would I need hole punching after all? Has somebody already done this, and is there any source code for something like this?

I'm a bit confused about it, so you have both clients connect to a server with different sockets, and then send connection info over it? But this is TCP, do you need a UDP socket for this to work?

I'm using TCP, thanks for responding. I'll look into hole punching, I was always curious how I could play certain games with friends with little to no setup.

Network / How do I upgrade a game from LAN to across the internet?
« on: June 04, 2018, 09:59:56 pm »
I made a pong game which works across LAN, and then I realized it might be possible to move it to across the internet, but I didn't know how to. Here are some simple questions I have about it.

Do I need to port forward? If I do need to, how do some games not require you to port forward to be able to play with one of your friends?

Do I need to change any of my actual code? Are there any settings/conditions that aren't enabled by default in each program that need to be met in order to work across the internet?

Thank you.

SFML projects / Re: A small puzzle-platformer I've been working on
« on: July 20, 2017, 02:57:59 am »
Thank you! I think it'll always be like that. It's not perfect, especially for moving objects which is hard to time if you want to click on, but I couldn't think of anything better. I might make the mouse a bit bigger though.

SFML projects / A small puzzle-platformer I've been working on
« on: July 19, 2017, 11:29:53 pm »
I've been working on a small puzzle-platformer for a few weeks, and I think it's the best looking game I've made so far. Here are a few features I've implemented:

- Wall jumping
- The ability to freeze entities
- The ability to possess other people
- An 8-bit auto tiling engine
- Crates!

Here are some of the features in action


And here's a quick shot of the tiling system


And here's a small album of all the gifs of the game


I don't have a name for it yet, but I'm planning to release it soon. I don't want it to become a huge project, just something small. If you thought it looked interesting, I post updates on my twitter.

I always thought people just drew every single tile and wrote one long if-else statement to check which sprite to load, but now I realized there are way too many possible block formations to do that. How do people normally approach auto-tiling? Is it possible to have one sprite of the border of a tile, and then instead of loading a million different tiles, just merging the border on top of the original tile texture?

Audio / Re: Outputs a warning message upon exit
« on: July 12, 2017, 05:54:37 am »
So for some reason, I tried commenting out all the Sound object references and slowly uncommented them, trying to find which line was causing the problem and surprisingly I stopped getting the message. I guess it was just my computer or something. Thanks for your help though. Sometimes things just don't work, I guess.

Audio / Re: Outputs a warning message upon exit
« on: July 11, 2017, 11:43:06 pm »
The soundbuffer was already made before the sound. Also, they're member objects of a class with only one instance (player class). I tried making a minimalist example, but I didn't get the problem and I'm not sure how to recreate it.

I commented out every single line that plays, loads or even creates sounds so that no SoundBuffers are loaded or created. The only time I didn't get the message was when I commented out the Sound object in the player class. It even displays the warning when I uncomment it but don't do anything with it.

I even tried removing it entirely and just giving the Sound object to it's parent class, Entity, so every object on the screen has a Sound object, and it still has the same warning. The thing is, it doesn't say '7 devices not closed', it always says 1. So I guess there's just something wrong with the Player class.

Audio / Re: Outputs a warning message upon exit
« on: July 11, 2017, 09:15:07 am »
Any chance you've got any static or global object from the audio module? Or something that's never freed?

No global variables. I don't think I freed anything, how do I do that?

Audio / Outputs a warning message upon exit
« on: July 11, 2017, 04:20:09 am »
So I just started working on audio for my latest project and I've done it for one other project that worked perfectly, but for some reason when I exit, it outputs this to the console:

AL lib: (EE) alc_cleanup: 1 device not closed

The sounds still play during the program, but it still outputs this warning. I've googled the code but most of them talked about threads and explained the problem but none had solutions that worked for SFML. I don't have any threads in my project, and all the audio files are within the player. I have 3 SoundBuffer objects and one Sound object. I play them by using the following code:


Am I able to play sounds within the player class? Is there something I should do to cleanup the sound files upon closing?

Network / Why aren't my computers connecting?
« on: January 11, 2017, 11:48:37 pm »
I've tried a lot of things, and yet I still can't figure this out. I saw this question was in the FAQ, I saw examples and I saw other peoples questions. The computers aren't even connecting, so I can't use wireshark. My goal was to create  a simple chatroom before I did something a bit more complex. Here's my code:

#include <iostream>
#include <SFML/Network.hpp>

using namespace std;
using namespace sf;

int main() {
    TcpSocket socket;

    string txt = "Connected to ";

    char message[2000];

    cout << "Enter c for client and s for server: ";
    char type, mode;
    cin >> type;

    if (type == 's') {
        TcpListener listener;
        txt += "Client!";
        mode = 's';
    } else if (type == 'c') {
        socket.connect(IpAddress::LocalHost, 2000);
        txt += "Server!";
        mode = 'r';

    socket.send(txt.c_str(), txt.size() + 1);
    size_t received;
    socket.receive(message, sizeof(message), received);
    cout << txt << endl;

    Packet packet;
    packet << 5;
    bool done = false;
    while (!done) {
        if (mode == 's') {
            getline(cin, txt);
            socket.send(txt.c_str(), txt.length() + 1);
            mode = 'r';
        } else if (mode == 'r') {
            socket.receive(message, sizeof(message), received);
            if (received > 0) {
                cout << message << endl;
                mode = 's';
    return 0;

What can I do to test this? Is my code just bad?

I made a game using C++ and SFML developed on windows, but all of my friends and family members have macs. I have access to one if I really need it, but how do I port it? The game is here:

SFML projects / Blast To The SpaceCraft
« on: December 04, 2016, 07:24:07 pm »
I finished a SFML C++ game, i call it "blast to the space craft". I made it in two weeks, so don't expect too much from it but I think it's worth a couple minutes of your time. It's a top down space shooter, sort of like galaga and space invaders but also not. Nobody's played it yet, but that might be because I just released it yesterday. http://gamejolt.com/games/blast-to-the-spacecraft/214827

Pages: [1] 2