Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 18 Mar 2010
Offline Last Active Sep 27 2013 08:22 AM

Topics I've Started

Sending structures through UDP sockets

11 February 2013 - 10:27 AM

Hey GD!


I was thinking about implementing an online server-client game and here is what I came up with:

1. The game is driven by events (if a player gets shot, an event is generated, etc).

2. The event is converted to some sort of format and sent to the server.

3. The server sends it back to all clients but the original sender.

4. The clients convert it back and make the necessary changes in game logic.


Does that sound like it could work? I haven't been able to think about a better solution myself.


Now the real question is (if my solution makes sense), what format should I use to send my event classes through UDP sockets? Should I just convert their data to strings? Are there popular solutions to this?

Co-op RPG

31 January 2013 - 09:52 AM

Hey guys!


I'm a huge fan of the Diablos (yes, even Diablo III), and I have always wanted to make an isometric RPG. I already got some of the basics down, most importantly the basic map handling, just waiting for SDL 2.0 to come out so I can get it running on decent fps. Now, I've been thinking about making it an online game (as in anyone can make a game and 1-2 others can join). Would it take huge efforts? I have no experience in C++ socket programming, even though I figured I could just learn SDL_net.


Would I need to code everything with respect to multiplayer, or can I just add it later through some hacking?

SDL 2.0 or OpenGL?

27 December 2012 - 02:37 PM

Rendering a 40x40 tilemap that has ~10 layers in SDL 1.2 is pretty darn slow, I started looking into faster options. Now my question is, is SDL 2.0 a lot faster than 1.2? I'm trying to avoid using OpenGL as best as I can, but if it's the only efficient way to render quickly, I'll probably have to use it. Any opinions on SDL 2.0 concerning speed?

Segmentation fault while rendering map

13 December 2012 - 11:15 AM

I'm trying to render a map with a moving camera and I get a segmentation fault every time I start moving down. Here is the code:

	void Map::Render(SDL_Surface* tileSet, SDL_Surface* display) const
		const int tileSize = Tile::GetTileSize();
		Vector2D cameraLocation = Camera::control.GetLocation();

		//Checking boundaries
		if (cameraLocation.x < 0)
			cameraLocation.x = 0;

		else if (cameraLocation.x > width * tileSize)
			cameraLocation.x = width * tileSize;

		if (cameraLocation.y < 0)
			cameraLocation.y = 0;

		else if (cameraLocation.y > height * tileSize)
			cameraLocation.y = height * tileSize;

		Vector2D first;
		first.x = (int)cameraLocation.x / tileSize;
		first.y = (int)cameraLocation.y / tileSize;

		Vector2D offset;
		offset.x = (int)cameraLocation.x % tileSize;
		offset.y = (int)cameraLocation.y % tileSize;

		for (int y=0; y<height; y++)
			for (int x=0; x<width; x++)
				//Segmentation fault happens here
				const int index = \
					rows[y + first.y].columns[x + first.x].GetTileID();

				Rectangle srcRect = Tile::GetSourceRect(index);
				const int xOffset = x * tileSize - offset.x;
				const int yOffset = y * tileSize - offset.y;
				Surface::Blit(xOffset, yOffset, srcRect, tileSet, display);

The segmentation fault happens at the GetTileID() function. Additional data:

width = 50;
height = 200;
tileSize = 96;

//Variable values when the segmentation fault happens
cameraLocation.x = 10;
cameraLocation.y = 100;

first.x = 0;
first.y = 1;

offset.x = 10;
offset.y = 4;

x = 9;
y = 198;

xOffset = 854;
yOffset = 19004;

Decent 2D isometric tutorial?

09 December 2012 - 12:08 PM

I've been searching the internet for literally weeks and I haven't been able to locate a decent 2D isometric tutorial or book. Yes, I've read multiple articles here on gamedev, but they're either really old or they don't go into specifics at all. What I'm looking for is one that:
- is recent (not older than ~3-4 years)
- is preferably in C++
- covers basic tile attributes
- covers basic pathfinding
- covers camera movements.

Looking forward to your suggestions!