Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / 2d isometric view?

Author
Message
M00NSHiNE
22
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 24th May 2004 20:53
Im just wondering if anyone knows how to make an isometric game using 2d sprites. Setting the priority of rendering the sprites is the important question here - how do I sort the sprites into the correct order then render them to the screen? Whats the fastest way to do this? I think youd have to check the y position of each sprite to see which is behind etc, but there must be better ways. Anybody know how they do it professionally?

Cheers

IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 24th May 2004 21:43
The do it by sorting the sprites before rendering them.

Here's a very simplistic way using sprites, and the SET PRITE PRIORITY command.



*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
M00NSHiNE
22
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 24th May 2004 23:27
Thanks Ian, I'll have a go with this

zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 3rd Jun 2004 23:39 Edited at: 4th Jun 2004 07:14
Moonshine,

Let me know if you run into problems. I can dig up some of my iso code that may help you.

If your not sure what a mousemap is, or why it's necessary I will post some info later to help explain it. basically it has to do with finding what tile you are clicking on (this is not as straight fowars as it seems, like it is in top down tileworlds. The Overapping of the transparent rectangles changes things.)

I think you will find that the hardest(or least intuitive) part is actually the movement and mousemap. This becomes more or less of a problem depending on you intial choice of maps layouts. Yes, there are a few common variations on how to draw Isomaps.
Eg. Staggered, Diamond, and Slide maps. Each one has it's +'s and -'s both visually and complexity of handling movement and mousemaps, and forces you to change the order in which you draw(blit) the tiles.

E.g.'s
- Diamond maps are preferred if you are going to let the player see the edge of the world. like Simcity, Populous. If your world is large this is not a good shoice as you can imagine what the screen looks like as a player gets closer and closer to a corner. The larger the map the worse the effects. smooth edeges ______.

- Staggered Maps if player is prevented from getting to an edge. Like Command & Conquer. Great for large maps. You need to pad the edges with border tiles eg.water,mountains ocean, and make sure that a player never sees an edge. If they do, it will look like the edge of corregated scissors ^^^^^^^^ .

- Slidemaps are like a combination of staggered and Diamond. It results in top and bottom edges like staggered maps, sides like diamonsd; with the layout of a diamond map. Slidemaps are rarely used and I have no examples of a program that I *Know* uses them.

Here is an ASCII art example I drew up. Don't laugh.
argghh. View the sourcode in the following post.

[edit: The board Message are spits out backslahes. And why can't we addor modify source code when editing posts?]


zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 4th Jun 2004 00:13 Edited at: 4th Jun 2004 00:18
All of that time spent drawing only to find the boards erases multiple backslahes. Arghhh!! I'll see what happens if I put it int the soucre button.

[edit] It worked! View the source in the source button below.


3ddd
22
Years of Service
User Offline
Joined: 14th Apr 2004
Location: Orlando, FL
Posted: 4th Jun 2004 07:16 Edited at: 4th Jun 2004 16:20
http://www.tilemap.co.uk/mappy.php
This program can help you create isometric tile based maps. I was able to implement it in Dark Basic Pro, but, it was not easy to do or work with (required using poke and peek to get at memory addresses). Let me know if you are interetsed.

Edit: FYI... all credit for using Mappy in DBpro goes to Kevin P. at http://underwaredesign.com/ You can find the DBpro files you need there. I just modified the code a bit (with Kevin's help) to get some key functions working (e.g., reading/writing the extra data for each tile, changing a tile, etc).


He's evil, but, he'll die. I like it.
Neophyte
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 4th Jun 2004 10:46
@zenassem

"I can dig up some of my iso code that may help you."

I never did get around to thanking you for posting that. It helped me get started on my own 2D iso game. Although I went on to making my own 2D staggered layout as opposed to your diamond layout you posted, it layed the foundation for the rest of my game. Thank you.

And in case anyone is interested, here is the original thread in which zenassem posted his code(don't know why it is in the texturemaker forum though):

http://texturemaker.thegamecreators.com/?m=forum_view&t=8810&b=4

I've also managed to get a pixel perfect MouseMap function working for a 2D staggered layout in case anyone is interested. I also have managed to modify IanM's A* pathfinding algorithm so it will give the correct results for staggered maps.

Perhaps we should start a tutorial on how to make a 2D isometric game? I've certainly got enough code to contribute.

With 3ddd's work with TileStudio and Mappy we could get a fairly impressive data-driven 2D iso game up and running.
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 4th Jun 2004 17:28
Neophyte,

Thanks for posting that. I didn't realize I had posted it in that board, so I had been unable to find it. It was my intention to complete a tutorial on it. I would like to finish it and would like to work with you to complete this.

The original goal was to a definitive "Coding 2-D Tile-based Games with DBC/DBpro" Tutorial. With straight-foward commented code examples on:

I'll draw up an ouitline of what I wanted to cover.


Rknight
22
Years of Service
User Offline
Joined: 25th Sep 2003
Location: NJ
Posted: 4th Jun 2004 19:21
Quote: "I've also managed to get a pixel perfect MouseMap function working for a 2D staggered layout in case anyone is interested. I also have managed to modify IanM's A* pathfinding algorithm so it will give the correct results for staggered maps."


I'm sure I'm not the only one who'll be interested in such as well as a tutorial.
M00NSHiNE
22
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 4th Jun 2004 21:58
Ive only just come back to this thread, I thought it died ages ago

Those example have been really helpful zen, thanks for the explanations. I did find an old iso engine in DBC that may have been yours, I cant remember. I think a big iso tutorial would be helpful as the 2d aspects are often ignored in the wake of 3d. Neophyte, the mouse mapping and A* code would be nice to have a look at and learn from. I dont like to copy peoples code, I like to look through, learn and write it myself. Thanks again guys

Tom_d
22
Years of Service
User Offline
Joined: 3rd Jun 2004
Location:
Posted: 5th Jun 2004 00:29
hey check out my 2d isometric code - i put it in the code snippets section here:

http://darkbasicpro.thegamecreators.com/?m=forum_view&t=32744&b=6

let me know what you think!
Neophyte
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 5th Jun 2004 02:21
@zenassem

"I'll draw up an ouitline of what I wanted to cover."

I look forward to it. Hopefully, I can contribute some usefull stuff.

@MOONSHiNE

"Neophyte, the mouse mapping and A* code would be nice to have a look at and learn from. I dont like to copy peoples code, I like to look through, learn and write it myself. "

Don't worry. I've commented a lot and plan on explaining all of the changes I've made to IanM's A* code and how the mouse mapping works. Unfortunately, I'm going to have to draw quite a few pictures to explain it because its hard to put in words the exact problems I worked around.

@Tom_d

Interesting. I had a brief look at the source and there is one point that caught my eye.



I'm trying to figuare out the purpose of this function. Judging from the math, all it really does is return zero.

Y * (X/Y) will just result in X as the multipliction cancels out the division. So that would just leave X - X which is obviously zero.

Or did I miss something.
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 5th Jun 2004 02:44 Edited at: 5th Jun 2004 02:54
@Neophyte:
Order of Precedence.
The division is in parenthesis so it will be performed first. That result will then be multiplied by Y.


here's a clickable link to tomd's Thread.
http://darkbasicpro.thegamecreators.com/?m=forum_view&t=32744&b=6

clickable link to tomd's Media <.zip download>
you can download the media needed here:
http://www.woodboro.co.uk/files/media.zip


Igotcha
22
Years of Service
User Offline
Joined: 24th May 2004
Location:
Posted: 5th Jun 2004 03:43
Quote: "The division is in parenthesis so it will be performed first. That result will then be multiplied by Y."


Which is still X

Y * (X/Y) = Y * X / Y = X
Neophyte
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 5th Jun 2004 03:44 Edited at: 5th Jun 2004 03:45
@zenassem

"Order of Precedence.
The division is in parenthesis so it will be performed first. That result will then be multiplied by Y. "

Yes and that multiplication would cancel the number you just divided out.

But, I figuared out what he is doing. Since integers are being used there are no decimal places. When you divide a number and it doesn't go in evenly you get the result rounded down. So 11 divided by 2 is 5 and not 5.5. In regular math multipling by what you just divided by would cancel that operation out leaving you with the original. But our result is rounded down. So 11 divide by 2 then multipled by 2 is not 11 but 10.

He then takes that number and subtracts it from the original giving him the remainder. He is performing a modulus operation on the number basically(obvious in retrospect since he named his function mod).

Of course, you don't need this function to do that. There is a MOD operater in DBPro though the default IDE doesn't bother to highlight it(I know. I use that operation extensively in my code).

He must not have known about it.

Edit:

It appears Igotcha beat me to it.
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 5th Jun 2004 04:57
Ummmmm. I don't know what the heck I was seeing.
That's what I get for answering without thinking.

And if you can believe it; I passed Calc II & Discreet Mathematics.

From to in a single post.
Very embarassing...


Neophyte
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 5th Jun 2004 05:16
@zenassem

"Very embarassing..."

Don't worry about it. I've made more embarassing mistakes myself.
Tom_d
22
Years of Service
User Offline
Joined: 3rd Jun 2004
Location:
Posted: 5th Jun 2004 10:58
neophyte:

thanks for pointing that out, i always struggle to remember how to write my own mod function - in dbpro is it just MOD(x,y), same syntax as mine?

cheers
Neophyte
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 6th Jun 2004 05:27
Actually it's just like the + or - sign. Like this:
Neophyte
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 7th Jun 2004 09:35
@zenassem

I'm not sure how far you are into the outline, but I've been thinking about some of the things we might want to cover.

For starters, how about multiple ways to lay out the tiles? There seems to be two pretty prevalent methods in use currently, Diamond maps(SimCity), and Staggered Maps(StarCraft). I've code for the later and I know you have code for the former. So should we include both ways into this tutorial? How about other methods like the slide map that you mentioned?

Also, while we are at it, are we going to be demonstrating how to display hex maps as well? Personally, I'd like to cover as much ground as possible. Kind of a "Ultimate Isometric Thread" deal.

I'm not sure how we would go about this though. If we covered a whole lot of stuff it would take us months to complete.

What I had in mind was we start a thread, and then just start adding little bits in. Like we start with how to lay out the tiles and then move on to other things like different methods for selecting the tile with a mouse. We could also bounce ideas off of each other and try creating standards like having certain variable names to represent common concepts. That way code would be more interchangable and easier to integrate.

The adding-little-bits-in-at-a-time deal would help solve the problem of how long it would take to make this tutorial. People would get the info much earlier and we would have plenty of experience on what works and what doesn't. So, in the end, if we included the info into some kind of big PDF tutorial we could leave out the ideas that didn't pan out and leave in the ideas that worked.

So what do you think? Does that sound like a decent plan?
M00NSHiNE
22
Years of Service
User Offline
Joined: 4th Aug 2003
Location: England, UK
Posted: 7th Jun 2004 16:07
Well I think it sounds good

zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 7th Jun 2004 20:42
@ Neophyte,

I agree with you. I would like to include as much we possibly can. We can have it as an open ended project that can grow in it's scope.

Here is an example of what I am thinking. I am still in the process of planning, so there are things missing and other things that could/should/will change. This is just a framework for how all the tutuorials can eventually come together. ***It doesn't imply that we will complete all of them, but at least the overall goal is there; in the event that we/ or someone else would like to add to the tutorial in the future.

----
OverView
I. Introduction to Tile-based games/maps: {An Overview of the different types of tile-maps and the tools, utilities etc, examples.}

----
The appendix Will contain be a reference of information that applies to all tile-game programs...
Appendix
Appendix A. DBPro/DBC 2D Definitive Guide: {A reference for handling 2D in DBpro/(DBC if we can.) Kind of a collection of how-to's/nuances for achieving the best results for 2D(images,bitmaps,sprites).

Appendix B. Handling 2D media: {A guide to creating/extracting sprite sheets, Tile-sheets, Reasing from Data Statements, .txt files,}

Appendix C. Data Structures Primer for tile-based games with DB: {Built in types, Arrays, Multi-Dimensional Arrays, Dynamic Arrays, Linked Lists, stacks, queue's, Pointers, Memblocks, etc; User defined types - And how these apply to creating a TileCLASS, WorldClass etc...}
***optional***
Glossary
References/Sources
Index
Etc...

----
*** I have come to the conlusion that after the Basic Introduction that:

Each Type/category (Top down, Isometric Maps, Iso-Hex Maps) will be treated in it's own section. All (that apply) following this type of outline. {Otherwise it becomes hectic for people to follow and skip around looking for the info they need Like in a ALL-In-One Book} Even if some info is duplicated it's better for our type of format for people to be able to grab what they need based on the 3 Categories(Top Down, ISO, ISO-HEX). *Top-down games will follow a close but simpler layout, and include things parallex scrolling*

----
BASIC Techniques/Setup -
a. Tile Creation. (Sizes, proportions etc.)
b. World Creation (With Arrays). {Sceen Coordinates Vs World-Coordinates & Tile-Coordinates, Layers}
c. Map Layouts (ie Diamond, Staggered, Slide(if we choose to cover it)
d. World Scrolling/Redraw Ordering.
----
Advanced topics
e. Player/Item/Sprite postioning & Anchoring
f. MouseMaps & Movement
g. Scrolling/Redraw ordering
h. MapMaker
i. Path finding / collision
j. Additional effects. Atmospheric (weather), HeightMaps, etc...
k. Implementing Advanced Data Sturctures linked lists
etc...
----

So, the template would look something like...

I. Overview
II. Top-Down Tiles - (rectangular Tiles)
{
Basic
a.
b.
c.
...
Advanced
e.
f.
...
}

III. Isometric Tiles
{
...
}

IV Iso-Hex Tiles
{
...
}

Apendix
a.
b.
c.
etc..
--------------------------------------------------------------------


Neophyte
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 7th Jun 2004 22:54
@zenassem

Sounds like a plan.

Count me in.
Neophyte
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 10th Jun 2004 09:19
So what exactly are we going to call this new thread? I'm partial to "The Ultimate Iso-Hex Thread" but that's just me.

Anyway, do you have a specific time frame when you want to start this or can I just start up a thread now? I'm not entirely sure what to include if I were to start a thread. I have plenty of code but not a whole lot of an idea what to post first.
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 10th Jun 2004 21:20
Neophyte,

I'm not sure how well this will work in a thread during the writing stages. There is bound to be a lot of information, graphical references... as well as errors and organizational issues in the beginning. It might not hurt to try.

Unless of course you mean starting a thread that has a link to an online document. Then the thread can be used for feedback and input on the tutorials. Or were you thinking of having an ongoing workshop, e.g. live tutroial that people can follow? My suggestion above was more geared towards creating a Guide, that people could download, printout, read, and learn from.

As I have been thinking about this, I believe it is best to start with the basic tutorials (for instance ISO staggered). We can build around it, as it will be a work in progress. I'm not sure if we will have the time/stamina to have all the info I posted earlier, but at least by following the structure it can be worked on in stages over time. If we waited until we had an all encompassing guide to ISO-Hex it would take months/year(S) before it would be finished.

So we could just take it chunk by chunk. Perhaps we can collaborate through IM, &e-mail. And find a host for the document. I'll try to work on the Introduction material tonight and through the weekend. I trying to manage my time because I am alos currently working on a 2D streets of Rage app & other small samples. I have planty of references/books on ISO hex, that I can adapt to DB/DBpro specific code/samples.


Neophyte
23
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 11th Jun 2004 04:34
@zenassem

"So we could just take it chunk by chunk."

That's what I was thinking. We start off the thread and just start contributing bit by bit until we get finished. There will probably be some mistakes made along the way but that isn't really a problem. It will get corrected over time. The important part to me is that the info gets out there and is available. I'm not worrying too much over structure though I think it would probably be best if we tried to follow the outline that you suggested.

" I'll try to work on the Introduction material tonight and through the weekend."

All right. If you can get an introduction up that explains what Iso tiles look like, I can write a section that deals with displaying the tiles in a staggered form. After that we could probably deal with the diamond form if you haven't covered that already.

Once that is out of the way I'm not too sure where to progress from there. We could keep covering other forms like the slide form that you talked about or hex tiles. Or we could move on from there to selecting the tile with the mouse. I'd like to move on to the mouse selection first, but I'd also like to eventually cover other forms like slide and hex.

I suppose the best appoarch would be to cover the common forms and how to deal with them first. Then move on to the uncommon forms once we get the common ones covered suffiecently.

Its all up to you though really.
zenassem
23
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 16th Jun 2004 02:05
neophyte,

Well it's worth a try. I'm sure others will let us know if it's valuable to them.

I'll begin a new thread tonight. I guess for now I'll just keep editing my first post in the thread to update the information. As it get's larger I'll wrap it in code tags. I'll provide links to images/picture referebnces via photobucket. If people tend to like it, I'll pull compile into an adobe .pdf file and host it somewhere.

I'll begin with the basic intro, and then the 2D guide. Then I'll begin the rectangle 2D Top-down maps. From there I'll probably have one foot in the rectangualar maps and another in the iso & hex maps.

~zen


Login to post a reply

Server time is: 2026-06-09 15:43:15
Your offset time is: 2026-06-09 15:43:15