Making Mario Kart type of games...what's involved??

Started by
26 comments, last by Oluseyi 22 years, 9 months ago
Hi everyone, I am interested in making a game like F-Zero and Mario Kart, you know, a 2D racer which uses clever scaling techniques to look like it''s 3d just like F-Zero and had a few questions for you to help me on my journey 1) I need a good web-site for that kinda information. Where can I go to? 2) Does anyone have any idea how to represent a 2D 2x2 map of a level in perspective like in mario kart so that as you look at the road ahead it appears to be converging into the centre of the screen (I hope you know what I mean..you know, perspective view) 3) About artificial intelligence and making other racers follow the track. How would YOU go about coding the AI so that CPU racers appear to be racing and following the track but with a few behavioural differences, so they don''t always take the same path as each. 4) Scaling sprites so that they look like the are infront like in the distance like in Mario Kart of F-Zero when vehicles get smaller as they advance into the distance. 5) Designing the level in a 2D editor and then including racing track attributes like bumps and ramps, which make the car jump up abit. How will I give the illusion of a car bumping up on a ramp or bump. 6) How would you suggest I design a level editor so that it''s very easy to make good race tracks 7) If I use a 2x2 matrix to represent the track and level, then how to I get curved roads as the player turns if all level entities will be orthahonal (that''s the first time I am using that would and I am assuming it means that objects are 90 degrees to each other. Correct me if I am wrong please). F-Zero has curved roads which leads me to wonder how their levels are stored. 8) About spacing with all the race entities and collision detection. The track I create in the track editor may have each road segment or racer spaced by 1 block in the map, but when it comes to translating the spacing when it comes to rendering the screen and all racers. That''s about it.... I have never made a trick 3d type game like doom or Wolfenstien and I know the involve raycasting or ''tracing techniques and I am not too sure about them but my game specific ignores walls and trees and rocks I just wanna know how to translate a 3d map into perspective and make it look kinda 3d well the race track anyway. --CELEBRATE GOOD TIMES --------------------------------------------- I just want every to know that I have finished college and am totally happy that I am free !!!!! (Just like MYA Lol) and I am starting unoversity this September doing a Comnputer Science course in graphics and games I am so happy. I have got a whole holiday of 3 months to begin on this new game YEAAAAAAAAAAH !!!! WHO''S BAD ???!!!!!! ---------------------------------------------------------------------- Sorry enough of that... I sure asked a lot of questions but you don''t need to answer then all just as many as u can or u want to. If you have any helpful source code can I have it. If you know of any interesting sites with this kinda game production please can you tell me? Any help is good help !!! Thanks in (Gameboy) advance Dark Star UK
---------------------------------------------You Only Live Once - Don't be afriad to take chances.
Advertisement
Althought I can't help you much, I'll share what I can.

The scaling on F-Zero and Mario Kart used the SNES's mode 7, which had harware support for rotation and scaling, and this is how the backgroungs were created (another few examples would be the flight sequences in the Secret of Mana and it's sequel as wel as Pilotwings and others...).

A simple method I would have thought would be to render the track as a 2D bitmap (in sections or in whole...but that's irrelevent), and then rotate it to the current angle of the player, and then do the perspective effect.

E.g.

abcdefghijklmnopbecomes....(@45 degrees)   a  e b i f cm j g d n k h  o l   pand correct the perspective....(you get the idea...skip more lines from the top half) i f cm j g d n k h   p 


The AI would be fairly easy to make different, just give different racers different attributes, and make them competitive. Usually with these things, less is more.

Bumps etc are easy. Notice how the player's kart usually stays in the exact same spot whilst everything else moves....thats cause the road is background being rotated. So to do a jump, just move the sprite up and down again, whilst keeping them moving. Easy peesy physics.

The level editor is up to you, but just do a standard tile editor if you use the 2D bitmap method. Curves are just drawn curved, the display rotation will deal with everything else.

Sorry it's a bit unclear, but my just my first thoughts on reading your post.

Good luck with your game(s).
I'm off to uni in Sept...so more games programming for me hehe!

Waassaap!!

Edited by - mr_jrt on June 19, 2001 12:16:19 PM
Waassaap!!
why not make it totally 3d? it would be much more straighfoward, look better... yes, it probably would take longer, but it would be worth it for both the experience and you''ll end up with a much nicer game. If you do decide to go 2d... you''re pretty much on your own, welcome to the problem solving part of game programming.
Hey,

Raycasting is the clue I guess.
Find info on free directional planes!

It''s the way wolfenstein and doom ceilings and floors were rendered (probably).

They are also easy to implement and very fast!

Think about spritescaling yourself...It''s not difficult!

Gr,
BoRReL
Here is some old code, 1993 very old , that I wrote for Wacky Wheels (1994). http://www.3drealms.com/wacky/index.html

The final version of the Wacky Wheels rendering code was written
in assembler and used a lot of fixed point math. So this C code
was a very rough test. But on todays machines it should in
theory fly :-) It does work though.

Basically you set up a viewing height using some Trig, have a look at any math book on similar triangles, and for each scan line I interpolated the map positions.

The map is indeed a two dimensional array with bitmap pointers
to the actual graphics. We used 32x32 bitmaps and a 1024x1024 fine coordinate system.

The karts followed various preset vector lines laid down in the
map. We had several racing lines predetermined but the NPC's would take more aggresive lines if they detected you where getting too good.

The bitmap scaling is based on distance. All the karts where 48x48 so we pre interpolated this matrix for several distances and plugged this into the rendering code. Basically take a square root from the players position and divided this
into your scaling array.

This code does not show you how to plot the map as all I
had back then was Modex. That would have cluttered it up.

However the code interpolates accross the fine coordinate
system of the map. I leave it up to you to convert this
into your grid system and get at the pixels within the bitmap and so on.

I tried to clean the code up as best as possible but you should
be able to fill in the gaps.

Set these up somewhere as you seem fit. I used a cos and sin table with 4096 elements for fine angular movement. Note these cos and sin tables are in Radians.

SCREEN_WIDTH = 320
SCREEN_HEIGHT = 200
HALF_SCREEN_WIDTH = SCREEN_WIDTH/2
HALF_SCREEN_HEIGHT_MINUS_ONE = (SCREEN_HEIGHT/2)-1
BOTTOM_Y = 199
TOP_Y = 126
VH = (TOP_Y-BOTTOM_Y)-1
VIEWDIST = 256
NUMDEG = 4096
LEFT_COL_ANGLE = atan(-HALFSCR_WIDTH / VIEWDIST) * (NUMDEG / 6.28)
RIGHT_COL_ANGLE = atan(((SCREEN_WIDTH-1) - HALFSCR_WIDTH) / VIEWDIST) * (NUMDEG / 6.28)
RD_LEFT = cos_table[LEFT_COL_ANGLE];
RD_RIGHT = cos_table[RIGHT_COL_ANGLE];
ONE_OVER_SCREEN_WIDTH = 1.0/(SCREEN_HEIGHT-1)

---------------------------

/* This takes the player_angle and again because it is a lookup table the
player_angle is an integer pointer to the angle table */

void Draw_Map(void)
{

/* add the left angle to the player angle */

rad_angle=player_angle+LEFT_COL_ANGLE;
if(rad_angle>NUMDEG-1) rad_angle-=NUMDEG;
leftsin = sin_table[rad_angle];
leftcos = cos_table[rad_angle];

/* same for the right hand side of the screen

rad_angle = player_angle+RIGHT_COL_ANGLE;
if(rad_angle>NUMDEG-1) rad_angle-=NUMDEG;
rightsin = sin_table[rad_angle];
rightcos = cos_table[rad_angle];

/* loop for the height of your plot window we chose 74 and a viewdist at
256 because it just looked ok */

for(y_screen = BOTTOM_Y; y_screen >= TOP_Y ; y_screen--)
{

/* get the left and right X,Z positions of the map
we chose Z instead of Y because the karts could jump and
stuff. So actually we where treating it as 3D system */

ratio = VH / (y_screen-HALF_SCREEN_HEIGHT_MINUS_ONE);
ratmult = ratio*VIEWDIST;

dist = -(ratmult / RD_LEFT);
x_map_1 = (dist * leftsin) + map_pos_x;
z_map_1 = (dist * leftcos) + map_pos_z;

dist = -(ratmult / RD_RIGHT);
x_map_2 = (dist * rightsin) + map_pos_x;
z_map_2 = (dist * rightcos) + map_pos_z;

dx = (x_map_2 - x_map_1) * ONE_OVER_SCREEN_WIDTH;
dz = (z_map_2 - z_map_1) * ONE_OVER_SCREEN_WIDTH;

xterp = x_map_1;
zterp = z_map_1;

/* xterp and zterp are the actual fine coords of your world
now you would take these positions and work out where
you are in the map and then do the bitmap plot */

for(x = 0 ; x < SCREEN_WIDTH ; x++ )
{
xterp+=dx;
zterp+=dz;
} /* loop x */

} /* loop y */

}

I would suggest using a 3D api these days but you still have to deal with view frustum culling and so on. Oh if only you knew the what it was like back in 1993



Edited by - ancientcoder on June 23, 2001 6:46:07 PM
Honestly, there are a number of cases where doing fake 3D with 2D is a lot tougher than just doing 3D for real. So, this is a great project to try. However, doing your perspective and sprite scaling is a bit tricky. You might consider using a 3D API to help you out, though I''m not saying to make the game 3D itself.

For the landscape, simply texture a large plane--or many planes in a tile orientation--and the API will do the perspective stuff for you. Not only will this make the display very quick, but makes effects such as interpolation and fogging trivally simple.

For your objects, use a technique called billboarding. Your objects will be sprites and you''ll still have to "decide" which sprite to display based on the viewing angle and the object''s orientation. To display them, just texture that sprite onto a quad parallel to the camera at the position you need. You can use gluProject and gluUnProject to convert between screen and world coordinates as necessary.

Let me know what you think, and please keep us updated.
...which brings me to an important point. THERE IS ABSOLUTELY NOTHING WRONG WITH 2D GAMES! 2D or 3D doesn''t intrinsically make a game any more or less enjoyable. It''s the actual game--the gameplay--that makes it good. People, never forget that, eh? Don''t let the artform die; don''t let it keep decaying to the point where only flashiness matters.
I agree. Gameplay,Gameplay and more Gameplay. It is a pity
though that eye candy seems to be the holy grail these
days.

That is why I like the handhelds because of the limited
hardware. But even these will have micro 3D accelerators
in the future so we are all doomed

I got a GameBoy Advanced today and have spent hours on
Super Mario. I must admit the reason I wrote Wacky Wheels
was because when I saw Super Mario Kart on the Super Nintendo
I just said "I have got to learn how to do that game".

Ok I did try to clone it but people kept telling me it
was impossible to do on a 12mhz 386 so I just had to prove
them wrong.






Edited by - ancientcoder on June 23, 2001 8:00:39 PM
Oh man, I''ve played Wacky Wheels many many many many times on my 386sx

Thx for making such a great game!

btw. I''d love to see a real 3D version of that game.. :D


Sorry for going offtopic
Thanks

Wacky Wheels II may happen , watch this space :-)

This topic is closed to new replies.

Advertisement