RPG help. some probs. HELP?

Started by
4 comments, last by stevenmarky 23 years, 10 months ago
I''m developing my own 2D RPG in direct draw in C++ builder (hopefully with my level editor). The game will be in a isometric view with a pre-rendered/drawn background. I have two problems: 1: Collision Detection - I first thought It would be a good idea to create a second bitmap that would not be shown in the game for each level that would show where edges were in red, exits in blue ect. Then Direct draw would scan through and create a two-dimensional array while the level was loading e.g. Collision[10][10]=1 If the value was one the character would stop moving, if it was 2 it would be an exit ect. This method takes a long time though, if anybody knows a better idea I would be pleased to hear. 2: Overlaying Pictures - Because the game is in isometric view, I made two layers for the background, one the floor ect and one that overprints it such as a wall so the player is behind the wall and not overprinted- the problem with this is the user can''t see what he is doing behind the wall. I thought, Easy, I''ll just make a function that makes a translucent/transparent circle on the wall when the user is behind it that follows the player. I found out how to do this, but It takes absolutly ages to do while the game is running and slows it down too much. Once I''ve got this problem solved my game will really get going. If anyone has any other suggestions ect, please say. Thanks, SR //end
Advertisement
quote:Original post by stevenmarky

I''m developing my own 2D RPG in direct draw in C++ builder (hopefully with my level editor). The game will be in a isometric view with a pre-rendered/drawn background.
I have two problems:


Actually, you have 3. Your 3rd problem is that you posted in the wrong forum This isn''t really about DirectX, it''s about isometric engines, and there is a forum dedicated to that, where all the tile-based RPGers hang out

But I will try to help anyway, cos I''m good like that.
quote:
1: Collision Detection -
I first thought It would be a good idea to create a second bitmap that would not be shown in the game for each level that would show where edges were in red, exits in blue ect. Then Direct draw would scan through and create a two-dimensional array while the level was loading e.g.
Collision[10][10]=1
If the value was one the character would stop moving, if it was 2 it would be an exit ect. This method takes a long time though, if anybody knows a better idea I would be pleased to hear.


Generally you''d make a level out of tiles, but this doesn''t sound like it fits your purposes. I''m not sure what you mean by ''edges'' and ''exits'' as these are fairly vague terms. You could have a monochrome bitmap that correlates to your terrain, where 0 is passable and 1 is impassable terrain. And your exits could be stored elsewhere. Or you could somehow define a list of polygons that mark out areas that you cannot enter. Either way, you have to decide what constitutes an area you can enter, as neither DirectDraw or any other library knows what you want for your game. What exactly is doing the ''scanning'' you speak of?

quote:
2: Overlaying Pictures -
Because the game is in isometric view, I made two layers for the background, one the floor ect and one that overprints it such as a wall so the player is behind the wall and not overprinted- the problem with this is the user can''t see what he is doing behind the wall. I thought, Easy, I''ll just make a function that makes a translucent/transparent circle on the wall when the user is behind it that follows the player. I found out how to do this, but It takes absolutly ages to do while the game is running and slows it down too much.
Once I''ve got this problem solved my game will really get going.


You could consider using Direct3D and taking advantage of some sort of alpha-blending for this purpose. Or go the Diablo route (I think - been a long time since I played that game) and simply draw only every second pixel of the wall. This would require some sort of masking, or a software blit that omits the pixels directly, or a separate set of ''translucent'' wall bitmaps.
For the first question - I would have all of the collision areas and exits defined in a separate file that would be loaded up at the start.

The second question - In Age of Empires 2 when a unit goes behind a building it shows their outline. You could have a seperate set of bitmaps for the outlines of the players that just gets drawn over the top of the wall.

Hope that helps!

- Daniel
my homepage
- DanielMy homepage
Age of Empires 2 ROCKS!!
Sorry, just had to get that in there.
I do agree that the way that Age of Empires 2 did their outline is very cool. It all depends on the style of your game. Age of Empires 2 has bright pictures so the outline looks good. I don''t think it would look good with the see through walls as Diablo does. Diablo has very dark pictures as its in dungeons and what not but their way suits the game. The outline would appear to be cartoony in Diablo while it fits in Age of Empires 2.

Thats my little tid bit. Don''t know if it helps but I haven''t slept in a long time because of sleeping disorders that I wished to god I hadn''t have been born with but what can you do right? You can stay up all night and learn more programming stuff (hehe, just made my leap into OpenGL last night, its not half bad )

My Friends call me Spanky
You can call me Chuck
long ago when I was fighting with 2d-colision detection I finally used this approach: You take a seccond bitmap, with the impassable walls in on color, the doors in another and so on, just as you planned to. But then don''t convert it into a 2-dimensonal array, but let it stay in the background. now as soon as your player moves you get a source point (current location) and a destination point. Trace a line from the source to the dest, and check for evey pixel in the colision-map. That sounds slow, but works qoite well. Now if you find a wall color, define a new destination point at the current checked pixel. This way you save a huge array, and at the same time get a more accurate colision detection as if you converted everything into tiles. Hope this helps,,

NoNseNse
thanks for the help, guys.
I think I''m going to repost this on another forum.

//end

This topic is closed to new replies.

Advertisement