Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (517)
Games in Android Showcase (123)
games submitted by our members
Games in WIP (577)
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  
  2D Isometric View  (Read 2308 times)
0 Members and 1 Guest are viewing this topic.
Offline kpars

JGO Wizard


Medals: 100
Projects: 4
Exp: 3 years


Extreme Typist.


« Posted 2013-05-17 17:12:59 »

*Excuse me if I am posting this in the wrong board.*
So I thought about working on a new game as just a fun project to learn with. I'm going for a view similar to that of Diablo 1, how would I go for getting a 2D Isometric view? I'm not using any extra libraries such as LibGDX or Slick2D.

All help is appreciated  Smiley.

Offline matheus23

JGO Kernel


Medals: 110
Projects: 3


You think about my Avatar right now!


« Reply #1 - Posted 2013-05-17 17:20:08 »

Very, very, very helpful read:
http://www.java-gaming.org/topics/drawing-isometric-tiles-inside-a-screen/24922/msg/212780/view.html

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline kpars

JGO Wizard


Medals: 100
Projects: 4
Exp: 3 years


Extreme Typist.


« Reply #2 - Posted 2013-05-18 13:36:06 »

Oh wow, thank you VERY much, this really helped me out.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline DrZoidberg

Senior Duke


Medals: 15



« Reply #3 - Posted 2013-05-18 18:32:12 »

You can also use vector math. I have some Scala code here that shows how to translate coordinates in any arbitrary coordinate system into screen coordinates and back.
http://pastebin.com/qKjxeCPj
Offline matheus23

JGO Kernel


Medals: 110
Projects: 3


You think about my Avatar right now!


« Reply #4 - Posted 2013-05-18 18:56:01 »

You can also use vector math. I have some Scala code here that shows how to translate coordinates in any arbitrary coordinate system into screen coordinates and back.
http://pastebin.com/qKjxeCPj

YES! Another scala guy! Awesome!

<edit>what exactly do the second and third argument for the CoordinateSystem mean?</edit>

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline DrZoidberg

Senior Duke


Medals: 15



« Reply #5 - Posted 2013-05-18 20:43:16 »

The last two arguments represent the x and y axis of the coordinate system.
The x axis vector for example points from the origin to the point (1,0) in the target coordinate system.
So if you define your isometric system as
1  
2  
3  
CoordinateSystem(Vec(500,100),
                 Vec(1,1),
                 Vec(-1,1))

the point (0,0) corresponds to the screen coordinates (500,100). And the two axis of the isometric system point downwards 45degrees like in this image.

So (1,0) in the game means (1,1) + origin in screen coordinates.
Offline matheus23

JGO Kernel


Medals: 110
Projects: 3


You think about my Avatar right now!


« Reply #6 - Posted 2013-05-18 21:33:12 »

Awesome! understood that, really awesome...! Smiley

Do those axis vectors need to be normalized, or is it okay to have them un-normalized, or what would be the effect of having them big? The values scale?
So If I have Vec(10, 0) for x and Vec(0, 10) for y, and I'd convert Vec(1, 1), I'd get Vec(10, 10)? (scaled?)

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline DrZoidberg

Senior Duke


Medals: 15



« Reply #7 - Posted 2013-05-18 22:48:16 »

Yes, exactly. The vectors give the directions of the axes and also the scale. So the CoordinateSystem class can represent scaling, rotation, translation and also shearing (http://cs.fit.edu/~wds/classes/cse5255/thesis/shear/shear.html) since the two axes don't need to have a right angle between them.
I improved the CoordinateSystem class to make rotating and scaling easier. As you can see I like to work with immutable objects. At least when it comes to mathematical entities like vectors, matrices or even coordinate systems. Entities in a game however I usually make mutable.
http://pastebin.com/6XaMHgyU
Offline matheus23

JGO Kernel


Medals: 110
Projects: 3


You think about my Avatar right now!


« Reply #8 - Posted 2013-05-19 08:59:35 »

Wow... with that you could...
actually make a rotating isometric viewport, by simply rotating the axes!

But in the end you'd probably be better off with letting opengl do that kind of stuff, but still very, very cool! Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Offline DrZoidberg

Senior Duke


Medals: 15



« Reply #9 - Posted 2013-05-19 09:54:48 »

Yes, if you use libgdx you can use the Stage and Camera classes to do these things and more. But if you don't want to use any libraries and it's a relatively simple 2D game my solution is a good fit. However instead of having a class called CoordinateSystem it may be better to have a Camera class. A camera is basically defined oppositly to the CoordinateSystem class i.e. the camera's position and orientation are relative to the game world.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Riven
« League of Dukes »

JGO Overlord


Medals: 823
Projects: 4
Exp: 16 years


Hand over your head.


« Reply #10 - Posted 2013-05-19 19:50:57 »

http://www.java-gaming.org/topics/isometric-engine-rct-style-major-update-14-sep/10237/msg/82081/view.html#msg82081

Hi, appreciate more people! Σ ♥ = ¾
Learn how to award medals... and work your way up the social rankings
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.

TehJavaDev (34 views)
2014-10-27 03:28:38

TehJavaDev (27 views)
2014-10-27 03:27:51

DarkCart (41 views)
2014-10-26 19:37:11

Luminem (22 views)
2014-10-26 10:17:50

Luminem (27 views)
2014-10-26 10:14:04

theagentd (33 views)
2014-10-25 15:46:29

Longarmx (61 views)
2014-10-17 03:59:02

Norakomi (59 views)
2014-10-16 15:22:06

Norakomi (48 views)
2014-10-16 15:20:20

lcass (43 views)
2014-10-15 16:18:58
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!