Hi !
Featured games (87)
games approved by the League of Dukes
Games in Showcase (669)
Games in Android Showcase (194)
games submitted by our members
Games in WIP (727)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Isometric terrain with uneven tiles  (Read 5692 times)
0 Members and 1 Guest are viewing this topic.
Offline ava

Junior Newbie

« Posted 2008-12-28 19:03:00 »

Howdy all,

I've been playing around with some ideas on how to create isometric games with uneven ground. In my current version every tile has its corner heights defined, so I can easily create more interesting terrain compared to those flat ones.


Now I'm wondering, how am I to apply textures to tiles such as these? Or if it's possible at all (in plain 2D) and if I'll have to abandon this polygon-based terrain stuff completely. Whichever it is, I haven't really been able to find anything which would have helped me on this question.
Offline SacredFenix

Senior Newbie

« Reply #1 - Posted 2008-12-28 23:33:43 »

That screen shot is pretty neat  Grin. Is that purely 2D rendered?

For my current isometric game, I am using a stack of tiles to represent height like so:

That isn't exactly what your looking for but I think the general idea will be the same.

at (1, 0) you have a tile that has an a primary part, the diamond, and a secondary part, the little triangle. You could associate textures with the primary and secondary parts of a type of terrain. For example a grass terrain type might have a green texture for the primary (the grass) and a brown texture for the secondary (the dirt). To manipulate the textures to fit those shapes, you should google Java2D shearing, but it would be much easier (and faster) if you used JOGL or LWJGL. I say that it would be easier with OpenGL because OpenGL automatically fits your textures to your shapes.
Offline ava

Junior Newbie

« Reply #2 - Posted 2008-12-29 01:27:27 »

That screen shot is pretty neat  Grin. Is that purely 2D rendered?

Thanks Smiley. And yes, that's pure 2D with simple polygons formed from text file data. I'm way too unfamiliar with the game development side of Java to do anything more complicated than this Tongue

But thanks to this
To manipulate the textures to fit those shapes, you should google Java2D shearing, but it would be much easier (and faster) if you used JOGL or LWJGL. I say that it would be easier with OpenGL because OpenGL automatically fits your textures to your shapes.
I know what I should try next. I did some really-not-so-thorough research on these but they seemed too much of a overkill to do something as simple as 2D-tile texturing. D'oh, I guess.

Oh, I've also read that tutorial you posted. Good stuff, just like all the other gamedev tut's out there. Helped me so much that I only really wanted to know how to stretch, twist 'n turn textures to make them fit those "strange" tiles. And now I might know. Thanks.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline SimonH
« Reply #3 - Posted 2008-12-29 12:03:24 »

I wrote some code once which fills an arbitrary quad with an image's pixel data. It's pretty basic & slow but I guess it might do for what you have in mind? (has to be better than becoming dependent on native GL libraries!)

People make games and games make people
Offline ava

Junior Newbie

« Reply #4 - Posted 2008-12-30 18:09:26 »

Righto, JOGL did the job. Turned out to be quite easy, really. But still, being interested enough I think I'll have to see and try to do it without any GL libraries.
Offline luisoft

JGO Coder

Projects: 6
Exp: 10 years

Java games rock!

« Reply #5 - Posted 2009-01-25 12:11:48 »

hi, I don't have the answer for your question... but I think you can help me... Tongue I have posted a thread here asking how to transform my current rendering method to uso iso tiles. Are you able to give me a help? Please use the thread I used to post. Thanks a lot.
Offline SwampChicken
« Reply #6 - Posted 2009-07-27 09:05:27 »

I actually like the original terrain, it's more rugged. I kinda like the cliffs etc, forces players to walk around them..
Offline Riven

« JGO Overlord »

Medals: 1207
Projects: 4
Exp: 16 years

Hand over your head.

« Reply #7 - Posted 2009-07-27 09:14:14 »

You might want to look at the last reply date next time Wink

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings!
Offline JAW

Senior Devvie

Medals: 2

« Reply #8 - Posted 2009-08-05 21:01:54 »

Well Ill use this thread anyway, because I had just the same idea, to experiment with different heights for every corner in a tile map, and I have the same problem, applying correct lighting and textures. On one hand, I would appreciate any more ideas considering the problem. On the other hand, I'd like to share my ideas so far:

My first attempt would be using a simple flat texturing, so that the texture is not perspectively morphed but just clipped to the tiles shape. And to create the look of depth just using lighting / shadows on each tile. That could be done by manipulating the image data and lighten or darken pixels row by row, or painting a fading from light white or black to transparent over the tile. Anyway, one really needs to buffer the result and do the texturing only once, everything else would be to slow.

My attempt number two would be writing my own texture routine. I have the book from David Brackeend and he describes 3d software rendering and texturing. Using some rather simple math is already enough to calculate the position of each point of a texture to a destination point on the morphed tile. For each different shape and texture, you'd need to at least one apply the texture to the tile shape by calculation each pixel value using 3d math. You probably want to buffer the resulting images, for you cannot calculate this every frame.

The problem here is not actually texturing but perspective morphing. Isometric graphics use some simple math to produce results that look like having a perspective. When you consider it the way a 3d engine does, each tile is a flat shape with some angle along the 3 axes. There is some math involved in projecting a shape in 3d into a view from a given point of view. The basic calculations for 3d transforming can probably found on the web.

Offline Eli Delventhal

JGO Kernel

Medals: 42
Projects: 11
Exp: 10 years

Game Engineer

« Reply #9 - Posted 2009-08-06 04:34:27 »

I'd probably just try to be tricky about angling my hills and then use OpenGL to draw full sized quads except at the edges - that way the texture isn't squished or resized any weird ways. Although I imagine just letting OpenGL draw using your 4 texture coordinates might be just fine anyway.

See my work:
OTC Software
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline noblemaster

« JGO Spiffy Duke »

Medals: 32
Projects: 11

Age of Conquest makes your day!

« Reply #10 - Posted 2009-08-06 19:42:35 »

Here are some Java sources I wrote earlier (see section 2):

Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

IanParcs (34 views)
2016-04-18 14:18:53

KaiHH (34 views)
2016-04-18 08:35:41

KaiHH (66 views)
2016-04-15 12:43:58

theagentd (64 views)
2016-04-14 02:16:17

theagentd (72 views)
2016-04-14 02:15:43

IanParcs (66 views)
2016-04-12 03:51:16

IanParcs (35 views)
2016-04-12 03:50:03

IanParcs (32 views)
2016-04-12 03:49:54

IanParcs (27 views)
2016-04-12 03:49:52

IanParcs (36 views)
2016-04-12 03:49:52
Website offering 3D Models specifically for games for free
by vusman
2016-04-29 12:56:17

List of Learning Resources
by SilverTiger
2016-02-05 09:39:47

List of Learning Resources
by SilverTiger
2016-02-05 09:38:38

List of Learning Resources
by SilverTiger
2016-02-05 09:35:50

Rendering resources
by Roquen
2015-11-13 14:37:59

Rendering resources
by Roquen
2015-11-13 14:36:58

Math: Resources
by Roquen
2015-10-22 07:46:10

Networking Resources
by Roquen
2015-10-16 07:12:30 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!