2D opengl 游戏中多屏幕支持的提示?

发布于 2024-10-31 12:51:39 字数 240 浏览 2 评论 0原文

支持多屏幕的问题已经被问到死了,但我还没有看到太多关于游戏开发的讨论(使用碰撞箱、碰撞检查等)。

目前,我的游戏正在“兼容模式”下运行,由于升级,在高端设备上产生的视觉效果非常差。我正在寻找其他人为使他们的游戏图形在所有屏幕尺寸上看起来都很好而所做的工作的提示和建议。

开发人员是否包含每种资源(中密度和高密度)的 2 个副本,或者高密度资源是否只是针对较低密度设备按比例缩小?

您的计算中是否使用了与密度无关的像素?

The question of supporting multiple screens has been asked to death, but I haven't seen much discussion in regards to game development (with hitboxes, collision checking, etc).

Currently, my game is running in "compatibility mode" producing very poor visuals on higher end devices due to upscaling. I'm looking for tips and recommendations for what others have done to make their games graphics look good across all screen sizes.

Do developers include 2 copies of each resource (medium and high densities) or are high density resources simply scaled down for lower density devices?

Are density-independent pixels used in your calculations?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

意中人 2024-11-07 12:51:39

开发人员是否包含每种资源的 2 个副本(中密度和高密度),还是只是针对低密度设备缩小高密度资源?

这是处理问题的一种方法,我已经看到了以下工作:

  1. 包含您想要支持的每个分辨率的位图
  2. 包含您想要支持的最高分辨率的位图,并缩小其他分辨率。
  3. 使用矢量图形以获得您想要支持的最高分辨率。

当使用方法 2. 或 3 时,我的处理方式是:

  • 创建目标为 960 x 1600 屏幕尺寸的资源。
  • 480 x 800 - 缩放一半
  • 320 x 400 - 缩放三分之一

这为我提供了未来计算所需的屏幕密度值。

我更喜欢方法 3。

我目前正在开发一个等距 2d 游戏引擎,该引擎从磁盘加载 .svg 资源,然后在舞台的“加载”部分将它们“绘制到位图”。通过这样做,我在运行游戏时获得了较小的磁盘空间 (.svg) 和更快的性能(位图)的优势。

工作流程如下:

  1. 解析关卡所需的游戏资源 从
  2. 磁盘加载相关的 .svg 资源
  3. 将 .svg 内容绘制为位图
  4. 丢弃加载的 .svg
  5. 对所有资源重复
  6. 启动关卡

您的计算中是否使用了与密度无关的像素?

是的,我使用它如下:

sprite.x = new_x_position * screen_density;

Do developers include 2 copies of each resource (medium and high densities) or are high density resources simply scaled down for lower density devices?

This is one way to handle things, I have seen the following done:

  1. Include bitmaps for each resolution you want to support
  2. Include bitmaps for the highest resolution you want to support, and scale down for other resolutions.
    • If you use a tilesheet (i.e. multiple small bitmaps in a larger bitmap) you need to be careful of bi-linear filtering, that is, blending of the edge pixels with adjacent assets. If this occurs you will get lines/artifacts in your assets. There is a discussion here: http://developer.anscamobile.com/forum/2011/06/03/lines-between-my-tiles regarding this issue.
  3. Use vector graphics for the highest resolution you want to support.

When using method 2. or 3. this is the way I handle it:

  • Create Assets targeting 960 x 1600 screen size.
  • 480 x 800 - scale by half
  • 320 x 400 - scale by one third

This gives me the screen density value I need for future calculations.

I prefer method 3.

I'm currently working on a isometric 2d game engine that loads .svg assets from disk then "draws them to a bitmap" during the "loading" portion of the stage. Doing this I get the benefits of small size on disk (.svg) and faster performance (bitmaps) while running my game.

The workflow is as follows:

  1. Parse necessary game asset for a level
  2. Load related .svg asset from disk
  3. Draw the .svg contents into a bitmap
  4. Throw away the loaded .svg
  5. Repeat for all assets
  6. Start Level

Are density-independent pixels used in your calculations?

Yes, I use it as follows:

sprite.x = new_x_position * screen_density;
千鲤 2024-11-07 12:51:39

许多开发人员包含资源的两个副本或在首次运行时下载高分辨率副本。如果他们在第一次运行时下载,那么他们就不会使用 Android 资源管理器。

Many developers include two copies of the resources or download high resolution copies on first run. If they download on first run, then they are not using the Android resource manager for those.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文