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 27 Jun 2001
Offline Last Active Today, 02:46 PM

Posts I've Made

In Topic: [Question] map algorithm in sdl is flickerin'

31 July 2015 - 07:43 AM

Also note that you are loading a new BMP for every tile (SDL_LoadBMP()) and never calling SDL_FreeSurface().  You are going to quickly run out of memory if you do that.


You should only call SDL_LoadBMP() once per bitmap file, and then you can create textures using a reference to that surface you created.

In Topic: What's your favorite game in 2015?

22 July 2015 - 12:01 PM



But, I don't play a lot of games.  Hearthstone mostly these days.

In Topic: The best way to create some kind of central coordinator for collision?

21 July 2015 - 09:02 PM

I've been experimenting with different styles and I definitely think spatial hashing is the one for me. My game worlds are going to be

large and full of tiny objects which never exceed a certain size! It's taking me a little longer to implement, too, since I use so many different

types of objects. However, I've looked it up and there doesn't really seem to be anything out there which clearly and concisely

explains how to implement it in C#.


The first link you posted (conkerjo) explains the premise very well, but the actual code doesn't make sense. If you try and run it, it kicks off all

of sorts of errors and the return types don't even match up with the method calls! I understand that I need to be adding everything

potentially interact-able (if that's a word) to each grid node to check whether collisions, shots, attacks, etc, are even in range. The source code

for that original link is also down. I could think of a few ways to do this, but I'd like a nice fast industry standard way if possible! 


Any more tutorials on this topic which I may have missed?


I would just be googling looking for more articles on the subject, and I'll leave that to you.  However, I can give what might be some tips.  Regardless whether the code actually compiles in the 1st link, it explains the spirit of how to get it working.


And, about your concern for "since I use so many different types of objects", the "type" of object should have no bearing on this part of the equation.  You're simply trying to separate all the collidable objects into buckets, whether they are all objects that can't collide with each other (for example, enemies and enemy bullets) or not.  And, for that, you should use either a position and radius or bounding box (all your objects should have one of those).


Then, when grouped into separate cells, you can perform the 2nd level checks (ie, see if the collide masks overlap, then see if the bounding boxes (or radius) intersect), and even 3rd level checks if you need (pixel perfect collision detection , etc.) of the objects within each cell (i.e. bucket).


This is the kind of thing I'd love to implement, but these days I use 2d physics libraries for all my physics/collision detection/handling.  Good luck.  

In Topic: The "Entity Component" pattern

10 July 2015 - 10:25 PM

Here's an article that shows an example of what can be achieved using entity/components and does a good job spelling out what it solves  (but doesn't really use the typical entity component system).


EntityX is a nice C++ ECS system that uses the pattern Oberon_command was referencing and is active.


Google has many other articles you should read through to get a better understanding of it.

In Topic: Best way to store a stage for a platformer?

09 July 2015 - 12:37 PM

Hi Krypt0n. I like your first suggestion. How do you handle the foreground image(s) when you use a tile based game?


My game:



Just mark where the foreground images live in your world (x, y coordinate) and the image name.  No need to store every pixel of a level.