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

Pages: 1 2 [3] 4 5 6
SFML development / Re: sf::Time & sf::Clock vs C++11 chrono
« on: March 10, 2017, 08:38:31 pm »
I love sf::Clock more that that chrono, that casts,declartions are not so great as usage of Clock, IMO.  I agree with Mario, Clock is more friendly, I think.

Feature requests / Re: sf::Timer class?
« on: March 07, 2017, 11:27:46 am »
I think it is not a rational way to include a library just to use one class. And every feature in this forum can be written by yourself in class  ;)

Feature requests / sf::Timer class?
« on: March 06, 2017, 07:39:42 pm »
Hello. Very often, in games timers are used. For spell countdown, turn duration, bomb timer, etc... It will be very convinient if SFML would have a timer class. It can be similiar to sf::Clock, but it should go downwards, and it can call a function on end or fire up an event.


Network / Re: TCP server freezes whole program
« on: February 23, 2017, 06:55:31 am »
Fixed. I was sending raw data and receiving packets, instead of raw data :)

SFML projects / Re: TwoCars - A simple endless survival game
« on: February 22, 2017, 08:08:34 pm »
Good job! As original, funny and simple.

Network / Re: TCP server freezes whole program
« on: February 22, 2017, 11:05:51 am »
 What can cause packet not to be sent correctly?

Network / Re: TCP server freezes whole program
« on: February 22, 2017, 12:05:05 am »
Yea, I am aware of it. If it is impossible to find the problem, then I came up with some questions:
1.Is it a good way to start local game server in the same screen (game state)?
2.Why packet couldn't be read correctly?
3.In my situation, what sockets are better: blocking or not?

EDIT: Hah, probably I found out the problem. Server waits for the client, sends the packet and then again starts waiting for the client, which will never connect 2nd time. But why it freezes whole program while it is started in thread.

Network / TCP server freezes whole program
« on: February 21, 2017, 11:19:38 pm »
Hello. I am making multiplayer game. Currently, I want to implement playing on 1 computer. My idea is to start TCP server on localhost and connect clients in game screen here. But my server freezes whole program, so the render loop of the screen doesn't start. Also, I cannot receive my data (it has 0 size and trash in value)
My Server (please, ignore Logger class, it is just basic file stream logger):
struct ServerPlayer {
    TcpSocket sock;
    std::string name;
    int turns;

class GameServer {
        bool start(unsigned short port);
       //Handle gameplay
        void handleMove(int target, int x, int y);
        void handleAttack(int target, int attacker);
        void handleSpell(int target, int spell);
        void handleSkip();
        void parsePacket();
        void shutdown(string msg);
        bool isRunning;
        TcpListener listener;
        Logger logger;
        vector<ServerPlayer> players;

Implementation of start method:
bool GameServer::start(unsigned short port)
    logger.log("Starting game server on port "+patch::to_string(port));
    if (listener.listen(port) != sf::Socket::Done)
        logger.log("ERROR: Cannot start listening on given port!");
        return false;

    logger.log("Now listening to incoming connections...");

    sf::TcpSocket client;
    isRunning = true;

    while (isRunning) {
        if (listener.accept(client) == sf::Socket::Done) {
            Packet p;
            p << HANDSHAKE;


How I start my server:
void startServer() {
   Thread serverThread(&startServer);
    TcpSocket sock;
    sf::TcpSocket socket;
    sf::Socket::Status status = socket.connect("", GAMEPORT);
    if (status != sf::Socket::Done)
        printf("ERROR: cannot connect to server!");
    Packet p;
    int msg;
    if (p >> msg) {

    } else {
        printf("ERROR: couldn't receive data\n");
    printf("Received packet from Server: %d of %d bytes\n", msg, p.getDataSize());

I hope you will help me and my code isn't too big to read :D.


Network / Network system for 1v1 game
« on: February 18, 2017, 10:53:15 am »
Hello. I am making a game with multiplayer over network support. There are 2 players with: position, rotation and shooting moment. My questions are:
1.What should I choose: TCP or UDP?
2.Should I do client-server or peer-to-peer communication?
3.What server should do (checking shooting intersection, end of game)?

SFML projects / Re: QuadStrike - simple arcade on SFML
« on: February 16, 2017, 07:18:05 pm »
v.1.1.0 is out!
- Added rotation for players
- Changed blue player controls

Also, I added screenshots.

SFML projects / Re: QuadStrike - simple arcade on SFML
« on: February 16, 2017, 09:25:38 am »
Also, code review and suggestions are welcomed.

SFML projects / Re: QuadStrike - simple arcade on SFML
« on: February 16, 2017, 08:56:09 am »
Nice idea and a good starting point, keep up the work!

A few notes:
-You should avoid the shift key for things like firing, because fast clicks will trigger a windows popup.
-I cannot get back to the menu when both players are alive?
-You should always include screenshots in your presentation thread, so users somewhat knows what to expect (and for the linux/mac users :D)


Thanks for the reply! Yea, I should change the shift key. Screenshots will be attached :)

SFML projects / QuadStrike - simple arcade on SFML
« on: February 15, 2017, 11:29:43 pm »
Hello. I was playing a bit with SFML and made this game.
QuadStrike - it is arcade where the goal is simple: eliminate your enemy.


  • WASD to move and Q to shoot for Red player
  • Arrows to move and Right Shift to shoot for Blue Player

  • MrOnlineCoder (me) - author, programmer and artist :)
  • Gasalt Font by Remi Lagast
  • Music by Kevin MacLeod
  • And surely, Laurent Gomila and contributors for SFML :D

  • Y movement
  • Rotation
  • Powerups
  • Network multiplayer

GitHub: https://github.com/MrOnlineCoder/QuadStrike/
Download: https://github.com/MrOnlineCoder/QuadStrike/releases/
I attached Windows binaries (built on Windows 7 64bit MinGW). Linux builds will be available soon.

Version: 1.2.0
Changelog: https://raw.githubusercontent.com/MrOnlineCoder/QuadStrike/master/CHANGELOG.txt

SFML projects / Re: Breaker_IS
« on: January 04, 2017, 12:40:29 am »
Looks pretty cool, especially theese effects. Good job!

SFML projects / Re: First Game Showcase (with source code!)
« on: October 11, 2016, 03:26:50 pm »
So, finally I compiled it, I fixed abs error by including <cmath>.

Pages: 1 2 [3] 4 5 6