How to keep sprites same physical size across devi

Get help using Construct 2

Post » Mon Jan 20, 2014 6:24 pm

In C2, how would you keep sprites the same physical size across different sized devices?

Example: I have a game that I want to run on Windows 8 and Windows Phone 8. They obviously have different screen sizes, but I would still like a certain sprite to appear about one centimeter in diameter on both devices.

I've looked in the FAQs, manual, and search, but haven't found a suitable method yet, besides manually scaling the sprites depending on the platform. I was hoping for a much more accurate method, like getting the physical screen size of the "browser"/device. Or, possibly even getting a pixel density. The Browser object/plugin has a `DevicePixelRatio` (the display pixels per CSS pixel), but that wouldn't seem to work because a phone device can have the exact same number of CSS pixels as a laptop.

Anybody know any workarounds for maintaining the same final-sized sprite better than adjusting size of sprite depending on platform?

One more note, I'm using the "Scale Outer" scaling mode. Not sure if that is helpful or not.
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Mon Jan 20, 2014 6:45 pm

I think this would be impossible without knowing the physical size of the device and/or it's pixeldensity. This is different for each device and not only each platform, so only if there is a way to get pixeldensity per device or screen and have events set up to counteract it, would this be possible.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Jan 20, 2014 7:50 pm

No it's not easily possible to do this.

After looking into this myself withouth C2 and working with direct JS. I found that the Browsers do not reliable report the em or px density accuratly.

The only way to do this is to have the user report the DPI and the screen dimensions manually at the games run time. This means your going to have to use a very large table of devices.

Some devices can be detected by C2 well enough as int he IOS family. But the Android, Tize, Windows8.... your on your own.

it's prtty crummy. I wanted to do the same thing over a year ago.
B
90
S
18
G
9
Posts: 2,455
Reputation: 15,018

Post » Mon Jan 20, 2014 8:19 pm

One idea - and it might not be a good idea - at the start of the game ask the player to click on the circle that is closest to the size of a pound coin or some other easily recognisable coin/thing, then using this "scale"...
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Mon Jan 20, 2014 9:06 pm

Maybe this could help:

http://dpi.lv/
Be nice until it's time to not be nice
B
36
S
10
G
9
Posts: 293
Reputation: 6,712

Post » Mon Jan 20, 2014 10:28 pm

[QUOTE=RamPackWobble] One idea - and it might not be a good idea - at the start of the game ask the player to click on the circle that is closest to the size of a pound coin or some other easily recognisable coin/thing, then using this "scale"...[/QUOTE]

Definitely not recommend using coins as a reference, since pounds are only used in UK. Even 1 Euro (or US quarter) are not easily available on all parts of the world.
Need help? Upload .capx file with your question.
B
16
S
4
G
2
Posts: 233
Reputation: 2,560

Post » Tue Jan 21, 2014 12:25 am

@jayderyu, definitely a creative idea. My first idea/response for this was that a great community-effort plugin could be created and everybody here just adding their own devices. But, I'm sure this information is already out there somewhere, we just have to find it and make an API call to it.

@RamPackWobble, good idea, I was thinking of something like that also. Maybe we would ask users to choose a circle the think closest to one inch (or roughly 2.54cm). Or, expanding on that, it might be good enough to just label the range of circles from easy to hard, if a game could be formed like that.

@JohnnySheffield, it looks like a great website. It probably works most of the time, but didn't for me. I have a dual-monitor setup (16 inch laptop, 24 inch monitor) and the results got the pixel count right for each screen, but said both were only 13.3 inches.

Even after seeing these great ideas, I still feel that there are more possibilities out there. I just haven't thought about them yet. I'm interested in all possibilities, no matter how easy/difficult they may be to implement.
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Tue Jan 21, 2014 10:14 am

[QUOTE=Joannak]
Definitely not recommend using coins as a reference, since pounds are only used in UK. Even 1 Euro (or US quarter) are not easily available on all parts of the world. [/QUOTE]

Good point about not using a coin.

Choose the ruler that is closes to life size ?


August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832


Return to How do I....?

Who is online

Users browsing this forum: Solomon and 10 guests