• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About Cranky

  • Rank
  1. Free and easy to use 2D game engine?

    indielib is probably what you are looking for but it uses directx. As an alternative you could use sdl which is good enough for 2d.
  2. deformed maps like gunbound

    for the graphical representation of the map they can use whatever they like, might even be tiles, or a still image, or several, doesn't really matter. For the blow up section they most probably use a bitmask, which marks which "pixel" or section of the map is solid, and which was blown up. Look here, there is a nice tutorial on how to do such things: http://jnrdev.72dpiarmy.com/en/jnrdev5/
  3. You get a HWND passed to your TimerProc right? You can use SetWindowLong to associate a pointer with that HWND, something like this: SetWindowLong( handleToWindow, GWL_USERDATA, &ApplicationClass ); or something like that This way you can call ApplicationClass* pointerToApplication = static_cast<ApplicationClass*>(GetWindowLong(handleToWindow, GWL_USERDATA )); inside your TimerProc and thus eliminate the need to have a global. If you need more data associated with that window, or something of that sorts, you can also let Win32 allocate extra space associated with your window, that you can also access using Get/SetWindowLong. You associate extra space by setting the value cbWndExtra of the WNDCLASSEX structure to the size you need before calling RegisterClassEx. You should look into the MSDN for more info :)
  4. First Hydra Demo!

    Couldn't get it to work on my pc. It said that the application could not be started because the application configuration was incorrect. Am I missing any dll's or something? I got Windows XP multimedia edition 2003 Intel Pentium 4 3,4 GHz, 2,000 gb RAM ATI Radeon X700 SE Edit: Ah now I get it, I didn't have the physX runtime installed...
  5. vector< Arrow* > Arrows; vector< Arrow* >::const_iterator iter = Arrows.begin(); while( iter != Arrows.end() ) { //do stuff if( *iter ) delete( *iter ); iter = Arrows.erase( iter ); } I'd do it this way...
  6. 2d tile based map and objects

    Why do you have to treat the player as if it was a tile? I don't think that the maptiles do have to know on which tile the player is. If you need to know where the player is standing then put that information into your player-class, if you have something like that. If I were to develop a tile based game I would do it like this: Make a Map class that would load tile maps into an array and would be able to draw itself taking a "view" as argument. Then I would have a view-class, that is just like a camera that looks onto your map. That way you can use those views to determine which portion of your map needs to be drawn (normally this is where the player is). You can also have several views, if you wanted to have a split screen for 2 player games for example. Then I would have a class for the player, another for the enemies and then a generic class for items. Those would hold information like place, health etc. Finally a game class that would own instances of all the other classes and handle them, like when having the player move, the game class would "ask" the map class whether that place is free for moving. Here you can use path finding I guess.
  7. I'd do it this way: Use tiles for the look, but not for the collision. The level editor would also have a "collision" editor, in which I would be able to define collision paths. These can be curved, can have different attributes, like only triggering a collision when overlaping from above and can also be generated by the level editor itself if I only needed "per-tile" rectangular collisions. So for curved tiles, like loopings in sonic, you would just define collision paths and give them a specific attribute, so you engine knows how to handle collisions with a specific path.
  8. collision detection in worms-like game?

    Try this tutorial: jnrdev It is the fifth part of the tutorial series and it shows a way to do destructible pixel landscapes with collision detection just like in Worms.
  9. Well, calling DrawIndexedPrimitives 1000 times per frame explaines the performance of you program. You should definitely batch your vertices. If you want to transform them one by one you can use d3dx, it has some nice functions for transformations. Another option would be to use IDirect3DDevice9::ProcessVertices I guess, but I never used it, so I don't know what you have to do exactly to get your vertices transformed, but from what I've read in the documentation it should transform those vertices you define. For you it would mean to call ProcessVertices 1000 times and DrawIndexedPrimitive just once, but I don't know if that is any enhancement as I have never used ProcessVertices. If you use the d3dx functions for transformation (which is basically software vertex processing done by you at that point) the performance should be fine, though.
  10. DirectX leak newbie

    Don't change the source code of dxut. Place that while loop after your call to DXUTCleanup3DEnvironment(). As I said, place it there where you clean up in your code. That loop shouldn't change the behaviour of you code, it should just decrease the number of AllocID's returned to those that are leaking.
  11. Drawing GUI stuff

    You can use textures for resizable controls. You just have to render more than just one textured quad. You will then have one quad for each corner, one quad for each side and one quad for the background. If you have textures that don't lose too much quality when stretched it will look just fine. If you have patterns that look awkward when stretched then implement some algorithm that will repeat to render quads until everything is covered.
  12. DirectX leak newbie

    Put it there where you call SAFE_RELEASE( Device ) or Device->Release() in you clean up code.
  13. DirectX leak newbie

    Try doing this in your clean-up code: while( Device && Device->Release() ) ; This way everything that was released right should be released except for you leak and you shouldn't get so many allocations remaining. What it does is basically that you release everything with the same reference count as your device. So everything that is not leaking should be released this way. As your leak is being still referenced by your code, you should get be able to isolate your leak. Note that this is for debug purposes only, you should comment these lines out after you found your leak. I don't know if it will help you, but it helped me when I was trying to find a leak some time ago. To have not to worry about that kind of leaks you could also use some kind of smart pointers that call Release when they run out of scope. That way you shouldn't have to bother with cleaning up manually.
  14. Quote:However, DOM nodes don't have to be part of a document (they need to have an owner document but they don't have to be part of that document's tree), so there's a good chance of nodes "leaking". Shouldn't the owner be responsible for freeing the nodes? So even if some nodes aren't part of the document tree, they are still owned by that document, so that document should also be responsible for freeing them. That way you can just use normal pointers and there is no need for smart pointers. You can make the document reference counted, though. I don't see why the nodes themselves should be reference counted, as they will be mostly used as a part of a tree, so you would need the document to access them. Just make the document reference counted and make nodes normal pointers. The owner of the nodes should be responsible of freeing resources.
  15. Hello. I am currently trying to implement dynamic 2D soft shadows according to this article but I am having problems with the "soft" part of it. I had no problems doing hard-edged shadows, but I am having problems making them soft. Building up the shadow geometry is no problem, I got everything right with calculating the penumbra etc. but I can't figure out how to make my light soft. I implemented hard-edged shadows with the use of the stencil buffer to mask off the areas that are shadowed, but I can't use the stencil buffer to fade out the light so that it appears soft. The article uses the alpha channel for this matter, but that method doesn't do it for me. Isn't there another method for making the shadows soft without utilizing the alpha buffer? I am using Direct3D, but I don't think that that matters. [Edited by - Cranky on November 18, 2007 12:28:30 PM]
  • Advertisement