A Flash Developer Resource Site

Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 49

Thread: Pole Position-style 3D racer

  1. #21
    Senior Member
    Join Date
    Jan 2002
    Posts
    213
    one more quick question

    what equation do you use to work out the scale of the road strips. i get this unpleasing curve .

    thanks howard

  2. #22
    ********* mentuat's Avatar
    Join Date
    Mar 2002
    Location
    out of office
    Posts
    718
    this looks ace! just needs to stop the car from disappearing off the bottom of the screen on those high banked corners

  3. #23
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    Originally posted by howard54321
    what equation do you use to work out the scale of the road strips. i get this unpleasing curve .
    This is a chunk of road-generating code:

    Code:
    var roadbits = 70;  // Number of strips
    var roadCentreY = 128;  // Position of screen centre
    var roadCentreX = 160;  // Position of screen centre
    var roadAngle = 0;  // Road curve
    
    // Loop through all strips
    for (var i = 0; i < roadbits; i++) {
    
    	// Attach road strip
    	_root.attachMovie('road', 'road_' + i, i);
    
    	// Create pointer to strip
    	obj = eval('_root.road_' + i);
    
    	// Set strip position
    	obj._x = roadCentreX;
    	obj._y = roadCentreY + ((i * i) / 27);  // x^2 with a random constant
    
    	// Set strip scaling
    	obj._xscale = (5 + (obj._y - roadCentreY)) / 1.4;  // Width of each strip is a function of its Y position with more random constants
    
    	// Set Y scaling of strips
    	if (i > 0) {
    		// Not first strip, so set scale based on previous strip
    		obj2 = eval('_root.road_' + (i - 1));  // Get pointer to previous strip
    		obj._yscale = (obj2._yscale + 0.8);  // Set Y scaling
    	} else {
    		// Set first strip scaling
    		obj._yscale = 0.8;
    	}
    
    // Set strip's starting frame
    	obj.gotoAndPlay(GetStartFrame(obj, roadbits - i));
    }
    As I said, there are a lot of magic numbers floating around in this code. This piece of code sets the initial values; during the game itself, the X and Y co-ordinates are set with these two lines:

    Code:
    // Position road horizontally
    obj._x = roadCentreX + (((roadAngle / 2) * (roadbits - i)) / 12) - ((trackX * i * i) / 1000);
    	
    // Position road vertically
    obj._y = roadCentreY + ((i * i) / 30) - (i * hillHeight);
    Where trackX is the offset of the entire road, and hillHeight is the current elevation of the hill.
    Last edited by ant512; 10-14-2004 at 05:08 PM.

  4. #24
    Member
    Join Date
    Nov 2003
    Location
    LA, US
    Posts
    65

    Very nice.

    I think it's great. Only a few suggestions I would make.

    1- have the shine on the wheels move a little rapidly to simulate turning (see old retro racers)

    2- have the car explode when it hits a sign and / or car

    3- use the Three lights system with tones for the starting whistle

    4- use the more generic "SPACE BAR" to accelerate.

    5- Add brakes.

  5. #25
    Senior Member TeroLebe's Avatar
    Join Date
    Mar 2003
    Location
    Lahti, Finland
    Posts
    302

    Re: Very nice.

    Originally posted by Arne The Turtle

    4- use the more generic "SPACE BAR" to accelerate.
    You mean "UP"-key to accelerate...

  6. #26
    Senior Member FLASHPULSE's Avatar
    Join Date
    Nov 2002
    Location
    USA
    Posts
    1,335
    WOW! The best racing engine for flash that I've ever seen. Nice work!

  7. #27
    When you know are. Son of Bryce's Avatar
    Join Date
    Aug 2002
    Location
    Los Angeles
    Posts
    839
    Nice work ant. My only complaint about the latest version is the tilting effect. I think the angle is a bit extreme as it is now, you should tune it down a bit if you haven't planned to do so already. I believe someone (me ) is liable to get motion sick playing it as it is.

  8. #28
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    Originally posted by Son of Bryce
    My only complaint about the latest version is the tilting effect. I think the angle is a bit extreme as it is now, you should tune it down a bit if you haven't planned to do so already.
    I intend to change the layout of the track to remove the more extreme corners - the whole thing is just one large multi-dimensional array, so that's quite easy. The tilt is so large at the moment purely for testing purposes. In fact, I might alter it so that the tilt and the angle of the road are independent.


    Originally posted by Son of Bryce
    1- have the shine on the wheels move a little rapidly to simulate turning (see old retro racers)

    2- have the car explode when it hits a sign and / or car

    3- use the Three lights system with tones for the starting whistle

    4- use the more generic "SPACE BAR" to accelerate.

    5- Add brakes.
    1- I've been meaning to do this, but haven't got around to it yet;

    2- Thought about adding that in, World Grand Prix-style, but the way your car exploded always annoyed me. I've gone for the Lotus 2 approach instead;

    3- I've been meaning to do this too, but I might not actually put it in;

    4- Good idea;

    5- Brakes are currently the X key. Any suggestions which key I should use, assuming that Space is now accelerate?

  9. #29
    Senior Member St. Nick's Avatar
    Join Date
    Sep 2003
    Location
    Ontario, Canada
    Posts
    312
    How about UP for accelerate and DOWN for brakes? Then you only have to use one hand...

    Love this game btw. I know some people didn't like the tilt but I loved it! I hope you keep it in It made the game more exciting.
    - St. Nick

  10. #30
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    Got around to adding some more to this, so here's the latest update:

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

    Updates are:
    - Enemy cars now point in correct direction, finally;
    - Gradient on road;
    - Gradient on sky;
    - Road speed calculated using a different method;
    - Speedometer works properly;
    - Speed indicator bar works properly;
    - Timer works properly;
    - World Grand Prix HUD bitmap removed;
    - Some bugfixes.

    Please let me know how this version performs on your hardware - I have a feeling that the gradient on the road might kill the performance on some machines.

  11. #31
    Heli Attack! iopred's Avatar
    Join Date
    Jun 2003
    Location
    Sydney, Australia
    Posts
    923
    Killer sweet, looks awesome.

    Few things I would change... background rotating.. once you notice it, it really bugs you.

    also, the rotating of the world should be decided by your speed.. if you stop on a curve, the world stays turned..

    But overall, this thing is awesome!!!!!!!!

  12. #32
    Script kiddie VENGEANCE MX's Avatar
    Join Date
    Jun 2004
    Location
    England
    Posts
    2,590
    I'm on a 450 Mhz G3 Mac, and the first file shown runs AMAZINGLY on my computer. Considering this is about as slowly as anyone here can experience the game, I'd have to say that's one freaking fast game you have there. Well done.
    http://www.birchlabs.co.uk/
    You know you want to.

  13. #33
    Member
    Join Date
    Nov 2003
    Location
    LA, US
    Posts
    65

    On keyboard controls....

    Well, short of having a configuration menu, I'd suggest the following:

    Left,J - Turn left
    Right,L - Turn Right

    Up, Space, A, I - Accelerate
    Down, CTRL, Z, K - Brakes

    Enter, ESC, Pause - Pause/Menu

    Current Project: Mighty Sink Adventure

  14. #34
    Custom User Title Incrue's Avatar
    Join Date
    Feb 2004
    Posts
    974
    Yeah, its fast, but seems to me that is not real curves, at least not so real like those at that mario kart stuff, they look like simulation of curves, isnt it?

  15. #35
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    Originally posted by Increu
    Yeah, its fast, but seems to me that is not real curves, at least not so real like those at that mario kart stuff, they look like simulation of curves, isnt it?
    Umm... Well, no, they're not real curves. They're computer-generated lines designed to look like curves.

    On the control front, I've gone with cursor control (up, down, left and right), plus Z and X as extra accelerate and brake keys. This means everyone can play it, regardless of keyboard layout, using one hand, and I can use my favourite emulator setup.

    The next version will have sound, if I can figure out a way of generating enough engine samples without increasing the filesize too much. All sounds are, of course, pinched from the Amiga version of Lotus Turbo Challenge 2.

  16. #36
    Untitled-1.fla strille's Avatar
    Join Date
    Mar 2001
    Location
    Sweden
    Posts
    1,626
    Very nice work you have there!

    In some ways I like the very first test you posted best, because a) it runs super smooth, b) it is most "retro" and c) the road does not tilt. The latest version looks better, but the tilting of the road does not feel right somehow.

  17. #37
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    Originally posted by strille
    Very nice work you have there!

    In some ways I like the very first test you posted best, because a) it runs super smooth, b) it is most "retro" and c) the road does not tilt. The latest version looks better, but the tilting of the road does not feel right somehow.
    The tilting thing does seem to have divided people. My current plan is to back-port all of the important changes to the original version, omitting the tilting and hills. This way I'll have the nice-looking and unusual latest version, the very retro original version, and the Sky Racer version.

  18. #38
    the thud of the body rabbitkiller's Avatar
    Join Date
    Jan 2004
    Location
    Royal Oak, Mi
    Posts
    318
    Looks good, but I'll agree with tonypa about perspective, cause it looks unnatural. And I'm against tilting as well...
    world[i] = new world();

  19. #39
    Senior Member
    Join Date
    Jul 2003
    Posts
    138
    This is the updated retro version:

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

    It uses the graphics from the first version, and does not have tilting or hills. Everything else has been updated to match the latest version of the main codebase.

    Other updates include:

    - Basic samples added (these will change, as I've got the wrong ones from Lotus 2; also, the engine noise doesn't work properly yet - I might just remove it entirely)
    - Some optimisation;
    - Enemy cars appear more frequently.

    This version runs much, much faster than the main codebase, as it doesn't have any pesky angles to calculate, has fewer objects on-screen at once, and is generally simpler.

  20. #40
    MSpeed
    Join Date
    Sep 2004
    Location
    New Zealand
    Posts
    37
    nice game

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