Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Which tiles and perspective to use?

This thread is locked; no one can reply to it. rss feed Print
Which tiles and perspective to use?
lameDuck2
Member #8,783
June 2007

I played around with a football game a number of years ago and got a 2d plan view running quite well, on a simple tile map. I want to pick this up again now, but produce it in Isometric view, but have a number of issues! basically, I need some advice...

The problem with an ISO is that fundamentally the map is a diamond, which would mean that one end I am looking at the goal head on and the other looking at it from behind. Not good. My current thinking is to have a camera perspective on the map, that travels to within 10% of the X-limits of the map. So at the half way line we are looking straight on and the angle gets introduced as the camera follows a player up the field. I can see a basic algorithm for this in my head. Has anybody done/seen this, not in 3d? This also gives an advantage that I can then easily get a vector from the camera to the player and blit the ones with the largest vector first, to make for easy Z-ordering. Following this, do I actually need an ISO tilemap? A standard one, with just more specific line tiles would work just as well, giving me a nice easy cartesian coordinate system to work with? I'd need more view-angles per sprite, but that's a one off effort at the begining and not much in run time. Given a vector I can easily determine the angle of the player relative to the camera and choose the right sprite frame set accordingly.

Thoughts, pointers, help, tips and offers of moral support, would all be gratefully appreciated. Yes, this really is a getting started question, but at least I know how to write code ;)

Another problem that I foresee having to think about are shadows, these being important to give the 3d look. Should these be part of the player sprite, making it a lot bigger, but making collision detection a bit more interesting. Or should they be a seperate bitmap, meaning 2 blits for every sprite?

Your thoughts good people.

Thanks

Jim

Archon
Member #4,195
January 2004
avatar

Quote:

My current thinking is to have a camera perspective on the map, that travels to within 10% of the X-limits of the map. So at the half way line we are looking straight on and the angle gets introduced as the camera follows a player up the field. I can see a basic algorithm for this in my head. Has anybody done/seen this, not in 3d?

That is essentially 3D if you can change the perspective like that.

Quote:

Another problem that I foresee having to think about are shadows, these being important to give the 3d look. Should these be part of the player sprite, making it a lot bigger, but making collision detection a bit more interesting. Or should they be a seperate bitmap, meaning 2 blits for every sprite?

You would draw the shadows first so they can merge together if they "stack" - so, separate images. Then draw the characters on top.

William Labbett
Member #4,486
March 2004
avatar

Quote:

I can see a basic algorithm for this in my head. Has anybody done/seen this, not in 3d?

Seems to me if you're going to go that far, you might as well make models and do it in proper 3D.

As for moral support : hope it works out for you.

Wilson Saunders
Member #5,872
May 2005
avatar

What about using single vanishing point perspective? If done from a side view you can see the front of both goals.

As for Shadows, have them be separate sprites and render them before the player sprites. You don't want a player's shadow overlapping another player. On the topic of overlapping be sure to sort you players in distance from the camera so you don't have any funky over lapping issues.

Update: attached is a quick MS Paint image of a Single vanishing point perceptive soccer (erm football) field.

http://www.allegro.cc/files/attachment/592446

________________________________________________
Play my games at http://monkeydev.com

William Labbett
Member #4,486
March 2004
avatar

hey, what a kind man!

Mark Oates
Member #1,146
March 2001
avatar

Quote:

Has anybody done/seen this, not in 3d?

Yes! And it's relatively easy to pull off. In fact I could summarize it in a couple of paragraphs. I created a simple 3d top-down environment where bitmaps that are closer appear larger than bitmaps that are further away.

http://www.allegro.cc/files/attachment/592447
http://www.allegro.cc/files/attachment/592448

I wrote a little webpage for a class to summarize the fundamentals. Go here: http://games.zeoxdesign.com/lost_gizmos/index.htm

You'll be interested in the two sections "Environment and Movement" and "Visual Component". The game is incomplete and there's all this extra audio crap I put in for the class, but you can get an idea.

you can change the depth of field and zoom with +/- and PgUp/PgDn on your keyboard's number pad.

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Jonatan Hedborg
Member #4,886
July 2004
avatar

I believe that Diablo 2 had an option to turn this effect on

Albin Engström
Member #8,110
December 2006
avatar

Jonatan Hedborg said:

I believe that Diablo 2 had an option to turn this effect on

It still has ^^.

Wilson Saunders
Member #5,872
May 2005
avatar

Jonatan Hedborg said:

I believe that Diablo 2 had an option to turn this effect on

That effect makes me motion sick after a long Diablo session I prefer to play with it off.

Back to the original thread:

I also suggest that you avoid Tileing for a football game. You need tiles for large varied terrain. A football field is relatively small and pretty consistent. Also, unless your computer is a total POS, you should be able to hold a bitmap larger than your screen in memory. From this you can blit out the part of the bitmap that the action is taking place on then draw your players on top of it. It would be far easier than trying to implement a tile system.

________________________________________________
Play my games at http://monkeydev.com

Thomas Harte
Member #33
April 2000
avatar

Quote:

The problem with an ISO is that fundamentally the map is a diamond, which would mean that one end I am looking at the goal head on and the other looking at it from behind. Not good.

Wasn't the original FIFA Soccer isometric? I remember that being received quite well...

EDIT: Yes it was:

{"name":"fifasoccer.gif","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/f\/8fd4f94af2f9878c1aae805e9a22bf79.gif","w":500,"h":351,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/f\/8fd4f94af2f9878c1aae805e9a22bf79"}fifasoccer.gif

Mark Oates
Member #1,146
March 2001
avatar

Are isometric tiles usually just stored with the extra transparent stuff along the edges? Are there isometric tilesets?

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

GullRaDriel
Member #3,861
September 2003
avatar

Stored with extra transparent stuff: yes

http://www.allegro.cc/files/attachment/592450

Tile sets :

What do you mean by tile set ? there are a set of techniques to have proper tile transition, and you can arrange them in a datafile the way you want. ;D

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

lameDuck2
Member #8,783
June 2007

Defo going to go with the camera moving independant of the currently selected player, sounds odd, but if I add that the game is closer to a simulator, that a joy-stick waggler, then maybe that will make more sense. Failing that, the proof of the pudding, will be in the eating, as they say. So basically it's 'is' a single point of perspective, only moving around the playing field.

Mark, thanks for the pointers, I'll have a proper look through it and see if there are any bits I can steal, sorry, I meant to say borrow ::)

I like the shadow tips, they are glaringly obvious, but I hadn't considered them overlapping other sprites. Has defo saved me some serious refactoring later on!

Willaim - yes, it would make a lot of sense to do it in 3d, but I have no experience of that what so ever, so the learning curve may be a little to steep for me now, but maybe a version 2 option...

Wilson, the reason I'd use a tile map is that it's relatively trivial for me, having done a couple of them before, so short lead time. It's an interesting idea though and I will defo throw said large bitmap together and see just how large it is. May be something I look at after all. I'm currently leaning towards a simple few grass tiles and drawing the lines on after. The reason for this thinking is the perspective thing, depending on where about you are in the field, the lines/elispes are going to vary a lot and it might be easier to calc/draw them on the fly. Will think some about the math and code involved in implementing it.

Thomas - That view from the rear of the goal is exactly the thing I am trying to avoid, although the rest of it, is about right for a first release. Although if I ever get the hang of Poser, I hope the graphics will be a little better ;)

Thanks for all the tis and advice on this one.

Fondest

Jim

Tobias Dammers
Member #2,604
August 2002
avatar

Hmmm... I still don't see how you're going to pull the tilemap-with-moving-perspective thing off. Either you have a tile map, and ergo an orthographic projection, or you are doing full-blown 3d (even though the sprites may be billboarded, Duke-Nukem-3D-style). The only halfway solution I can see would be a mode-7 kind of thing, that is, the ground rendered in mode-7 fashion, and the rest using regular sprites.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

lameDuck2
Member #8,783
June 2007

I'd never heard of mode-7, so had to look it up! It's not as complicated as it sounds, it's a hybrid between a normal tilemap and Wilson's single point of perspective. This of the camera as always facing the same direction and freely mveable in the Y axis. The allowed travel in the X axis would only go to with 10% of the goal line (ish, need trial and error to see what works best). So we'll see the face of the goals at either end and a normal straight ahead view for the rest of the pitch. The only thing I have to really think about is making sure forground players travel greater distances in shorter time. I'll post the test code when I've done it, if anyones interested! Just have to decide on C#/allegro interop, C++, or Tao.

Decisions, decision ::)

J

Tobias Dammers
Member #2,604
August 2002
avatar

Essentially, you are dealing with a 3d-to-2d mapping problem: the game is 3d (the field stretches in X and Y, the sprites - players, the ball, possibly the goals - elevate into Z), and you want to display it in 2d.
Your first choice is "perspective-projected or orthogonal?", i.e., will you take perspective foreshortening into account or not. Perspective-projected is more realistic, but means that you have to scale things, which means that pixel art will suffer quality loss due to scaling artifacts. Orthogonal projection keeps all sizes intact, so simple sprite blitting will do, at the cost of slightly inaccurate sizes: objects will not look smaller at a distance.
Your second choice is what camera movements you want to allow. Basically, a camera can have up to 7 degrees of freedom: Movement along 3 axis (x, y, z), rotation about 3 axis (nose, roll, gear), and zoom.
Then you need to make two more choices: how to implement the ground, and how to implement elevated objects. The ground will typically be a tile map, though for a soccer game, a single textured quad might work just fine. The objects can be either full 3d models (textured or flat-colored polygonal meshes), or "billboarded" sprites. Voxel models are another theoretical option, but they're probably not what you want.

Once you've made those choices, consider your options.
An isometric tilemap engine of some sort. This means that your camera angle is fixed, and you can design your sprites to look "right". The view can be either top-down (easy to get right, and tiles are usually square, but the illusion of perspective is weak - ex.: Hellcarrier, Meteor), looking down at 45 or 60 degrees (producing rectangular tiles; if done right, the illusion of perspective works well, but visible tile borders need to be avoided by all means), or looking down and geared by 45 degrees (diamond-shaped tiles: harder to code, but easier to achieve a perspective illusion - ex.: StarCraft). This will give you orthogonal projection. Yet another option is "wrong" perspective: some objects seen top-down, others from one side (ex.: Zelda, Bomberman, SimCity).

A mode-7 engine. In the simplest version (ex.: Street Fighter), you just move individual scanlines depending on their depth, scanlines that are further away move less; this will only allow movement along the x-axis, and no rotation. With some clever tricks, though, it is possible to produce at least gearing and movement along the other 2 axis (ex.: Frenetic Plus). Elevated objects can be rendered as billboarded (and scaled) sprites. This will give you perspective projection.

A simple 3d engine Render the ground as a textured quad (or a tilemap if you want), and the elevated objects as textured alpha-blended quads, rotated about the "up" axis (and possibly the x axis too) to face the viewer (ex.: Duke Nukem 3d). You can do this with allegro, or use a 3d library such as opengl. This will only look good if you limit the camera nose angle, or design your sprites so that they look OK anyway (ex.: Descent II, though this uses models as well).

A full 3d engine Same as simple 3d engine, but using actual models for the elevated objects. This gives full freedom to the camera, with no visual problems, but makes it hard to achieve a pixelish visual style. It requires a lot of programming effort, since animating models typically requires skeleton animation. You also need proper modelling skills; it is a lot harder to get away with bad models than with bad sprites. Plus, we humans aren't that good at true 3d thinking, so you're at risk wrecking your brain doing this.

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

Mark Oates
Member #1,146
March 2001
avatar

Quote:

Mark, thanks for the pointers, I'll have a proper look through it and see if there are any bits I can steal, sorry, I meant to say borrow

Nah, steel all you want! :)

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

lameDuck2
Member #8,783
June 2007

Wow, very comprehensive answer, thank you very much Tobias! Certainly a lot of food for thought.

Clearly I'm going to have to spike this (experiment with code for the non XP ;)) have started readin a very good tutorial on OpenGL and it looks 'doable'. The models are going to be a pain as you say, but I have a copy of poser, which I will finally have to get my head around and hopefully that will save the day.

The camera will be fairly fixed, free to move through X and Y, but not Z. It will look down at 45, isometric style, which I'd go with, but I really can't live with the idea of looking at one goal from behind!

So, it look like simple of full 3d, I'll decide post spike.

Oh, and a very sore brain...

Thanks again for an amazing reply, very cool indeed...

J

Go to: