Gamestudio Links
Zorro Links
Newest Posts
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Data from CSV not parsed correctly
by EternallyCurious. 04/20/24 21:39
M1 Oversampling
by 11honza11. 04/20/24 20:57
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, rki), 390 guests, and 0 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
isometric distance to object and size #450965
04/25/15 22:35
04/25/15 22:35
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Good day,

In manual I saw this under the flag 'Isometric':

Quote:
The distance of the camera to an object does not affect its size on the screen in this mode;


How to do this for every entity seen on the view but still being able to change the arc / view borders?

Basically I have 2 views, 1 is default camera view and the other is the isometric one. I want to clearly see units from above on the isometric view regardless of the distance between the isometric view and the unit, and being able to zoom in and out which I want it to only change the x/y pos of units on the view and not the size of the units (which currently changing arc/view borders does).

Thanks for taking the time.

Re: isometric distance to object and size [Re: Reconnoiter] #451007
04/27/15 02:00
04/27/15 02:00
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Of course entities are rendered smaller when you increase the isometric view volume, everything would be highly confusing and impractical (I suggest you google isometric and perspective rendering).

I assume you want to create some kind of radar functionality (and don't want to use 2D objects like panels or draw_...)? What you could do is fill the entity's scale_x vector (let's say with a view.right/256.0 formula) or do the scaling in a vertex shader which would be notably faster when you have to scale often/ every frame.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: isometric distance to object and size [Re: Superku] #451044
04/27/15 18:00
04/27/15 18:00
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Maybe this helps in some way. I wrote it for the Ackmania isometric camera.
The main reason was to make sure the distance doesn't change with different screen resolution (width being the master), but there is also an additional distance calculation, so the camera can move further away depending on the speed of the object in focus.
I use some reference screen width and arc to calculate a default width (vViewWidth). For further calculation I can always refer to this default width. The calculation looks a bit strange (no, I haven't researched why the formula has to look like this), but basically it's just jcl's formula from the manual, rearranged so I can calculate what I need without taking assumptions or try and error.

Code:
#define CAMERA_DIST 2000
#define CAMERA_PAN 45
#define CAMERA_TILT -25
#define CAMERA_SPEEDFAC 0.015
#define CAMERA_REFSCRSIZEX 1920
#define CAMERA_REFARC 60

void create_camera(int layer)
{
	cam = view_create(layer);
	cam->pan = CAMERA_PAN;
	cam->tilt = CAMERA_TILT; 
	cam->flags |= ISOMETRIC;

	/* width = view.size_x * 2 * tan(view.arc/2); - from manual (view.arc) */
	vViewWidth = CAMERA_REFSCRSIZEX * 2 * tanv(CAMERA_REFARC * 0.5);
}

void update_camera()
{
	VECTOR vecPos;
	
	if (camera_focus_ent != NULL)
	{
		vec_set(vecPos, vector(-CAMERA_DIST, 0, 0));
		vec_rotate(vecPos, cam->pan);
		vec_add(vecPos, vector(camera_focus_ent->x, camera_focus_ent->y, 0));
		vec_set(cam->x, vecPos);

		vDistanceFactor += ((is_kart_accelerating(camera_focus_ent) > 0) * 0.05 - 0.02) * time_step;
		vDistanceFactor = clamp(abs(vDistanceFactor), 0.28, 0.6);

		/* view.arc = 2*atan(width/(view.size_x * 2)); - from manual (view.arc) */
		/* change camera arc by manipulating view size - delivers resolution independent result */
		cam->arc = 2 * atanv(vViewWidth * 0.5 / (screen_size.x / vDistanceFactor));
	}
	
}



The first part is only a follow-object implementation, but the vDistanceFactor stuff and the calculation might help.

Re: isometric distance to object and size [Re: FBL] #451066
04/28/15 09:33
04/28/15 09:33
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
Hi guys,

Quote:
Of course entities are rendered smaller when you increase the isometric view volume, everything would be highly confusing and impractical (I suggest you google isometric and perspective rendering).
, I know wink , this isn't for a normal view.

Quote:
I assume you want to create some kind of radar functionality (and don't want to use 2D objects like panels or draw_...)? What you could do is fill the entity's scale_x vector (let's say with a view.right/256.0 formula) or do the scaling in a vertex shader which would be notably faster when you have to scale often/ every frame.
, yes its something like that and zoom in and zoom out would only determine how many ents are on the screen and it should look clustered instead of very tiny ents. So that's why I want to keep them look the same regardless of the distance. I had been thinking about scaling but it seems like a very slow proces when scaling alot of them, though the vertex shader sounds very interesting, would that still work when I want to select an entity on the VIEW through mouse click?

@Firoball, that's interesting, I don't think I can use it cause I already use the border/arc for determining the visible part of the map, but thanks nonetheless.

Re: isometric distance to object and size [Re: Reconnoiter] #451110
04/28/15 17:49
04/28/15 17:49
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
For the mouse click you can always do an additional 2d-vector near check to the clicked point. Cycling through all entities with ent_next() should not be that much of a problem as you don't click all the time.

Re: isometric distance to object and size [Re: FBL] #451158
04/29/15 12:05
04/29/15 12:05
Joined: Dec 2011
Posts: 1,823
Netherlands
Reconnoiter Offline OP
Serious User
Reconnoiter  Offline OP
Serious User

Joined: Dec 2011
Posts: 1,823
Netherlands
okay thanks Firo


Moderated by  old_bill, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1