English Transparency and file formats

17 replies
Goto Page
To the start Previous 1 Next To the start
23.04.14 07:45:02 am
Up
Pagyra
User
Offline Off
At the moment, I personally replace all standard graphics of *.BMP files to format *.PNG, but save it filename as *.BMP .
But recently, I remembered that *.BMP format with 32 bit supports alpha channel (transparency) -
And so, there was a question to dc - is it possible to use it in CS2D (my test image is painted black) and whether it will replace the standard *.BMP to 32bit or *.PNG?
BMP is both uncompressed and lossless. PNG is compressed but lossless. Thus, with a lossless format the only visible difference is the file size(which is very useful for transferring files). I'd recommend using PNG over BMP unless you can't for compatibility reasons.

Will also connected support file formats like *. Gif and *. Apng? (At the moment, so a lot of problems with the creation of animations - a large number of frames, requires a large amount of files loaded into memory that heavily loads your computer.)
23.04.14 10:25:35 am
Up
Torque
User
Offline Off
Why would you even do that?
CS2D supports png sprites just fine, also with transparency.
In bitmaps 'magic pink' can be used for transparency.
Relax, relate, release. Visit: www.lsdservers.boards.net
23.04.14 01:59:00 pm
Up
Pagyra
User
Offline Off
I use the alpha channel for many images to simulate a shadow or glow. Pink color does not give such an opportunity. Compressed image takes up less disk space - that you can use to store cs2d at smartphones and communicators.
23.04.14 02:43:34 pm
Up
RisingXD
User
Offline Off
I liked the gif idea. Spray can be animated!
Rising XD: Say Hello to my little friend! (M249) & [bot]Adon-is-gay AWP Rising & [bot]Adon-is-gay: Nope.
23.04.14 02:52:47 pm
Up
Pagyra
User
Offline Off
For sprаylogo is just unnecessary. But for lua and for use in map editor it would be useful.
23.04.14 03:03:10 pm
Up
Accurator
User
Offline Off
You could also just show a different image every X (mili)seconds.
23.04.14 03:11:34 pm
Up
MikuAuahDark
User
Offline Off
@user Accurator: That's a dirty way to show animated images right now. Also it would lag the players(because cs2d cmd timer) for fast animations

@user Pagyra: I like the Apng idea actually because it's better than Gif
Hello? Are you there, Tae Hanazono?
23.04.14 03:26:51 pm
Up
Ortimh
User
Offline Off
@user MikuAuahDark: Seems he doesn't talk about cs2d lua cmd timer but for that cs2d lua cmd freetimer could be useful. Also I agreed about to show animated images.
I'm awesome ... and I really cookies
23.04.14 03:40:24 pm
Up
MikuAuahDark
User
Offline Off
@user Ortimh:
user Accurator has written:
You could also just show a different image every X (mili)seconds.

It uses cs2d lua cmd timer to call functon every X miliseconds which show another image. cs2d lua cmd freetimer only used if you want to destroy the animations(and maybe the image too)
Hello? Are you there, Tae Hanazono?
23.04.14 03:51:56 pm
Up
Ortimh
User
Offline Off
@user MikuAuahDark: Why use cs2d lua cmd timer? How about cs2d lua hook always hook? It is repeated every 50 milliseconds. Just create a new image and delete last image if exists. After the end of the animation, show first image and repeat it forever.
I'm awesome ... and I really cookies
23.04.14 04:35:49 pm
Up
Pagyra
User
Offline Off
I know perfectly well how to make any image transparent
how to make long-term, full-screen animation and stuff.
Currently (and for this purpose it was created topic) I'm trying to optimize the game to consume less computer resources the user and the best speed by net - I need it to create complex scripts and mods.
And for this and much more hope that DC will respond at my and your questions in this topic.

I've already written the reason why I do not use any timers to show different images:

Quote:
At the moment, so a lot of problems with the creation of animations - a large number of frames, requires load a large amount of files(images) into memory that heavily loads your computer.

I advise you to read full my messages for understand what i proper and want.
23.04.14 07:21:34 pm
Up
DC
Admin
Offline Off
BlitzMax does not support formats like gif or apng (or bmp images with alpha channels - if they exist). Especially gif support has been requested frequently but I won't implement it. That's because animated images require additional program logic (for playing the animations) and I can't simply "add" these formats without changing and adding a lot of code.

Just use PNG if you need alpha. You can also use it if you don't need alpha because it's compressed. CS2D's file transfer however compresses images (and all other files) anyway so it doesn't really matter if you use BMP or PNG. The sizes are basically the same after compression.

The approach to use PNG and to change the extension in the file name to ".bmp" is correct if you want to modify/change images of the original game. You shouldn't do this in other situations though because it leads to confusion (people expect a bmp if there is a bmp extension).
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
23.04.14 10:18:59 pm
Up
Pagyra
User
Offline Off
It is exists - http://en.wikipedia.org/wiki/BMP_file_format

Well then there is question about of multi-layered entity and moving light sources? Will it be added in the near future? And how soon will be possible to mix/blend some layers of overlapping images(sprites, textures, dyn.walls, ...)?

Maybe all this will be the solution at question of animations.

Thanks for the answer.
23.04.14 11:01:14 pm
Up
DC
Admin
Offline Off
Neither entity stacking (compatibility problems) nor blending/mixing of random images (performance/complexity problems) are planned.

Tile animations are possible with cs2d entity Info_Animation. That's currently the only "good" way to add animations (to maps).

I added a note about this to my todo list. It shouldn't be too hard to make a special Lua image command which supports animated images / a set of images. You shouldn't expect any CS2D updates soon. I'm working on Stranded III.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
24.04.14 07:15:29 am
Up
MikuAuahDark
User
Offline Off
user Ortimh has written:
@user MikuAuahDark: Why use cs2d lua cmd timer? How about cs2d lua hook always hook? It is repeated every 50 milliseconds. Just create a new image and delete last image if exists. After the end of the animation, show first image and repeat it forever.

It's every 20 miliseconds.
cs2d lua hook always has written:
Attention: This hook is executed very frequently (~50 times per second) so do not execute very complex/slow scripts with it!
Attention: Counter-Strike 2D may run with a slower (and also slightly higher) frames per second value. Please consider this when using this hook. Do not use it for timers.

But instead deleting(cs2d lua cmd freeimage) it, just make the image opacity to 0. cs2d lua hook always is laggy for slow network player, so cs2d lua cmd timer can be used as alternative (to show slower animations).
Hello? Are you there, Tae Hanazono?
24.04.14 10:32:07 am
Up
VADemon
User
Offline Off
@user MikuAuahDark: cs2d lua hook always is executed every 20ms and it's only server-side unless you actually send something to the player. I expect cs2d lua cmd timer to be performance demanding (again, server-side) because it function uses a CS2D internal functions (correct me, if I'm wrong). An implementation in Lua (as it would be the always hook) should be much faster.

cs2d lua cmd imagealpha = 0 good idea, but should be used wisely (not everybody has gigs of ram)
24.04.14 02:13:00 pm
Up
Pagyra
User
Offline Off
I noticed that the transparent image loads less computer.
My version :
Creating a cycle frame number for animation, check stock images for frames and frame numbers are assigned to images, creating animation timers.
Checking distance from the screen of player to the area in which the animation will be shown, if yes then, immediately create all frames of animation (Mode 101 - 200 + id), then set full transparency for all frames except the first, and run animation through "always" hook but with timer - by successive image frames state transition from transparent to opaque.
Additionally, depending on the distance from the player to change transparency of "opaque" frames. The closer to the visible ( to the screen) will become even more opaque " opaque " frames. The farther from the area of ​​the screen so it become more transparent . If the animation is beyond two screen sizes of screen area - animation frames removed for this player.
01.05.14 06:55:08 am
Up
FlamingPhoenix
User
Offline Off
Look like we only can make the Transparency Alpha support BMP stuff our self...
The fire blaze in my heart, the energy it gives me; Makes me stronger, and competitive. Does it sweaty? The heat...
To the start Previous 1 Next To the start