A Flash Developer Resource Site

Page 2 of 21 FirstFirst 12345612 ... LastLast
Results 21 to 40 of 407

Thread: MarioKart style flash engine

  1. #21
    Senior Member
    Join Date
    Jan 2001
    Posts
    120
    Can't you guys just look it up somewhere.

    It's been over 10 years since this was done, so any beginner programmer already knows exactly how Mario Kart and Top Gear were done.

    There are tons of tutorials/resources about game making.
    Just because those are for console games makes no difference. Simply translate it to action script.

    Besides don't we already have a Flash Kart and a couple of other 3D racing games which look better than this ( I like the engine, but looks like a pixel mess )

  2. #22
    2KHeroes / Sylvaniah designer luxregina's Avatar
    Join Date
    Jul 2001
    Location
    Somewhere between Kirlundin and Anskaven
    Posts
    1,273
    Originally posted by ClydeTheGlyde
    Can't you guys just look it up somewhere.

    It's been over 10 years since this was done, so any beginner programmer already knows exactly how Mario Kart and Top Gear were done.
    Right, but devlopped on systems that allowed much more controle on the graphic routines than Flash...
    The principle of raycasting ( or however you call it, i can't figure out a proper name ) that he use is quite new in Flash, and truly open some really interesting possibilities ... I've also seen an open source "doom like" for Flash on the board based on exactly the same system( quite amazing but processor intensive )
    The point is not what his engine shows, but the gaming possibilities it opens
    There are tons of tutorials/resources about game making.
    Just because those are for console games makes no difference. Simply translate it to action script.
    Yes, but most of the time you just realize that you are cruelly missing graphic functions ...
    Besides don't we already have a Flash Kart and a couple of other 3D racing games which look better than this ( I like the engine, but looks like a pixel mess ) [/B]
    Right, game-wise speaking, it is not a game yet, but it brings a fresh perspective on how to make a different Flash Kart ... and i guess that with proper graphic treatment, intelligent gameplay and good coding, it can bring us a Flash Kart that won't look like it had been done in Flash ...

    Just to say that i like the engine ...

  3. #23
    Senior Member
    Join Date
    Aug 2001
    Posts
    101

    source

    'oo, instance names were wrong, edited...'

    very good mr strille. I've pasted the code from the first engine I did (its been optimised a bit since, theres no car, just ground scaling)

    To get it working, simply copy the code into the first frame.
    Then you need two movie clips, the first is easy, and is the mask section. Just draw a horizontal box (no outline) that stretches across the length of ur screen, and make it a couple of pixels tall. (the code changes its height so doesnt matter the exact size, i used 3 pixels though). Make the mask into a movieclip called 'mask', align it so its reference point is at the top left corner.

    Now you need your ground texture. Import your bitmap texture, mine was 1000x1000 pixels, if u using lower res, just stretch it on the screen to approx 1000x1000.

    With all the reference points for movieclips below, make em centered.

    Then follow this exactly
    Select the image, F8 it (make it a movieclip symbol), call it 'movepic' and give it an instance name of 'move'. (Instance name is the important one here.

    Now select your new 'movepic' movieclip, F8 it again, call it 'thepic' and give it an instance name 'pic'. 'pic' being the important thing again

    Finally, select the 'thepic' movie clip again, and F8 it, call it 'pic', dont worry bout instance name.

    Right, now that you have both ur mask and image inside several depths of movie clips. delete them from the stage, and in the library, right click on both the pic and mask (one at a time) and go to linkage and tick the 'export in actionscript' thingeee. Use the default names of 'pic' and 'mask'.

    adjust the ms value in the code to increase or decrease the quality. 1 being the best quality, but very slow, 3 being reccomended, and any higher faster, but poorer quality

    If you want to adjust where the land actually turns around (rotation point) edit the 'pic' movieclip and just nudge up 'thepic' 10 or so pixels.

    any questions, post here. Any examples of what you've done with it, also post here

    Code:
    _quality = "LOW";
    ms=3
    //attaches ground and mask
    // ms is set as the value u type in at the start.
    for (a=1; a<=(180/ms); a++) {
    	//grd = ground, mask = the mask movieclip
    	grd = attachMovie("pic", "pic"+a, a*3+1);
    	grd.pic._xscale = grd.pic._yscale=100;
    	grd._x = 275;
    	grd._y = 400;
    	//the ground is scaled only once, when created. not on every frame
    	grd._xscale = a*ms*10
    	grd._yscale = a*ms*10;
    	/// the below code happens on every frame for each bit of the ground.
    	grd.onEnterFrame = function() {
    		//the pic is rotated, but the 'move' symbol inside the pic is what is moved.
    		this.pic._rotation = _root.rotation;
    		this.pic.move._y += _root.cosness;
    		this.pic.move._x += _root.sinness;
    	};
    	mask = attachMovie("mask", "mask"+a, a*3+2);
    	mask._height = ms;
    	mask._y = 200+a*ms;
    	grd.setMask(mask);
    }
    //movement ripped from an earlier version of my GTA engine
    onEnterFrame = function () {
    	if (Key.isDown(39)) {
    		_root.rotation = _root.rotation-5;
    	}
    	if (Key.isDown(37)) {
    		_root.rotation = _root.rotation+5;
    	}
    	if (Key.isDown(38) and _root.speed<=20) {
    		_root.speed = _root.speed+0.6;
    	}
    	if (Key.isDown(40)) {
    		_root.speed = _root.speed-0.4;
    	}
    	if (_root.speed>0.2) {
    		_root.speed = _root.speed-0.2;
    	} else {
    		if (Key.isDown(40)) {
    			// _root.speed = _root.speed-0.4;
    		} else {
    			if (_root.speed<-0.2) {
    				_root.speed = _root.speed+0.2;
    			} else {
    				_root.speed = 0;
    			}
    		}
    	}
    	// calculate cos and sin for roads rotation just once every frame rather than in each
    	// road movieclip.
    	_root.cosness = _root.speed*Math.cos(_root.rotation*Math.PI/180)/2;
    	_root.sinness = _root.speed*Math.sin(_root.rotation*Math.PI/180)/2;
    };
    Last edited by PercyPea; 06-24-2003 at 05:21 AM.

  4. #24
    Senior Member mbenney's Avatar
    Join Date
    Mar 2001
    Posts
    2,744
    omg, thats so simple its frightening... when i first looked at it i thought it cant possibly be raytraced... simply because of the speed it runs at. Im doing final exams at the moment, but i cant wait to get home and try this out =)

    [m]

  5. #25
    Senior citizen
    Join Date
    Jul 2000
    Location
    Denmark
    Posts
    94

    Re: hills??

    Originally posted by PercyPea
    I've just discovered a technique that might mean I can create a landscape with hills and stuff, instead of a flat plain
    http://www.pargames.co.uk/mariokart5.html
    PercyPea, that simply looks amazing..great job!
    I am looking forward to see your additions to this engine.

  6. #26
    2KHeroes / Sylvaniah designer luxregina's Avatar
    Join Date
    Jul 2001
    Location
    Somewhere between Kirlundin and Anskaven
    Posts
    1,273
    I've tried it : it's limpid !!!

    (the tries are just not "showable" though !!!)

    a question : for the hittests ( grass, and future obstacles, i guess ) would replicating the map on a top view and having the test on that map be the way to go ? (then you can spawn also each component on the 3D view)

  7. #27
    Senior Member
    Join Date
    Aug 2001
    Posts
    101
    a question : for the hittests ( grass, and future obstacles, i guess ) would replicating the map on a top view and having the test on that map be the way to go ? (then you can spawn also each component on the 3D view)
    I guess that would work if you had an accurate method of translating the cars position in the '3d' world to a 2d top down map.

    The way I did it was in the 10th mask section from the bottom, attach a low curve count vector image of the track, with the road cut out, and where the grass is, just solid black.

    then using 'hitarea.hitTest(kart._x, kart._y, true)' thingee, determined if the car was on the grass or not.

    You dont need to replicated the 'hitarea' movie clip in each of the mask sections, just the one that the car sits on.

    You could then put other objects in there aswell, like walls and stuff.

    That wont work with opponent racers though, as presumably they'd be ahead or behind you, and therefore not on the same _y position as the 10th mask.

  8. #28
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    if you take the x/y and rotation values of the last "move" clip and transfer them to an mc within the graphic then you have the cars position within the scene.
    i had to flip the values for some reason.
    notice that i changed the code a bit to use a for loop to update the "move" clips. it makes it a bit easier to get at the values.
    This also provides a great opportunity to use the macromedia flash samauri method to position objects within the scene because you can use these values to map a camera position.
    http://www.macromedia.com/devnet/mx/...murai_ch2.html
    sorry about my poor road map but here's the example;
    http://www.nlc.net.au/~oceana/games/rc.htm
    http://www.nlc.net.au/~oceana/games/rc.zip
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

  9. #29
    Senior Member
    Join Date
    Aug 2001
    Posts
    101
    very nice!

  10. #30
    Untitled-1.fla strille's Avatar
    Join Date
    Mar 2001
    Location
    Sweden
    Posts
    1,626
    PercyPea, thanks for posting the code! Maybe I'll play around with it later... I have a feeling we will see many games in the near future on this board using this method

    Just to clarify: this method is not raycasting, since we don't actually cast any rays... I think it's called "constant z mapping" or something similar and it is the same method used to render floor/ceiling in old games like Doom (and yes, MarioKart...).

  11. #31
    All the good ones were taken JR_Ewing's Avatar
    Join Date
    Aug 2001
    Location
    Stockholm
    Posts
    117
    I don't know programing that well so I'll just say great game! Can't wait to play the endresult.

  12. #32
    Who needs pants? hooligan2001's Avatar
    Join Date
    Apr 2001
    Location
    Somewhere
    Posts
    1,976
    nice and simple. i like it. I was going about it using tiles man was i wrong.

  13. #33
    Sonic the FlashHog geoffp08's Avatar
    Join Date
    May 2002
    Location
    Orlando
    Posts
    237
    I consider myself to linger amongst the lower eschelons of the intermediate AS ranks, and brand new to the concept of flash game coding... so to how much validity you want to offer my response is entirely up to you... four words:
    Bee Yoou Teee Full

    ~peace~
    Moving at the speed of Flash

  14. #34
    Illuminatus! fospher.com's Avatar
    Join Date
    Jan 2002
    Location
    5th Dimension
    Posts
    2,185
    Wow man...this is a step beyond blinco's flashKart. If you can achieve implementing those hills - and put some AI in there - that would be one badass game. It would sell for quite a hefty price to

  15. #35
    Senior Member
    Join Date
    Aug 2001
    Posts
    101
    after todays experiments, i think hills will be a no no

  16. #36
    Didn't do it. japangreg's Avatar
    Join Date
    Mar 2001
    Location
    \o/ |o| |o_ /o\
    Posts
    784
    I try to stay away from posting in the games forum if I can't offer help/constructive criticism, but I'm making an exception for this.

    That is dang beautiful. That's all I can say.

    This is the second project recently that has really sparked my imagination (the other being RipX's rumor engine) Keep up the good work!

    ps- Fospher, you really need to post 7 more times today. Then you'll have a really 1337 post count... =^_^=
    Hush child. japangreg can do what he wants. - PAlexC
    That was Zen - this is Tao.

  17. #37
    Untitled-1.fla strille's Avatar
    Join Date
    Mar 2001
    Location
    Sweden
    Posts
    1,626
    PercyPea, I've played around with the engine a bit, and I think I have an idea how you can improve the quality a bit without making it slower... Any chance you can donate the image you use? My image looks like crap

  18. #38
    Untitled-1.fla strille's Avatar
    Join Date
    Mar 2001
    Location
    Sweden
    Posts
    1,626
    I've made a version which can be found here:

    http://hem.passagen.se/strille/works...z_mapping.html

    I've added "leaning" when you turn. And a sky. Also, you can set upper and lower strip size, because you probably want smaller strips nearer the horizon to give you some more detail. Try and set both top strip size and bottom strip size to 3. This results in approx. 70 strips in total. Then set top to 1 and bottom to 5. You'll get more detail, but the strip count is pretty much the same.

  19. #39
    Senior Member Kirill M.'s Avatar
    Join Date
    May 2002
    Location
    Toronto, Canada
    Posts
    711
    Nice one, strille. How about making the Up/Down buttons change the ground scale and the strip sizes, so that it looks like a flight simulator. It would have to always move though, unless you make different buttons to fly up and down.

  20. #40
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    i can't download the fla! mabey try later
    btw: this is awesome, it really flys 10+ fps on my crapola pc. if it's ok i'll try and put in some trees and stuff later.
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

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