Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (480)
Games in Android Showcase (110)
games submitted by our members
Games in WIP (547)
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 4646 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.

Example: http://4.bp.blogspot.com/_ahF-tM2HtPE/SVBel-aSrmI/AAAAAAAAAAM/Lp-OfzKhM1A/s1600-h/Kuvakaappaus_1.png 

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:
http://www.gamedev.net/reference/articles/article738.asp

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


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
« League of Dukes »

JGO Overlord


Medals: 781
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 Member


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.

-JAW
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 Ninja


Medals: 20
Projects: 10


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):
http://www.noblemaster.com/public/

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

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

atombrot (25 views)
2014-08-19 09:29:53

Tekkerue (24 views)
2014-08-16 06:45:27

Tekkerue (23 views)
2014-08-16 06:22:17

Tekkerue (13 views)
2014-08-16 06:20:21

Tekkerue (20 views)
2014-08-16 06:12:11

Rayexar (58 views)
2014-08-11 02:49:23

BurntPizza (38 views)
2014-08-09 21:09:32

BurntPizza (30 views)
2014-08-08 02:01:56

Norakomi (37 views)
2014-08-06 19:49:38

BurntPizza (67 views)
2014-08-03 02:57:17
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org 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‑gaming.org
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!