Too much time on my hands.

rebuild.bat:
@CD common @CALL _rebuild @CD ../server @CALL _rebuild @cd ../client @CALL _rebuild

_rebuild.bat:
:lm @color 07 @mingw32-make rebuild @IF NOT %ERRORLEVEL%==0 ( @color 0C @PAUSE @GOTO lm )

fuckyeah.jpg

#ifndef PLAYER_HPP_
#define PLAYER_HPP_

#include "vector2.hpp"

#include <string>

class Player {
public:
	Player() = default;
	Player(int playerID, int channel, std::string handle, std::string avatar);
	void Update(int delta);

	int SetPlayerID(int id) {return playerID = id;}
	int GetPlayerID() const {return playerID;}
	int SetChannel(int ch) {return channel = ch;}
	int GetChannel() const {return channel;}

	Vector2 SetPosition(Vector2 v) {return position = v;}
	Vector2 ShiftPosition(Vector2 v) {return position += v;}
	Vector2 GetPosition() const {return position;}
	Vector2 SetMotion(Vector2 v) {return motion = v;}
	Vector2 ShiftMotion(Vector2 v) {return motion += v;}
	Vector2 GetMotion() const {return motion;}

	std::string SetHandle(std::string s) {return handle = s;}
	std::string GetHandle() const {return handle;}
	std::string SetAvatar(std::string s) {return avatar = s;}
	std::string GetAvatar() const {return avatar;}
private:
	int playerID = -1;
	int channel = -1; //for networking
	Vector2 position;
	Vector2 motion;
	std::string handle;
	std::string avatar;
};

#endif

Why does it even look like this? Should I just make this into a public struct with fewer methods? I really don’t think this is necessary. I should actually call this “ClientData”.

Edit: Also, I’m deleting the “PlayerManager” class. Chris was right, I should just use std containers unless there’s a good reason not to.

@Tumblr

OK, this really needs addressing. When people reblog and add new comments, this always ends up as a horrible mess of blockqutes:

foo:

bar:

hello

world

Instead, Tumblr needs to add some sort of simple parsing system, so that it results in this:

bar:

hello

foo:

world

Is that too much to ask?

strncpy() is better than strcpy() right?

Info: I can’t send a std::string over the network, so I’m using a char array.

Edit: oh, it doesn’t append a null if the source is longer than the length…

#include <iostream>
using namespace std;

struct Rect {
	int l, r;
	int t, b;
};

int main() {
	Rect r = {0, r.l + 10, 0, r.t + 10};
	cout << r.l << endl;
	cout << r.r << endl;
	cout << r.t << endl;
	cout << r.b << endl;
	return 0;
}

So apparently you can reference an object during it’s own construction.

Server selection interface.
Pretty ugly, and it uses a bunch of magic numbers, but it works.

Server selection interface.

Pretty ugly, and it uses a bunch of magic numbers, but it works.

Packet is being sent and received, and I’ve got a bare-bones ping-pong working.

Here’s what I believe:

Working hard with very little output is ok at this stage, because I’m laying down a lot more of the foundation that is evident. Eventually, once the foundation is complete, the visible progress will increase exponentially.

I’m holding onto this belief religiously, in the hopes that it’s actually true.

Train of Thought

I wonder if the client & server should share the Player & PlayerManager classes. If so, I’d probably have to disable the graphical aspects in the server…

I’m worried about multithreading in my server i.e. if I should plan for it now, or wait until later.

This is only a prototype after all.