HaxeFlixel / flixel

Free, cross-platform 2D game engine powered by Haxe and OpenFL
https://haxeflixel.com/
MIT License
1.99k stars 439 forks source link

Reconsider the default value of FlxCamera.pixelPerfectRender on native targets #1065

Closed Gama11 closed 9 years ago

Gama11 commented 10 years ago

Currently, it's true by default on all targets for the sake of consistency. However, in most cases, pixelPerfectRender == false yields better (smoother) results on native targets at practically no performance loss. On flash however, true is necessary as a default setting for the added performance (although it seems surprisingly usable to have it set to false in Mode).

I'm thinking it might make sense to make the default depend on the render mode. Things can't be totally consistent cross-platform, sometimes it makes sense to choose the best setting based on the target - see the special logic in FlxButton for no highlight frames + swiping on mobile.

pixelPerfectRender:Bool = #if FLX_RENDER_TILE false #else true #end

For people who want to use pixel perfect rendering on native (pixel-art games etc), this would still be easy to accomplish due to the new global camera flag.

cc @gamedevsam @PaulGene @cwkx @schonstal

AndreiRegiani commented 10 years ago

By my observations, the best configuration for low-res (pixel) games are: (HaxeFlixel default)

pixelPerfectRender = true
fixedTimestep = true
camera.antialiasing = false

For high-res games, this works much better:

pixelPerfectRender = false
fixedTimestep = false
camera.antialiasing = true
SeiferTim commented 10 years ago

Are these typically always used in tandem? Except in rare circumstances, would most people either do all of these: pixelPerfectRender = true fixedTimestep = true camera.antialiasing = false Or all of these: pixelPerfectRender = false fixedTimestep = false camera.antialiasing = true Meaning, in the FlxGame constructor, we could add an optional (or not optional) parameter like useHighResRendering which, if true, sets the second group, and if false will use the first group?

cwkx commented 10 years ago

Managing this stuff with a global camera flag is fine, as long as it's easy to do, and well-documented for new users to select their preferences based on their game type, as Andrei proposed.

Gama11 commented 10 years ago

I'm not sure fixedTimestep is really connected to high res games. It's more related to whether or not the game depends on physics and / or has to be deterministic.

Closing this, as nobody really seemed in favor of changing the current default.

AndreiRegiani commented 10 years ago

I am really in favor to change the current default.

Recent forum post: https://groups.google.com/forum/?utm_medium=email&utm_source=footer#!msg/haxeflixel/Gcw-oxL09T8/jgm5GRaofAIJ coin_comparison

Anyone developing anything serious will change these values, modern game engines uses the same:

fixedTimestep = false               // "delta time" animations
camera.antialiasing = true
pixelPerfectRender = false

@Gama11 fixedTimestep is connected with his res games because it gives much better results.

To grow the user base, this project should be more appealing for commercial development (high-res), not for "game jam pixels".

gamedevsam commented 10 years ago

I am also in favor of changing pixel perfect rendering value. Especially for targets that use tilesheet rendering.

sruloart commented 10 years ago

Why not set a "FlxG.render = PixelArt"? This way all the settings are pre(-ish) configured.

Gama11 commented 10 years ago

@AndreiRegiani That's simply not true, a variable timestep doesn't always give better results. If you rely on deterministic phyiscs, a fixed timestep is usually preferable. I don't see how this is related to the art style. Article on timesteps.

Also... "Anyone developing anything serious"? It's not possible to use pixel art for "serious" development then? :P

@gamedevsam There's no "especially" here, not using pixelPerfectRender = false; is too expensive when using blitting to be the default.

sruloart commented 10 years ago
  1. "A variable timestep doesn't always give better results" = you're right, it has little to do with art, what they probably mean is that their games seem to run "better" without it, which in some cases may be true, from totally different reasons. Anyhow I wouldn't make it a part of the "HD" mode anyhow.
  2. Shovel Knight! Pixel-art dev is as serious as gamedev can be, but the fact is that it's only one specific type of gamedev. There are others. Just saying :)
gamedevsam commented 10 years ago

@Gama11: I understand, so why not make pixelPerfectRender false by default for tilesheet rendering and true for blitting? I'm not a fan of changing the timestep default.

AndreiRegiani commented 10 years ago

@Gama11 It's not related to the art style, by "pixel art" I meant low-resolution, example: 256 x 240 with zoom (2x), in this case antialiasing must be off and fixedTimestep false, this is the typical Flixel game.

Gama11 commented 9 years ago

@JoeCreates Since pixelPerfectRender now defaults to false with FLX_RENDER_TILE, should pixelPerfectPosition default to false as well?