Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

How to use a large background image larger than 4K
Started by eto_ru Nov 05 2018 06:38 AM

3 replies to this topic
[TOPIC CONTROLS]
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

eto_ru

[GLOBAL: userInfoPane.html]
eto_ru
  • Observer

  • 17 posts
  • Corona SDK

How to use a large background image larger than 4K?

Is it possible to hide part of the image without losing coordinate points.?

How you implement, what software or code?

 

Task-there is a map of the game world, where the user creates certain points tied to the coordinates on the map.How to split the map into sectors and hide them if they are not included in the visible part of the screen. Do not change the coordinates of the entire image.  maps big. and it seems to me that not every device can cope with such a volume.

 

Thanks in advance!



[TOPIC: post.html]
#2

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 293 posts
  • Corona SDK

There are actually quite a number of methods of accomplishing this and the most suitable method comes down to what kind of game you are developing. 

By 4K resolution, I guess you are referring to 3840 x 2160 pixels or 4096 x 2160 pixels? You can't, or at least you shouldn't create the background out of a single image as Android doesn't let you load images larger than 2048 x 2048 without requiring large heap and if you do require it, your game might get too heavy to run on older devices.

One method would be using a tile engine, like Ponytiled (https://github.com/ponywolf/ponytiled), to load large tile based maps.

 

You can also use repeating fills (https://docs.coronalabs.com/guide/graphics/repeatFill.html) to create display objects of any size and fill them with some pattern. I, for instance, use repeating fills to fill the screen with some repeating pattern, like water, grass, etc. to ensure that there will be no black areas on screen on any device.

 

Finally, you could also consider manually placing your map images to specific coordinates and implementing a camera to move them around. If you use a camera, then it doesn't matter if you place objects off screen. There are various methods on how to implement a camera. For instance, roaminggamer offers one as a part of his Super Starter Kit 2 at https://roaminggamer.github.io/RGDocs/pages/SSK2/.

 

These should hopefully get you started.


  • roaminggamer likes this

[TOPIC: post.html]
#3

eto_ru

[GLOBAL: userInfoPane.html]
eto_ru
  • Observer

  • 17 posts
  • Corona SDK

Спасибо!



[TOPIC: post.html]
#4

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 293 posts
  • Corona SDK

Kiitos?




[topic_controls]
[/topic_controls]