   Kung fu coder: season 1 episode 4: relearning the sword
  Okay... time to ask a question.As dumb as it sounds: how do you make worlds for games like Super Mario Brothers, or games like Zelda, or F-Zero?Super Mario Brothers is probably the easiest to figure out, right? You just figure you are headed in a certain direction, and already know the way the level will look. You keep loading the level progressively until the player gets to the end portion.Zelda is probably the next step up - you are dealing with a world in which two-dimensional travel is possible. Instead of just moving left or right, Zelda travels in four directions. A problem? Probably not - just figure the direction the player is travelling in and load that particular array index of the bigger "map". (As weird as that sounds...)F-Zero - style mapping will probably be my biggest accomplishment yet. Mode 7 is pretty similar to natural vision perspective. How do you load the map there? (If you understand what I mean, I do not know how to load the next big "piece", since like Mario Brothers, the map keeps scrolling continuously in a direction.)Forgive me if I have asked this question before (I do not recall doing so). Is this really a problem, or am I simply looking at it from the wrong point of view?Thanks for hearing me out...-slippers2k  
  I''m not sure I get your question, so I''ll just try to cover everything it may be. For starters, think in terms of code how you would probably go about loading the next bits of the map in a game like Super Mario Brothers. Obviously, I can''t speak for you, but this is the first thing that came to my mind:Follow the player''s x position, not on the screen, but in terms of the large map representing the entire level. Then, every frame, or whenever there is an appropriate chance to load, simply copy in the map data for the area that needs to be shown.Zelda? Same deal. Just add in the y axis to the mix. And in the case of the SNES Mario games, they actually used this method also, not just side scrolling, if you think about it. Still, that''s irrelevant at the moment.The only "trick" comes into play with games like F-Zero that use mode 7 effects. But is there really a trick to it? All you need to keep in mind is that the perspective effect should never allow the user to see beyond the extent of the map currently loaded into video memory. I don''t consider that much of a trick.The end result is this: Just keep tracking the player''s position on the WHOLE map, and just load in the corresponding chunks every chance you get. That is to say: take the area the player is in. If you know the size of the map layer (which you set when you create the map layer) you can easily find the box that''s center is the player''s position. You then just load the contents of that box into memory, and that''s the best you can do.If that doesn''t make sense, just tell me, and I''ll try to clarify it. Just think of it this way: Make sure as much of the map as can be loaded is loaded, and that at all times the player should be at or near the center of the loaded map. There are exceptions, but that should put you on the right track.-Arek the Absolute  ;  Okay... I think I understand. (It''ll just take some time for the statements to sink in. )NEwayz, I was thinking about something. Colin McRae Rally 2.0 has some pretty cool 3d graphics (I figure it is a mode 7 game, but the graphics look real good). How do you handle sprite information in mode 7? Is it still just a matter of zooming in as you come closer to the object, just like natural perspective and scrolling?I figure it is. I''ve programmed in OpenGL before, and the coolest thing about OpenGL for beginners (like me) is that you don''t have to worry so much about technical aspects of code until you are skilled enough to consider them. You can render an entire scene and let the compiler worry about how to properly zoom an object in to where you are (or where you are going).Thoughts?-slippers2k  ;quote:Original post by slippers2k  Is it still just a matter of zooming in as you come closer to the object, just like natural perspective and scrolling?  Why wouldn''t it be?Of course, you''ll need to come up with your own algorithms to decide how to set the perspective and scaling for the sprites, or otherwise find the source of someone who''s already done so. I think your best bet, if you can''t figure things out, would be to look up some stuff on software 3d programming. You don''t need to get too into it. Usually the tutorials explain perspective very early on, and that''s really all you need.As far as OpenGL... I can''t say. I''ve never done any OpenGL... A bit of DirectX, but I never even went to Direct3D. Too bad I''m positive the GBA isn''t that programmer friendly, at least for us homebrew developers. -Arek the Absolute