Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Endurion

Member Since 21 Feb 2002
Offline Last Active Today, 07:15 AM

#5165310 Organizing a map structure for a top-down tile game

Posted by Endurion on 07 July 2014 - 11:56 AM

You're throwing away a lot of advantages of a tile map.

 

IMHO: I always cringe when I see someone defining a tile class for a simple tile map.

 

For one, the indices of your tile array are all you need for positions. The tiles themselves don't need any, since you can deduce the position from the indices already.

Determining the tiles to draw is a simple calculation. With camera offset and screen size you can calculate the starting end ending indices of tiles on the screen.

 

Adding entities to tiles sounds good on a glance, but you already saw some disadvantages yourself. Also, when entities move you'll be constantly updating tile pointers. When an entity is on the move between tiles, which tile do you add it onto? Which tiles entities do you check for collision when an entity moves?

I'd put entities in a separate list, optionally a spatial container. This lets you reduce overdraw easily.

 

What's left for the tiles? Indices to the image. These could be stored directly, so you end up with a much simpler two dimensional array.




#5164838 So... I'm a Molecular Biologist....

Posted by Endurion on 05 July 2014 - 12:38 AM

As for other games: Probably off, but look for Atomix: http://en.wikipedia.org/wiki/Atomix_(video_game)

 

It's basically a tile based puzzle game where you assemble molecules.




#5163986 Receiving very odd compiler Errors

Posted by Endurion on 30 June 2014 - 10:43 PM

You've got circular inclusions for GameObject and Component.

 

Since you seem to only use pointers to each other remove the "#include "GameObject.h" from Component.h and vice versa. Add a forward declaration to each header.

 

Component.h

...
class GameObject;
 
class Component
{
  ...

 

GameObject.h

...
class Component;
 
class GameObject
{
  ...



#5163560 Assimp and Common Dialog Box - Strings - C++

Posted by Endurion on 28 June 2014 - 10:08 PM

Well, for starters, since you assume that your CString hoops are the culprit, you might show that particular code.

 

And to make it even easier for us, show the path before and after. This should make it trivial to point out any problem.




#5161238 FindResource (Win32) help .cpp

Posted by Endurion on 17 June 2014 - 11:58 PM

The first parameter to FindResource is the instance where the resource is expected to be. A .exe and the Dlls it loads have different resource pools.

 

A Dll has a different instance handle. Passing NULL uses the instance that started the process( the .exe).




#5159109 Mysterious Rigids On Rendered Textures

Posted by Endurion on 08 June 2014 - 11:44 AM

In my DX9 code I've offset the vector position by -0.5, -0.5 for all 2d textured rendering.

 

I recall having a few difficulties when the 2d rendering was performed not by pretransformed vertices (and ran through the matrices) In the worst case you may have to clamp the final coordinates to direct multiples of 0.5 (which can be tough when using matrices)

 

I see you're using shaders, I'm not sure if that makes a difference, I'm still using fixed function.




#5159023 Mysterious Rigids On Rendered Textures

Posted by Endurion on 08 June 2014 - 12:47 AM

Vertical flipping should not cause that problem. If you're using DX9 or below, it might depend on how you map texels to pixels though (offset the vertex position or offset the texture coordinates?)

 

This problem can also appear if your backbuffer size does not match the client size of the window.

 

You DID use AdjustWindowRect(Ex) to find the correct window size for the required client size?




#5152226 How to hide the taskbar with Win32 API on resize?

Posted by Endurion on 07 May 2014 - 11:56 PM

This might be interesting: http://blogs.msdn.com/b/oldnewthing/archive/2005/05/05/414910.aspx

 

Basically the task bar has some code behind it to notice if it should hide itself or stay visible, if you follow the blog entry you should find how to do it right.




#5151983 Fez like 3D engine.

Posted by Endurion on 06 May 2014 - 11:23 PM

I've written a little game similar to FEZ (http://www.georg-rottensteiner.de/en/games.html#babel).

 

It's just simple textured cubes (FEZ does have smaller cubes for details though).




#5151069 VS2013 Menu Item With Submenus not Disabling/Enabling

Posted by Endurion on 02 May 2014 - 11:25 PM

Do you have maybe colliding menu item IDs? In that case you could try with MF_BYINDEX instead of MF_BYCOMMAND.




#5150789 Visual Studio 2012 Command Line Building Woes

Posted by Endurion on 01 May 2014 - 01:15 PM

AFAIR for SDL 1.2 to link you also had to link a second library containing the hidden WinMain function.

 

e.g. SDL.lib and SDLmain.lib

 

 

Also, see here: http://lazyfoo.net/SDL_tutorials/lesson01/windows/msvsnet2010e/index.php




#5150689 Command Console Window

Posted by Endurion on 30 April 2014 - 11:04 PM

Usually they are not real HWNDs but simply self written in the game engine.

 

It's easier to completely control the layout if you do the drawing and behaviour yourself.

 

GDI does not really work well inside OpenGL or DirectX areas.




#5150090 VC is ok but Mingw crashes with libcurl

Posted by Endurion on 28 April 2014 - 05:44 AM

Usually that's in found in the start menu. It's a link to a batch file that sets up a few environment variables.

 

Look under "Visual Studio 2012" for "Visual Studio Tools". There should be two links to a command prompt, one for x86, one for x64.




#5147398 WM_INPUT with Arrow Keys Failing

Posted by Endurion on 16 April 2014 - 11:17 AM

Did you pass the message on to DefWindowProc? If you don't some states may not get updated as expected.

 

From MSDN on WM_INPUT:

 

The application must call DefWindowProc so the system can perform cleanup.




#5147174 Need help to draw cursor properly

Posted by Endurion on 15 April 2014 - 12:46 PM

This sounds like you need to get the cursor hotspot. Funnily you need to use GetIconInfo to retrieve that info.

 

 

Edit: Ninja'd






PARTNERS