Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (TipmyPip, 1 invisible), 18,758 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Panel.pos_x/pos_y with var precision [Re: HeelX] #205087
05/03/08 18:50
05/03/08 18:50
Joined: Jul 2006
Posts: 40
North Europe
D
DeepReflection Offline
Newbie
DeepReflection  Offline
Newbie
D

Joined: Jul 2006
Posts: 40
North Europe
Hello HeelX,

OK! I understand now, You want a smooth function for 2d stuff simulating greater resolution than you use by mathematically pixel blend surrounding pixels to simulate the greater resolution. (sort of shader thingy, heh )

Actually since it's hard to buy any monitor below 1280x1024 what low resolution are you aiming at since in a game you'd hardly recognize a single pixel move if you not running real low say 640x480 or something like that?

[ The more I think of it, if you have problem with smooth movements and have to lower the resolution to make the hardware to coop with it wouldn't a function like this drag the speed down to a crawl? And if you have sufficient hardware this function need to be switchable since above a certain resolution you'll never notice this behavior?

The only current low resolution applications I can imagine for the moment is TV PAL/NTSC and if so the hardware isn't the limit, setup two frame buffers and make a shader calculate the smoothing between them or something like that]



Old reply, still acceptable on or above 1024x768 resolution.

I would have done something like this... (Since you said you only move "some panels" not hundreds )

PANEL* pan;
pan = ...;
var pan_x,pan_y;

pan_x += 0.1 + sin(total_ticks) * 0.1 * time_step;
pan_y += sin(total_ticks) * 0.5 * time_step;

pan->pos_y = integer(pan_x); // Actually the engine will do this by it self (type casting)
pan->pos_x = integer(pan_y);


Why?! Because this way you still will have control over how the actual position on screen will be, if this was a hard coded translation in the engine from var to int and a bad fraction part of your var makes it stutter you have no control over it anymore. In this way you can add more function rules that only change position if values have changed more than 0.xx since the xx last frame or neglect negative/positive movement if the next value will equal the current usw.

Currently with the code you presented for every iteration you loose some fractions of the "var" you put back to pan->pos_y and pos_x.

Yes!, It would be sleek to using var, real or whatever but since monitors still is stupid binary without sub pixels I think it's a bad idea, the more high abstraction levels you put into things the more confusion it adds when the result is not what you thought you would get out of it.

Regards
CJ

Last edited by DeepReflection; 05/03/08 20:45. Reason: A couple of reconsiderations

Whoever has the gold makes the rules.
Re: Panel.pos_x/pos_y with var precision [Re: DeepReflection] #205102
05/04/08 00:26
05/04/08 00:26
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
Hi DeepReflection,

I understand your points. There are just some things to consider:


  • Different resolutions. Imagine you are making a resolution independent display and you are animating stuff on the screen, the precision panels have is very low on lower resolution which turn into visible stuttering. This also happens if you are having faster moving panels - the human eye is able to recognize natural, smooth motion compared to similar motion but with motion stuttering.
  • Many stuttering objects. When you have only one moving object on the screen, it could be okay, but if you have lots of moving, stuttering things on the screen (and everything is slightly shaking), it hurts your eyes.
  • Time correction. When you move things with time_step, it could be the case on higher framerates, that only small fraction are added to the variable. This cannot be represented properly and this leads to incorrect behaviour when you only work with relative position changes.
  • I have this in mind for unlimited objects.


If JCL says it is doable, please do it. Otherwise I'll find a solution.

Re: Panel.pos_x/pos_y with var precision [Re: HeelX] #207496
05/20/08 06:41
05/20/08 06:41
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline OP
Senior Expert
HeelX  Offline OP
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
*bump*

Any news on this, JCL?

Re: Panel.pos_x/pos_y with var precision [Re: HeelX] #207524
05/20/08 13:30
05/20/08 13:30
Joined: Jul 2000
Posts: 28,024
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,024
Frankfurt
Yes, but no good news - in short, you can't move 2D panels smoothly. You'd need a 3D screen sprite for positions between pixel boundaries.

Page 2 of 2 1 2

Moderated by  aztec, Spirit 

Gamestudio download | 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