Thread: how to make a racing 2d game

  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    11

    how to make a racing 2d game

    hi....I want to write a 2d racing games (the simplest one) ...but i don't know where or how to start......i use borland c, I know a little about graphics....but i don't have any idea how the track moves, or how if the car increases its speed...give me some ideas please, or some algorithms...or...tutorial.....and the last one...how to create the enemy...........

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    19
    i'm assuming that it's a 2D isometric view-based game. firstly, you want to know how to represent and display the game's graphical elements, such as cars, trees, etc. you can do this by using bitmaps, or creating image arrays in the program code itself.

    Next, you need to think about the track itself. will it have curves in it? if so, the simplest way to represent the track will be through using tiles for each strip. otherwise, with a 'cornered' track (less visually impressive, yet easier to implement), you'll be able to keep track of its direction, and draw it accordingly through plotting.

    this game will NOT be easy to code up, and i recommend that you read up properly on the various areas involved, as you'll be likely to run into trouble somewhere along the line otherwise. how experienced are you in C? have you written a game before? if you have real trouble grasping concepts such as sprite animation and basic AI, i recommend that you either read up thoroughly on them, write test programs BEFORE, or try something simpler. you'll also make sure that you know what graphics mode you'll be using. for simplicity, i'd recommend mode 13h (320x200x8), however, you may have a suitable wrapper / library for other graphics modes.

    as for the increase in car speed, this is fairly easy. in the keyboard input loop, just have an increment specifier which will store the amount to move (in addition to its current speed - could be negative!). With each UP or DOWN arrow keypress, this would increment or decrement by 1. therefore, by holding down these keys, the player could increase the speed of the car. of course, you'll want to implement limits, and RESET the specifier when no key is pressed.

    you need to now go and plan this game - draw up prelim. design sketches and draw up an interface. also make yourself some notes: what features will potentially be included; what resources you'll need. hopefully, this was helpful to you...happy coding...

    Peter Kimberley
    [email protected]

  3. #3
    Registered User
    Join Date
    Oct 2001
    Posts
    11
    pretty hard.......can u explain more about sprite animation ?
    i'm still an amateur in graphics programming, do u know any site or tutorial ?
    Thanks for your help

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    19
    for tutorials and source code on sprite animation and other topics, visit www.gamedev.net.

    sprite animation depends on the graphics library you're using. however, a library is not necessary. you've got to consider the level of detail (you say 'simple'), so you only need one image per blit, instead of an animation sequence, although with a turning car, you'll need at least 4 images based on its direction. you'll most likely want to have more though, and if you're up to it, have a dynamic car-drawing routine based on the angle the front of the car makes with the vertical axis.

    Think of a car moving in a straight line. for each blit (display operation), the X/Y coordinate will increase by delta-X/delta-Y. this will apply to ALL objects in the game screen, as the view will have to shift (although you may choose to display the WHOLE track at once).

    since you're an amateur at gfx programming, i'd suggest you get some more experience before you start making this game, although you may want to still get some ideas down. i'd really recommend you make a fixed-view racing game first, so you don't have to deal with viewport shifting just now.

    what library / API are you using? there're some good OpenGL tutorials at the above link.

    Peter Kimberley
    [email protected]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. i have to write simple car racing game?
    By iskelet in forum Game Programming
    Replies: 1
    Last Post: 04-01-2009, 04:34 PM
  2. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  3. C Programming 2d Array Question
    By jeev2005 in forum C Programming
    Replies: 3
    Last Post: 04-26-2006, 03:18 PM
  4. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 07:41 PM
  5. 2d game ideas
    By BeholderOf in forum Game Programming
    Replies: 5
    Last Post: 10-27-2003, 06:06 PM