Forum
CS2D General Does Env_Sprite Equal to Image Function?Does Env_Sprite Equal to Image Function?
2 replies 1
There shouldn't be any significant / noticeable difference. In both cases the images are rendered the same way, causing the same load on the GPU. CPU time also shouldn't be much different (and is probably smaller by magnitudes compared to the GPU time anyway).
tl;dr: no (relevant) difference
Loading / Data
The actual difference is the creation of the image. env_sprite is created once when loading the map. image is created on the fly while the game is running. It also causes network traffic because it's not a static image which is saved in the map file but a dynamically created one. So all clients need to be notified about the image.
Also with image the image itself (the actual pixel data) is loaded at runtime (only once, the first time that image is being used) which can cause a small FPS drop or even a bigger one for large images.
tl;dr: env_sprite is better. Can't cause FPS drops at runtime and doesn't cause additional network traffic.
Best Practice
use env_sprite when the image is part of the map. Especially for static images.
use image for dynamic images / script controlled images
using a ton of trigger_delay and env_sprite to fake animations works but is not the most efficient solution. If you want top performance use a single image and a fancy tween like tween_move instead!
p.s.: env_image and env_sprite are also basically equal performance-wise. env_image is just an older variant of env_sprite with less features. It's only still in the game for backward compatibility.
edited 4×, last 01.11.18 09:57:33 pm
1