Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - 3D & Sim Racing Games

Reply to topic
Author Message
Chris
  • Guest
Reply with quote
3D & Sim Racing Games
Post Posted: Wed Aug 11, 1999 12:20 am
This is something that has been seriously been puzzling me forever. How do people make 3D sprite
games like Space Harrier and Aftburner or even a simple racing game like Pole Position or
Outrun? Take a game like Aftburner. How does it know when and when not to bombard you
with a wave of attacks from the enemy fighters? How does the missle know what to seek and
when to seek it? How does it know when it has hit an enemy fighter? How do the missles
and weapons from the enemy fighters know when it has collided with you? How does the game
know when it's the end of the level or not? Does it use some kind of timer for all this?

On to simpler games, Pole Position for example. How does it know when to display a billboard?
How does the speed of the car control the speed at which the sprites are enlarged and at what
rate? Where do the cars come from? Are they just random or something? Is there some kind
of random timer that decides as you're slowly speeding past the car that the other car should
switch lanes and make you crash? How does the game keep track of what position of the
track you're on? How does the game know when you should encounter a left or right turn
and how does it know what kind of turn signals should be posted on the side of the track?
Now, here's the biggie. How does the game know which way it should display it's track?
For example, a small, medium, or sharp left or right curve.

I know this is a lot of questions but I need a big explination on this stuff. I would love to write
a Space Harrier or an Aftburner type game anyday.

Chris :o)
 
  • Joined: 24 Jun 1999
  • Posts: 1732
  • Location: Paris, France
Reply with quote
Post Posted: Wed Aug 11, 1999 6:49 am
Weren't you supposed to write a Tetris clone this week, to learn a bit about programming?
Your questions doesn't have answers. It's up to the programmer to do anything he want.
  View user's profile Send private message Visit poster's website
Nyef
  • Guest
Reply with quote
If you really want to know...
Post Posted: Wed Aug 11, 1999 1:29 pm
Why not disassemble the ROM and figure it out from that? It's a great way of truly appreciating how good those coders really were, and it's fun, too. :-)

--Nyef
 
Chris
  • Guest
Reply with quote
Tetris Clone
Post Posted: Wed Aug 11, 1999 2:59 pm
I can't write no damn tetris game and I refuse to because their a dime a dozen in the world. If I play
that shit again I'm going to gag and vomit, probably! I mean, that game is absoultely, totally played
out. I think that game has been played more times than even the mighty pong! Here's a list of
the most played out games in history:

Tetris
Pong
Space Invaders
Pacman
Super Mario Bros.

I don't want to spend countlesss hours coding something that's totally undesirable, especially if it's
something personal and I'm not being payed for it. And, at least if I code a game clone I want it
to be something that very few or even none at all have attempted to do:

Donkey Kong Jr.
Galaga (Except for Champ Galagoon)
Mario Bros.
Shinobi
Rush 'n Attack a.k.a. Green Beret
Super Cobra
Circus Charlie
Blaster Master
Kung Fu Master
Goemon

At least these games are something different and are more in depth then Tetris. Those are some examples
but some games I really want to code everything on that list except for Mario Bros. Rush 'n Attack,
Super Cobra, and Circus Charlie.

Besides, Zoop. I told you, well I can't remember whether it was you or unfuckinbelieveable, but anyway
I said that I was going back to school soon. Hell, I'm going back tomorrow. I've gotta devote my time
and life to that again, except in a more serious matter or I won't have a future. My GPA is low because
I've been goofing off with this emulation shit. I need to pull it back up, if not higher, so I can get into
some kind of college. And, even if I didn't have to go back to school there's so much I have to complete
before I even start the project. I need to write my own re-usable graphics, keyboard, joystick, and
sound routines. I also need to write and complete my SP1 sprite editor so I'll have a less known, or
at least hackable, image format to work with. It will be fun as well as rewarding to learn something
new and not just jump on the bandwagon.

On the bright side at this new school I get to take two new courses that my old school didn't provide;
computer programming I and Piano I. At least I get to spend 45 minutes doing the shit I enjoy. I know
I'll get A's in those classes, especially comp. programming I.

Chris :o)
 
Eric
  • Guest
Reply with quote
Post Posted: Wed Aug 11, 1999 6:39 pm
I will now reveal to all of you the key to all computer programming (including game programming):

Data Structures.
(I'm not really this arrogant. Just having fun.)

Yes, data structures. Typically data structure courses are offered immediately after specific language courses in Computer Science curricula.

All of Chris's questions can be answered by studying data structures: queues, stacks, trees, hash tables, graphs, etc Chris, grab yourself a data structures book, preferrably one that examines data structures in your desired language (C, I believe) and get reading. You should find the answers you're looking for.

Have fun.

Eric
 
Chris
  • Guest
Reply with quote
Data Structure
Post Posted: Wed Aug 11, 1999 8:42 pm
A data structure is nothing more than a table that organizes and references you're variables. How can
that help me? Actually, you just gave me a brain storm idea! I see now! I envision C++ objects!
Classes are what their called. But, I don't understand this. Why is it that you can create objects
from a parent object but you can't indirectly control all the other objects from the parent object?
For instance, you make a class called fighter. Fighter contains a punch function, a kick function,
a crouch function, etc. Now, when the game starts you create 8 objects from the class (the
individual fighters). As the game is playing when the user hits the punch buttion you call the
punch function and the animation and logic for a punch is done, right? That fine if you
only choose 1 fighter but if can only access 1 fighter at a time that means you have to type
in the exact same interpretive code for all 8 fighters which is a total waste of typing and
programming. Why won't C++ just let me deal with the main Fighter structure and somehow
the other objects oblige and do what's needed? It's a more clear example:

switch(casey){
case joy_button_1:
casey.punch();
break;
case joy_button_2:
casey.kick();
break;
}

switch(steve){
case joy_button_1:
steve.punch();
break;
case joy_button_2:
steve.kick();
break;
}

switch(sarah){
case joy_button_1:
sarah.punch();
break;
case joy_button_2:
sarah.kick();
break;
}

Instead of having to re-type the same shit for all 8 fighters, why can't C++ do something like this?

switch(fighter){
case joy_button_1:
fighter.punch();
break;
case joy_button_2:
fighter.kick();
break;
}

And with that statement above all 8 fighters will perform the proper punch and kick methods? But even
if you weren't making a fighting game, this would be very useful for a GUI type of program. Instead of
having to interpret every single window, the properties in the window, the menu clicks, etc. why not
just have 3 main classes and have like 30 objects that follow the instructions written for the main
function?

Chris :o)
 
Eric
  • Guest
Reply with quote
Re: Data Structure
Post Posted: Wed Aug 11, 1999 10:29 pm
Quote
> A data structure is nothing more than a table that organizes and references you're variables. How can
> that help me?

Not true. Data structures are much more than simply tables. There's simply no way to explain data structure to you in this forum. I suggest finding a book on the subject.

Quote
> Actually, you just gave me a brain storm idea! I see now! I envision C++ objects!
> Classes are what their called.

Objects are instances (i.e., real data/code in computer memory) of classes (source-code definition of abstract idea.)

Quote
> But, I don't understand this. Why is it that you can create objects
> from a parent object but you can't indirectly control all the other objects from the parent object?

Well, technically what you said is untrue. You create derived classes from parent classes, there's no such thing as "parent" or "child" objects. Each object is it's own entity. They are all completely independent of each other. Really, that's the point, to package data and code into an autonomous unit.

Quote
> For instance, you make a class called fighter. Fighter contains a punch function, a kick function,
> a crouch function, etc. Now, when the game starts you create 8 objects from the class (the
> individual fighters). As the game is playing when the user hits the punch buttion you call the
> punch function and the animation and logic for a punch is done, right?

This is fine so far.

Quote
> That fine if you
> only choose 1 fighter but if can only access 1 fighter at a time that means you have to type
> in the exact same interpretive code for all 8 fighters which is a total waste of typing and
> programming. Why won't C++ just let me deal with the main Fighter structure and somehow
> the other objects oblige and do what's needed? It's a more clear example:

> switch(casey){
> case joy_button_1:
> casey.punch();
> break;
> case joy_button_2:
> casey.kick();
> break;
> }

> switch(steve){
> case joy_button_1:
> steve.punch();
> break;
> case joy_button_2:
> steve.kick();
> break;
> }

> switch(sarah){
> case joy_button_1:
> sarah.punch();
> break;
> case joy_button_2:
> sarah.kick();
> break;
> }

> Instead of having to re-type the same shit for all 8 fighters, why can't C++ do something like this?

> switch(fighter){
> case joy_button_1:
> fighter.punch();
> break;
> case joy_button_2:
> fighter.kick();
> break;
> }

> And with that statement above all 8 fighters will perform the proper punch and kick methods?

I'm afraid your switch statements above don't make much sense. You can't use a switch with an object. I'm afraid I don't understand.

Maybe this will help though:

//Fighter class defined in another file.

Fighter *Player_1; // Player_1 is a pointer to a Fighter object.
Fighter *Player_2; // Plyaer_2 is a pointer to a Fighter ojbect.

// Declare three different Fighter objects, and specify their gender.
Fighter Casey(Male);
Fighter Steve(Male);
Fighter Sarah(Female);

// Each player selects a fighter. The Fighter objects are Casey, Steve, or Sarah.
// For now, force Player_1 to be Casey
Player_1 = &Casey;

// For now, force Player_2 to be Sarah
Player_2 = &Sarah;


// Assuming that "command" was parsed from user input and converted to an integer representing a unique
// action to be performed.
switch(command)
{
case Button_1A: Player_1->Punch();
break;

case Button_1B: Player_1->Kick();
break;

case Button_2A: Player_2->Punch();
break;

case Button_2B: Player_2->Kick();
break;
};

//END

Now, simply pointing Player_1 or Player_2 to a different Figher object will result in the Punch or Kick member function being called for the desired fighter.

Get familiar with C++ inheritance and polymorphism. I think you'll find the answers to your questions.

In general, there's no way for one object to control another unless the second object is a member of the first.

Hope this helps.

Eric
 
  • Joined: 24 Jun 1999
  • Posts: 1732
  • Location: Paris, France
Reply with quote
Re: Data Structure
Post Posted: Wed Aug 11, 1999 10:32 pm
Quote
> Instead of having to re-type the same shit for all 8 fighters, why can't C++ do something like this?
> switch(fighter){
> case joy_button_1:
> fighter.punch();
> break;
> case joy_button_2:
> fighter.kick();
> break;
> }

Instead of having to use a complicated case structure and obscure object oriented programming, why don't you use some simple C code:

i = Process_Input (current_key_pressed);
Fighters[current_fighter]->Actions[i] ();

Where "Fighters" is a table of pointer to fighters structures, which contains themselves a dynamic table to function pointers, which could be orderer the same way for all fighters, like:

ONE_ACTION_TYPE *Actions_List[]
{
Punch, Kick, NULL
}

for (j=0; Actions_List[j]; j ++)
{
Fighters[n_fighter]->Actions = j ? realloc (Fighters[n_fighter]->Actions, (j + 1) * sizeof (ONE_ACTION_TYPE *)) : malloc (sizeof (ONE_ACTION_TYPE *));
Fighters[n_fighter]->Actions[j] = Actions_List [j];
}

That would be the way I would do it.
Any other suggestions?
  View user's profile Send private message Visit poster's website
  • Joined: 29 Jun 1999
  • Posts: 68
  • Location: Houston TX
Reply with quote
Re: If you really want to know...
Post Posted: Thu Aug 12, 1999 1:26 am
Quote
> Why not disassemble the ROM and figure it out from that? It's a great way of truly appreciating how good those coders really were, and it's fun, too. :-)

I learn something new every time I disassemble a rom (in addition to what I set out to learn).
  View user's profile Send private message Visit poster's website
Chris
  • Guest
Reply with quote
Beautiful!!
Post Posted: Thu Aug 12, 1999 2:54 am
Man, you're amazing! Just set the address of a character to Player 1 and everything will naturally come
together! How do you come up with this stuff? You don't understand how smart that is! It's simple
and it makes a whole lot of sense to me, more than what Zoop said.

Oh yeah, so you say that you cannot control another object unless the object is contained inside
another object? Hum...Interesting. I guess you're right. If I study data structures everything will
naturally come together. Thanks!

Chris :o))
 
Chris
  • Guest
Reply with quote
What!!??
Post Posted: Thu Aug 12, 1999 3:09 am
Quote
> Instead of having to use a complicated case structure and obscure object oriented programming, why don't you use some simple C code:

> i = Process_Input (current_key_pressed);
> Fighters[current_fighter]->Actions[i] ();

> Where "Fighters" is a table of pointer to fighters structures, which contains themselves a dynamic table to function pointers, which could be orderer the same way for all fighters, like:

What the heck is all that? Why would you need...Ahh, nevermind. I'm completely lost. I'm a newbie,
remember? Could you explain that in a different way or something?

Quote
> ONE_ACTION_TYPE *Actions_List[]
> {
> Punch, Kick, NULL
> }

> for (j=0; Actions_List[j]; j ++)
> {
> Fighters[n_fighter]->Actions = j ? realloc (Fighters[n_fighter]->Actions, (j + 1) * sizeof (ONE_ACTION_TYPE *)) : malloc (sizeof (ONE_ACTION_TYPE *));
> Fighters[n_fighter]->Actions[j] = Actions_List [j];
> }

> That would be the way I would do it.
> Any other suggestions?

Man, what the hell is all that shit? Why are you calling malloc and remalloc? Why are you using the
urnary operator? Why are you using a loop? Are you trying to check all the player events? But that's
hard to keep track. What if you find a bug in one of the Actions_List array members or whatever you're
coding. How do you know which one to debug? Why do you write such complex formulas and
statements? I don't understand any of this shit you're talking about. Is this how you code all you're
programs? I don't even want to glance at you're source code. Man, that stuff above could give
a monkey a headache! Ooohh, Hoooohh, ahhh, ahhh :o) But seriously, you're really advanced in
all this stuff. You gotta break some things down, ya know?

Chris :o)
 
Eric
  • Guest
Reply with quote
Re: Beautiful!!
Post Posted: Thu Aug 12, 1999 4:00 pm
Quote
> Man, you're amazing! Just set the address of a character to Player 1 and everything will naturally come
> together! How do you come up with this stuff? You don't understand how smart that is! It's simple
> and it makes a whole lot of sense to me, more than what Zoop said.

Stop it, I'm blushing.

Actually, I'm not all that smart or clever, I just have some experience with C++. I didn't invent this stuff, I just copy it.

I believe there's a lot of value to Zoop's method. Object-Oriented Programming (OOP) doesn't equate to high-performance.

Quote
> Oh yeah, so you say that you cannot control another object unless the object is contained inside
> another object? Hum...Interesting. I guess you're right.

I could be wrong. I'm no C++ expert. As far as I know, there's no implicit way to control groups of objects. The best you can do is put them in an array, and iterate through the indices.

Quote
> If I study data structures everything will
> naturally come together. Thanks!

Hopefully, yes.

Good luck.

Eric
 
  • Joined: 24 Jun 1999
  • Posts: 1732
  • Location: Paris, France
Reply with quote
Answer..
Post Posted: Fri Aug 13, 1999 6:32 pm
Quote
> > Instead of having to use a complicated case structure and obscure object oriented programming, why don't you use some simple C code:
> > i = Process_Input (current_key_pressed);
> > Fighters[current_fighter]->Actions[i] ();
> > Where "Fighters" is a table of pointer to fighters structures, which contains themselves a dynamic table to function pointers, which could be orderer the same way for all fighters, like:
> What the heck is all that? Why would you need...Ahh, nevermind. I'm completely lost. I'm a newbie,
> remember? Could you explain that in a different way or something?

> Man, what the hell is all that shit?

It's dynamic.

Quote
> Why are you calling malloc and remalloc?

To allocate the memory for the pointers.

Quote
> Why are you using the urnary operator?

Because the first pointer need a malloc, and then as I'm expanding the allocated area to add other
pointers dynamically, I use a realloc.

Quote
> Why are you using a loop? Are you trying to check all the player events?

The loop is an initialization for the table of pointers.

Quote
> Is this how you code all you're programs?
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!