A Flash Developer Resource Site

Page 1 of 3 123 LastLast
Results 1 to 20 of 49

Thread: Pole Position-style 3D racer

  1. #1
    Senior Member
    Join Date
    Jul 2003
    Posts
    138

    Pole Position-style 3D racer

    I don't know if anyone's written a game like this before in Flash, but here's a very early demo of a Pole Position/Super Hang On-style engine:

    http://ant.simianzombie.com/Road.html (5KB)

    I've only been working on it for a couple of hours, which is why it's so ropey at the moment.

    Cursor keys control horizontal movement; Z is accelerate.

    What do you think? Also, I'd appreciate it if you'd let me know how it performs on your hardware.

  2. #2
    Member
    Join Date
    Aug 2004
    Location
    Europe
    Posts
    44
    nice graphics!

  3. #3
    IT'S GON' RAIN !!! var gotMilk's Avatar
    Join Date
    Apr 2004
    Location
    Yorkshire, England, UK
    Posts
    372
    Running:
    2.6Ghz Celeron
    768MB Ram

    performs with no problem at all.

    If this is what u done in a couple of hours im sure its gonna be great when its done

    I was working on a pole position style game engine but never got round to finishing it.

    Var.

    Professional quality freelance work done by Varstudios
    Visit us here http://www.varstudios.com/services



  4. #4
    Senior Member flashisland's Avatar
    Join Date
    Aug 2003
    Posts
    241
    Wow, I like it! It will be great with sound effects and other cars on the road!

  5. #5
    Custom User Title Incrue's Avatar
    Join Date
    Feb 2004
    Posts
    974
    Why dont you do that mario kart way?

  6. #6
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    Quick update:

    - The car graphic now changes depending on which direction you steer;
    - Parallax works properly;
    - Road generation code tidied up;
    - Road stops when the car is not moving;

    This technique is more akin to the original scanlines/raster trick than the imitation Mode 7 of the Mario Kart engine. Pole Position (or, more accurately, World Grand Prix) was around long before Mario Kart, so using that engine isn't really appropriate.

  7. #7
    Senior Member
    Join Date
    Aug 2001
    Posts
    101
    That engine also runs alot smoother than the Mario Kart one would, great performance on my works old 600mhz laptop.

  8. #8
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    Thanks for checking that, PercyPea - it has quite a few objects on-screen, and I wasn't sure how well it would perform on older hardware.

    Anyhoo, here's another quick update:

    http://ant.simianzombie.com/Road11.html

    This version features simple hills and banked curves, which is taking a little licence with the inspiration, but it's quite effective.

  9. #9
    Senior Member
    Join Date
    Feb 2004
    Location
    Australia
    Posts
    156
    That is awesome, i've never seen anything done like this in flash, only thing similar (that i've seen) is that mariokart engine

  10. #10
    doItLikeThis
    Join Date
    Jan 2004
    Location
    :noitacoL
    Posts
    1,080
    Wow, that latest one is looking even better, great job dude!!!!
    -Aditya

  11. #11
    ihoss.com
    Guest
    Few things:
    *You should add some shadow to the car, as it looks like it is flying sometimes
    *Make the ground change when you drive up/down or in the turns. A cool idea would be a fence or something along the outer curve in the turns

    Apat from that its very impresive

  12. #12
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    Here's another couple of ideas:

    http://ant.simianzombie.com/Road11Floor.html

    (EDIT: There's another version, with a lower-resolution road (for extra speed, as it was starting to get rather slow), a shadow on the car, and a brake (X key) here:

    http://ant.simianzombie.com/Road14Floor.html )

    This version has scrolling, tilting grass. I'm thinking Space Harrier for the next project...

    Originally posted by tonypa
    Runs good, but the perspective is wrong. It doesnt looks like road, more like roller coaster.
    Nice idea... How about this?

    http://ant.simianzombie.com/Road12Sky.html
    Last edited by ant512; 10-13-2004 at 11:39 AM.

  13. #13
    Senior Member
    Join Date
    Jan 2002
    Posts
    213
    How is this done?
    If you don't mind sharing a little of your knowledge.
    It's very good.


    Thanks Howard.

  14. #14
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    It's fairly simple, and quite similar to the Mario Kart approach.

    First of all, create a movieclip with a large image of a slice of road:

    - Big square of green (the grass)
    - Small red square (the curb)
    - Large square of grey (the road)
    - Small square of white (the white stripe)

    Repeat the sequence again in reverse order, and you have a piece of road. Add a few more frames, and copy this piece of road into them. On alternate frames, change the red curb square into a white curb square, and a few frames before the end of the movieclip replace the central white square with a grey square (essentially, remove the white stripe).

    We now have the road. If you plonk this down 100 times onto the stage, and start each clip at a different frame, you'll have an animated road.

    Now all that needs to be done is the perspective trick - make the highest strips of road short and thin, and the lowest strips of road tall and long:

    Code:
                    ---
                   -----
                  -------
                 =========
                ===========
    Presto, one scrolling, raster-inspired road. It's best if you generate the road using code (you're basically creating an x^2-type graph), and it's also best if the strips overlap to improve the appearance of the road.

    To get corners working, you just have to move all of the strips left or right - the top strips move the most, the bottom strips move the least.

    To make the car-generated movement work, move the strips as outline above, but move the bottom strips most and the top strips least.

    Banking the road is simply a matter of rotating each strip to a fraction of the current road curve.

    Creating hills is tricky - it's a combination of moving the road's start point (the horizon), the y position background graphic, the height of the individual strips and the y position of the strips. Having looked through the code just now, I'm not entirely sure how I've done it - there are too many variables and magic numbers flying around in this code. Ah, well. As soon as it's finished, I'm going to GPL the sourcecode anyway.

    Everything else should be fairly obvious.

    In the meantime, here's a version with trackside signs:

    http://ant.simianzombie.com/Road16.html

    (Edit, to avoid spamming the board)

    This one's much faster:

    http://ant.simianzombie.com/Road17.html
    Last edited by ant512; 10-13-2004 at 02:25 PM.

  15. #15
    Senior Member tonypa's Avatar
    Join Date
    Jul 2001
    Location
    Estonia
    Posts
    8,227
    Originally posted by ant512
    It's fairly simple...
    lol, how come it always starts as "fairly simple", but somehow manages to get very tricky before the end

    Still looks great

  16. #16
    Senior Member
    Join Date
    Jan 2002
    Posts
    213
    it very good, thanks for sharing that.
    it's really nice at the scale too.
    have you tried to run that at low quality.
    i runs super fast and looks very retro.

    cheers howard.

  17. #17
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    Another new version:

    http://ant.simianzombie.com/Road19.html

    The changes are:

    - Roadsigns' Y position adjusts according to road tilt;
    - Car handling tidied up;
    - Other cars on the road.

  18. #18
    leight.com.au leight's Avatar
    Join Date
    Sep 2002
    Location
    australia
    Posts
    1,437
    I think its a pretty good engine! However there is something that I dislike. The world rotates, however the background doesn't.

    Nice engine though

    ps: the miniMap is wrong.

  19. #19
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    Originally posted by leight
    I think its a pretty good engine! However there is something that I dislike. The world rotates, however the background doesn't.
    Yeah, you're right. Originally, just the road tilted; I then tried making everything tilt, but it works best with just the grass and the road tilting. Imagine that the road is on an embankment - the road and the ground it's on will tilt, but the mountains in the distance will stay level.

    Nice engine though

    ps: the miniMap is wrong.
    The map is currently just a bitmap grabbed from World Grand Prix (an old Sega Master System game) - I haven't written that bit yet.

  20. #20
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    Okay, nearly done now...

    http://ant.simianzombie.com/Road23.html

    New in this version:

    - Working collision detection between cars and roadside objects (it isn't fantastically accurate, but it does the job);
    - Car position altered to stop it seeming to "float" (it was actually floating around the track before this change);
    - Objects not supposed to be on-screen aren't visible any more;
    - Hastily bodged-together speedometer and time display (appearance and accuracy to be improved);
    - Some other changes that I can't remember right now.

    All that's left to do is improve the appearance of the two numeric readouts and create an interesting track. Then I think I'll move on to something else and GPL this thing (but it is a mess behind the scenes...).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center