Jump to content
  • Advertisement
  • entries
  • comments
  • views

Finally writing a game again

Sign in to follow this  


After much messing about, I have now finally started a 2D scrolling platformer in Direct3D using VC++ 2005.

So far I've got a backdrop and map on the screen, scrolling around with the cursor keys. Parralax scrolling between the backdrop and the map is working and I've just implemented the game items list and can put static blocks on top of the map.

The map and items are loaded from a binary file. I'm using a sort of abstract factory method for the game items - everything inherits from CItem and all the main engine code sees is a list of CItems. The CItem interface exposes virtual functions that return enough information to draw the item, plus a Call method that is called for each item every frame.

To do the backdrop, I've loaded a 256x256 wrap around texture and am drawing it using >1 texture co-ordinates to make it repeat sufficiently across the screen.

Now the graphics library is starting to stablise a bit, it is now much like writing with DirectDraw really, although I'm looking forward to being able to exploit vertex colours and alpha blending for some cool effects.

Not enough done to post any screenshots yet but just nice to be actually working on something again.

At the moment, the speed of scrolling is controlled by the frame-rate, which is obviously good. It makes the scrolling look a bit jerky but I don't see a solution to this really. The jerkiness is as a result of the motion being a floating value less than one each frame, which obviously accumulates over time but doesn't affect the screen until the values pass an integer threshold but I've thought about this a lot, and discussed it on the forums, and I don't think there is a solution.

I just hope that when there is plenty going on on the screen the slightly jerky movement becomes unnoticable. I've got to make the leap to frame-rate independance and I'm not prepared to fall back to my old approach of throttling the frame rate.

I have decided, though, that I'm going to check the time delta each frame and, if it is too great for the collision detection to be reliable, reduce it. This will impose a minimum frame rate on the game but as long as this is less than 60 then I can imagine this will be a problem on the majority of modern PCs.

My computer is okay but hardly cutting edge so I guess if it works on mine, it will be acceptable.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!