Forum

> > CS2D > General > Does Env_Sprite Equal to Image Function?
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Does Env_Sprite Equal to Image Function?

2 replies
To the start Previous 1 Next To the start

old Re: Does Env_Sprite Equal to Image Function?

DC
Admin On Online

Quote
Rendering / FPS
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. cs2d entity env_sprite is created once when loading the map. cs2d lua cmd 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 cs2d lua cmd 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: cs2d entity env_sprite is better. Can't cause FPS drops at runtime and doesn't cause additional network traffic.


∗ Best Practice
√ use cs2d entity env_sprite when the image is part of the map. Especially for static images.
√ use cs2d lua cmd image for dynamic images / script controlled images
× using a ton of cs2d entity trigger_delay and cs2d entity env_sprite to fake animations works but is not the most efficient solution. If you want top performance use a single cs2d lua cmd image and a fancy tween like cs2d lua cmd tween_move instead!

p.s.: cs2d entity env_image and cs2d entity env_sprite are also basically equal performance-wise. cs2d entity env_image is just an older variant of cs2d entity 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
To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview