BitmapFromFile

If there is something important you think is missing in the current version of ZGameEditor then you can post a feature request here!

Moderator: Moderators

Post Reply
User avatar
Kjell
Posts: 1911
Joined: Sat Feb 23, 2008 11:15 pm

BitmapFromFile

Post by Kjell »

Hej Ville,

If it ain't too much of a hassle, I'd like to see one of the current limitations of the BitmapFromFile Component ( as mentioned in the Component Reference ) being lifted, namely the fact that Alpha channel information is not imported.

Thanks in advance,
Kjell
User avatar
VilleK
Site Admin
Posts: 2324
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

It should not be so hard. Do you have a good texture-bitmap with transparency that you can post here or PM? That would help me test this.
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et »

I'd like to bump this thread, not because of the previous topic, but because it refers to the component.
.
"...Importing bitmaps will increase your exe-file size very quickly..."
.
I'm wondering if this component can have a checkbox option of the usual way of importing textures from a tag-along "Data" file. Besides helping the .exe size, this adds user modding.
.
I'm looking at the FPS demo, and that, along with map .txt file, makes for an attractive user participation option.
.
I suppose this train of thought would lead to sound effects, etc. also.
User avatar
Kjell
Posts: 1911
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hello,

Correct me if I'm wrong ( Ville ), but I believe one of the reasons ZGE builds such small exe's is that it doesn't include importers for file formats such as bmp, 3ds and wav. Instead, files are converted into the "native" engine formats when they are imported by the Editor.

Now this doesn't mean that external data resources wouldn't be possible, on the contrary .. but it wouldn't really be useful for opening up games to customization in that way as Photoshop / Softimage / etc. wouldn't be able to open up the data.

Personally I'd take the "Little Big Planet" route when possible, where all customization is done within the Game itself rather then relying on external software and file formats.

Don't get me wrong though, I'd welcome the ability to load external sound / image files on the fly as well :)

*And a new / separate thread for this feature request might have been a little more appropriate.

K
User avatar
VilleK
Site Admin
Posts: 2324
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

One of the early design decisions about the ZGE-engine was to minimize the number of files needed to redistribute the games. There are several reasons:

- No external dependencies to other files in runtime. If you have the exe then it will work. My opinion is that single file distributions are elegant.
- No external dependencies to other files also in designer. The whole project is in the zgeproj-file.
- Whole program including data can be compressed with exe-compressors
- And as Kjell mentions, no file format parsers are needed in runtime. When you import 3ds, bitmaps and audio into ZGE it is converted to a simple internal format. Having 3ds/jpg/bmp/tga/mp3 parsers built into the runtime would significantly increase runtime size and complexity.

Having said the above, I would imagine that when we start expanding the scripting-functions with functionality it would be very useful to add some kind of "loadTexture('setse.tga');" function. So I won't rule it out totally but it won't happen in short-term.
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Some stuff has a quite-simple structure so we might come up with a ZLibrary for importing some "simple" bitmaps/models. Actually, if this is the case it will probably be with the advancing of the scripting language. However I can try to get a TGA importer in a ZExpression/file component :P although I don't know anything about TARGA files! xD

Jockes apart... if we were to offer the final user a little bit customization... I would prefere them to be able to define some "producer-code" created with the editor itself... EG: you tell them a list of stuff they can overwrite (like the mesh used by a model) and they do create that object in their own ZGE "data" file using our editor. That data will be read when the Exe will be executed and the content would "overwrite" (better, overload) the mesh/bitmaps you defined. This will not be that easy, but could be an elegant solution since ZGE runtime is not "compiled", but only "interpreted".
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

I can see all the sides of this one; on the one hand, yes moding could be done easily with external files, as well as many other things,. (a cool little app that could say, generate a fancy random 3d media show on a folder of image files you run it from) on the other hand it is a sweet deal to have a nice single compressed file with the whole game and no file structure to install, etc. Kjell is right in pointing out that by using the current file writing component in game map/character/ect. editing can be created and saved. In fact I am planing to develop such a system soon for an idea i have,. so user maps will be generated in the game (in an edit mode) and can then be shared easily,. .
iterationGAMES.com
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et »

transparency - definable color

There is a boatload of great liberated textures from "do you remember when?" that used other than black for transparency, and used black as part of the design.
I guess the bitmap-animation is done with a large texture containing all animation frames and then modifying texture coordinates?
I made a marching soldier this way by cobbling together some sprite textures, but it involved a lot of work to change the colors. This feature would make it dead easy.
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et »

I was wondering why it took a few seconds for my game to compile and run, as opposed to the usual almost instantly. Irfanview has an information feature and I noticed my newest bitmap had entries in dpi boxes for printing it out. Blanking these boxes restored ZGE's quick compile.
"great expectations"
User avatar
Kjell
Posts: 1911
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

8)

Attached is a example on how to use any color you want as Alpha Mask.

K
Attachments
Mask.zgeproj
(4.48 KiB) Downloaded 1049 times
User avatar
Valerious
Posts: 11
Joined: Mon May 03, 2010 9:26 pm
Location: Russia, Moscow

Post by Valerious »

Without function:

Code: Select all

float rr,gg,bb;
rr=this.Pixel.R;  gg=this.Pixel.G;  bb=this.Pixel.B;
this.Pixel.A = 1-(rr==0 && gg==1 && bb==1); // 0,1,1 RGB(0,255,255)
User avatar
y offs et
Posts: 418
Joined: Wed Apr 22, 2009 4:26 pm
Location: BC, Canada

Post by y offs et »

That's a good trick. It's really tough touching up the bordering near black parts when you're using the black as transparent.

I might as well post my work around for converting bitmaps with black as part of their palette. I use Gimp to save them in .xpm format, read it in text editor. The index is easy to change 000000 to 000001, and observing the rest, it's easy to figure which symbol to change to 000000. Then reloaded into gimp and save as 24bit .btm ( watch the advanced options! )
"great expectations"
User avatar
rrTea
Posts: 475
Joined: Sat Feb 15, 2014 9:54 am

Post by rrTea »

Kjell wrote:8)

Attached is a example on how to use any color you want as Alpha Mask.

K
Valerious wrote:Without function:

Code: Select all

float rr,gg,bb;
rr=this.Pixel.R;  gg=this.Pixel.G;  bb=this.Pixel.B;
this.Pixel.A = 1-(rr==0 && gg==1 && bb==1); // 0,1,1 RGB(0,255,255)
Such useful tricks (without it, dealing with transparencies in 8 bit pngs is really too impractical!) should really be added to the "tips and tricks" part of the forum, who will ever find them burried in this thread :)
Post Reply