Followers 0

# Unity The Game Texture Loader

## 32 posts in this topic

So, I've got plans... great great plans and I'd like some feedback and what I've got thus far [grin] The basics is I plan to make a library which deals with loading textures and only loading textures. Infomation can be found here and I'll be updating it as and when I do things, however I'd like some feedback on my inital considerations. (This is also relivent) oh, and anyone who mentions SDL_Image will be shot for not reading the above links and the comments made [razz] [Edited by - _the_phantom_ on July 24, 2005 12:31:10 PM]
0

##### Share on other sites
Would this only be compatible with OpenGL or other API's too?

I suppose if the code was able to return pointers to simple RGBA values, which represent each pixel in the image, then it could be used by all API's. Is that what you are going for? That’s what my image library does, and while the memory taken is slightly more than it could be, it is quite flexible and used by both DirectX and OpenGL renderers.

It does defiantly seem like an interesting proposition, especially if you can keep it contained within one library.

By that, I mean, I have to use different libraries for loading different texture, so my current project requires jpeg lib, png lib etc. If I only needed to include GTL.lib (or whatever) then that would be a fantastic thing to use.

If on the other hand, your GTL used jpeglib and png lib, and I had to include them myself, I would be less likely to use it. Just my thoughts though.

What would be your standing on including gif images in the library also?

Sounds like a very worth while project and one I have often wondered why no-one else has done something similar.

Spree
0

0

##### Share on other sites
The plan is to make it API independant as possible, I dont see any good reason why it should favour one API over another.

As you say, its just going to be a case of passing a pointer to the values and telling you what format the data is in (RGBA, RGB, float, int, DXT compressed, whatever). Once you have that pointer you can do with it as you like.

Keeping it all in one library shouldnt be a huge problem, I'm a great fan of statically linked libs when the need arises and my last project was purely statically linked as well. So, it should have all the required decoding libs built in. Infact, if you are using an MS compiler it will be even easier as I always make a config.hpp file which will automatically insert pragmas to make the linker link to the correct library, so you'd just include GTL.hpp and it would work the rest out for you [grin]

Ofcourse, what with it being zlib based license wise there will be a source distro, so if poeple want to change/recompile it as a dll or whatever, they can.

GIF support is an option, however how common is it as a game image format? I cant say I've ever had need to use it myself, thus its exclusion from the inital format list...

edit: As to why no one has done it before.. well, they kinda have, however alot of projects start off as "I'll just do this" and kinda sprial from there, so they become a "jack of all trades, master of none" type thing. Me on the other hand, I'm too lazy to add features beyond what I need and I prefer to keep things focused as much as possible [smile]
0

##### Share on other sites
Quote:

hmmm... so it is... the link is being mangled for some reason when I post (I just tried to edit it)... it only points to the journal entry below the one first linked to anyways, it was kinda a convinance link to explain why I was going off on this anyways...

0

##### Share on other sites
Quote:
 Original post by _the_phantom_GIF support is an option, however how common is it as a game image format? I cant say I've ever had need to use it myself, thus its exclusion from the inital format list...

Well, I use it so its common enough for me ;)

Having said that, if it is open source would you be open to people submitting format classes that fit in with your libraries structure?

Spree
0

##### Share on other sites
yeah, that wouldnt be a problem at all, once it does the job for me and its released into the wild others can do with as they please
0

##### Share on other sites
Great idea, and I'd definately use it. Just give a shout if you need any help or any testing.

I would also suggest making the reading from file by using a callback function available. That way people who use zipfiles and such can also use this. libpng has a similar structure, as does libjpeg I believe.
0

##### Share on other sites
Phantom, your library would be a godsend for mine. I could incorperate yours as a standard implementation.

Tears of joy man, tears of freakin joy.
0

##### Share on other sites
@rick_appleton
Yeah, thats a thought I'd had and you mentioning it just confirms it as a good idea [grin]

@PnP Bios
heh, so you'll be intrested in it then? [grin]

Hopefully I'll start work on the inital version of it this week if not tonight (awakeness permitting)
0

##### Share on other sites
Save yourself the trouble.
http://www.imagemagick.org/Magick++/Documentation.html
0

##### Share on other sites
oh yes, I forgotten about that one, I've just looked at it and frankly the first page you linked to validates my concerns with mention of containers and other things which simply arent needed for something just designed to load images.

Infact, the opening statement of the page describes it as a C++ interface to the ImageMagick image processing library, so its hardly going to be small now is it.

The term 'overkill' springs to mind, now if you need all those functions then go use it, however I dont and I dont need all those 'features'.
0

##### Share on other sites
Then try:
http://www.paintlib.de/paintlib/
0

##### Share on other sites
Quote:
 Original post by barryseeThen try:http://www.paintlib.de/paintlib/

License is to restrictive. Consider this, if you create a library, not a program using it, how do you make sure that the end programer sticks the notice in the about box?
0

##### Share on other sites
Quote:
Original post by PnP Bios
Quote:
 Original post by barryseeThen try:http://www.paintlib.de/paintlib/

License is to restrictive. Consider this, if you create a library, not a program using it, how do you make sure that the end programer sticks the notice in the about box?

Too restrictive?
Quote:
 1# Do whatever you want with paintlib. Just don't come running to me with a lawyer if something goes wrong.

Sure there may be small differences in your plans and the other alternatives out there. Surely you will find things wrong with each one and justify your need to work on your particular project. That's your own perogative, and if it makes you happy, that's fine. I wasn't trying to stop anyone, I'm just showing you that it's somewhat reinventing the wheel. There are some viable alternatives out there. It would be easiest if you just kept to one graphic format for your program to where you could use a library specifically for that.. only that kind of library will be the lightest.
0

##### Share on other sites
good idea!

will it maybe be able to split large textures up like for example the popcap engine framework does?
0

##### Share on other sites
Could you elaborate on your problem with the LGPL?
0

##### Share on other sites
How is this better than Devil? You only said SDL_image :-)

For me textures are part of my material system, I can reuse textures but they are always bound to a state as well, and the actual loading of the texture is the trivial part. The hard part is the management of the state, the texture environment, making sure things get set on/off correctly, and determing how to use that texture on a particular object. If your library will solve that nicely than you are a golden buddha.

0

##### Share on other sites
Since its going to be such a simple library, it shouldn't be a problem to write it in C for maximum portability. Just a suggestion so that people like me could use it. If you want to you could always write a C++ layer on top of it. Also, provide a streaming interface of some sort, like that found in libpng so that the input data can be retrieved from a user-defined source.
0

##### Share on other sites
I wont claim that its not a slight wheel reinvention, the fact I dont plan to write all the decoding routines myself does offset that somewhat.

anyways, paintlib is closer to the mark, however its still too verbose in its way of doing things. The fact you have to create objects to move data in and out of seems abit daft to me, what is 3 lines in that code could well be reduced to one line in mine (be it the class or struct system).
As with before, saving and manipulation isnt needed either, nor can I see a sane way to work the things DDS textures support into it, i could probably be hacked with the psd layers stuff, but thats what it would be, a hack.

@AP
Not really, no. The idea is to load and present the data + infomation about it, what you do with the data after that is upto you and I would argue that any manipulation by cutting it up etc is in the domain of an engine, not an image loader.

@Konfusius
Its a personal thing I guess, but I just dont like it, I figure if something is free then make it free, thus my personal prefence for the zlib license. Unless there is a really good reason to have something as a DLL I prefer to compile things into my apps as well, so the LGPL focing you to either give away everything or dynamic link puts too much restraint on how I can compile my programs.
It could be fine for everyone else, but I dont like it so I prefer to avoid it and the GPL in favour of what I consider 'more free' licenses such as zlib.
0

##### Share on other sites
Quote:
 Original post by dcosbornSince its going to be such a simple library, it shouldn't be a problem to write it in C for maximum usability.

I'm not a C programmer [smile]
For example, the dispatching system to id images types vs there decoders will probably be held in an std::map.

That said, a C interface probably would be possible to it, it would have to wrap calls into the namespace and hide any C++ related stuff, but it should be do able, consider it on my 'todo' list [smile]
0

##### Share on other sites
Quote:
 Original post by Name_UnknownHow is this better than Devil? You only said SDL_image :-)

hehe, I only mentioned the SDL thing because I've noticed that often whenever people present a problem something SDL related is mentioned, so I thought I'd by pass it [grin]

For me, the plus' over DevIL are;
- its free free (zlib)
- the interface is going to be better (imo ofcourse)

Quote:
 For me textures are part of my material system, I can reuse textures but they are always bound to a state as well, and the actual loading of the texture is the trivial part. The hard part is the management of the state, the texture environment, making sure things get set on/off correctly, and determing how to use that texture on a particular object. If your library will solve that nicely than you are a golden buddha.

I think you are expecting too much from it, its going to simply for loading and presenting data, anything else is in the domain of an engine, which this doesnt pretend to be.
0

##### Share on other sites
How funny , i did just a library to do that , fully opengl compatible.
0

##### Share on other sites
Quote:
 Original post by ketekHow funny , i did just a library to do that , fully opengl compatible.

I wrote mine a while ago, then re-wrote it a few times to make it more generic. Unlike _the_phantom_'s however, it's written in C, and the structure I use doesn't store the mipmaps, and it sticks to basic data formats (RGB, BGR, RGBA).

I've currently implemented the following:
- BMP reading (24-bit only, since I'm rather lazy)
- PNG reading (most of which code I ripped from some tutorial somewhere, with quite a few modifications so I can get the relevant information from the file)
- JPEG reading (thanks to a *lot* of fiddling with IJG's JPEG library)
- XYF reading (my own image format that uses zlib compression (works slightly better than PNGs if there's more repeated data, otherwise it's slightly worse))

I can add others fairly easily, since I made all of the image loading code independent (so you can use the bitmap loading code without the rest of it). I must say that it's really great when you can load any image with a single line of code, but when you play with code you barely understand (like IJG's library), it does get a little annoying when your program dies for no good reason (all fixed now though, hence the 'fiddling' comment).

As for the C/C++ interaction, you can always use something like this:

struct Texture {  #ifdef __cplusplus__  public:    Texture();    ~Texture();    //insert other functions as necessary    //depending on how you want to make it, you could make the variables public,  //even if it is against the OOP way of thinking ;)  private:  #endif  //insert data as necessary};#ifndef __cplusplus__typedef struct Texture Texture;//so you use 'Texture' as a type in C#endif//insert C function definitions here

The only major problem with this is there's a lot of redundant calls made, regardless of how you do it.
0

##### Share on other sites
Quote:
 Original post by _the_phantom_@KonfusiusIts a personal thing I guess, but I just dont like it, I figure if something is free then make it free, thus my personal prefence for the zlib license. Unless there is a really good reason to have something as a DLL I prefer to compile things into my apps as well, so the LGPL focing you to either give away everything or dynamic link puts too much restraint on how I can compile my programs. It could be fine for everyone else, but I dont like it so I prefer to avoid it and the GPL in favour of what I consider 'more free' licenses such as zlib.

Generally, I also prefer static libs to DLLs.
However, in one library I write, I decided to use LGPL, even though that lib in most cases will be statically linked.

Why? Well, AFAIK, author is free while deciding on license, and he can say:

or

- "I choose license X but without rule Y"

Sure, then this question arises: "So, why do you use license X and then say that it's without rule Y, wouldn't it be better just to say: license K?".
As you said, "Its a personal thing" :-) also, IMHO LGPL is more familiar amongst programmers. So, in my case it looks like this:

- "I choose license GNU LGPL but you aren't forced to link dynamically"

I hope it's legal, what do you say...? If it's, then there aren't any more problems with LGPL, you know... :-)

--------------------

Btw, _the_phantom_, if that library could be configured to load .pngs, and only .pngs (probably by #ifdefing other "codecs" in code), and it could spit out newly created SDL_Surface with that image, without the need to convert it manually, then I would be the second person to use it (first would be you ;-)).

You know, SDL is rather widely used library, and with such function you could create decent competition to SDL_Image. Imagine sth like this:

#ifdef GTL_USE_SDLSDL_Surface * GTL_LoadImage(const char * filename);#elsevoid * GTL_LoadImage(const char * filename);#endif

So, in order to compile with SDL support, one would uncomment #define GTL_USE_SDL and recompile whole lib. Voila! :-)
0

## Create an account

Register a new account

Followers 0

• ### Similar Content

• By NA-45
EDIT: We've found a designer/composer and an artist.  I'm looking for one more artist!

I'm currently working on Metroidvania style game that I was inspired to start by Hollow Knight and Beksiński's art.

It's built in Unity using C# and has quite a bit done already.  I'm handling the programming myself and have a working model (besides combat which is a WIP) that can be expanded greatly depending on where we decide to take the project.  You can see the current test area here: https://streamable.com/mp5o8  Since I'm not artistically gifted, its all rectangles but can easily be skinned once we've desired on designs.
I have professional experience using Unity and C# working on both a released game and a prototype as well as having extensive Java knowledge.  I also dabble in Python with a little bit of C++.
I have worked on and completed many projects before, the most recent being a 2D stick fighting game written ground up in Java Swing (don't ask why): https://www.youtube.com/watch?v=V4Bkoyp_f0o
I'm looking for a 2D artist (potentially more than one) to create concept and game art and a designer/writer who can help flesh out the story as well as map out and create challenging and eye catching areas.  I can handle most if not all of the programming side of things though if there is anyone who is extremely passionate about this sort of thing, I'd consider splitting the load.
The end goal is a completed game that can be sold however profit isn't really a concern to me as it's mostly a labor of love from my part.  Any profits would be split between team members however that's pretty far off so don't make that a reason to join.
______________________________
The story I have in mind is something like this:
A man wakes up in a chasm that stretches seemingly endlessly in both directions lined with enormous statues.

He discovers a temple with text above a closed gate that tells of the failed kingdom that lies below.  After finding a way around this, he drops down into the subterranean kingdom.  Adventuring through the labrynth below, he comes across different cities in which the residents succumbed to different sins such as Greed, Wrath, etc.  Each city tells a story of how its fixation on something lead to their demise leading up to a fight with the personification of their mistake.
______________________________
An very rough idea for Waterways, a potential area:
- To enter you must be wearing a pair of glasses that you find somewhere earlier in the ruins.  There are similar glasses found in every home.  Everything appears incredibly beautiful however something seems wrong.  After triggering some event, the glasses break and it's revealed that the glasses are made of some sort of stone that makes everything appear differently.  The city is in ruins and absolutely disgusting as everything was neglected.
- The only thing that remains intact is in the center of the city, an incredible statue of a goddess holding up a large sphere of the same material that was used for the glass.  You slowly learn the story behind the statue: the goddess came from the sea that the city lies on and brought prosperity to them.
- After opening up the the temple of the goddess that lies right on the edge of the waters, a giant sheet of the glass covers an opening in the back of the temple that reveals the goddess behind it.  You shatter the glass and it becomes apparent that the goddess is actually a disgusting creature half beached and mostly immobile that appears to secrete the material that makes up the glass. Fight ensues.
______________________________
The combat is pretty up in the air and part of the reason I need a designer to bounce ideas off of but I think it will be something like this:
- 4 orbs equipped at a time
- 2 orbs selected at a time
- Pressing the cast button will cast a spell determined by the 2 orbs that are selected
- Spells cost mana however you can use spells with 0 mana and it will cost health instead
- These spells in addition to being useful for combat, are the Metroidvania "gating" metchanic.  For instance, one of the conceptualized spells is a water orb + water orb to create a ice pillar that can be either used to block projectiles/enemy paths or to jump on to reach high areas
______________________________
If you're interested or have any questions, contact me through discord.  My id is NA-45#3692.
• By sZokka

Radio Rabbit is a local coop shoot ‘em up where two players control one more or less combined character. The character exists out of a rabbit’s body and a floating, still to the body connected, giant eye.
Each player controls one of them.

The rabbit’s goal is to fly safely through the level and to avoid enemies to reach the goal.  The Eye on the other hand can shoot. He is the one who clears the way. One character can move the other can shoot. So both player need to work together to fight of evil creatures and to complete the level.

•    explore the level to find the key which activates the portal gate
•    escape through the portal before the timer runs out
•    if you are to slow, the nuke will explode
•    use your character abilities, the rabbit can boost while the eye got the vision
•    you’ll get more powerful abilities from items such as a supershot
•    shoot as many enemies as possible to gain score
•    remaining time at the end of each level gets added to the score

Features
•    2 Player couch coop
•    4 level + tutorial
•    an epic boss fight
•    fully gamepad supported (XBox or equivalent)
•    local high score

Grab a friend and check it out!
and ENJOY!
• By qvertyVR
Hello everyone! We are a small VR studio and we want to get some opinions about our new game which name is Gravity Tunnel VR. If you are interested please please visit our webside 👉 https://qverty.com/gravity-tunnel and let us know: -What do you think about it ? What we should to change? and Do you want to play this game? All opinions well see. -Second question is where we can find some small influencers who can play our game and say something about it? Do you know some people or places where we can find them and how contact them ? Do you have any experience about it? Thanks for all reply!
Screens from our game :

• Hey guys! Let me introduce to you a new mobile game Lumber Well. We was starting open beta. We need your feedback that helps make game better than it is.
Sincerely, HolyByteGames Team.

Contacts:
holybytegames@gmail.com
https://www.instagram.com/holybytegames

• The boy and the Golem were friends for a long time, and have traveled together.
In search of the boy's father, they go to where he grew up, places now devastated by war.

The player can at any time switch the characters and manage to solve a specific task.
The boy is small and weak but is clever and an archer.
Golem is big and strong, but slow, and prefers melees.

The game includes the boom (required for archery) and apples (to restore his health). Golem Health is restored automatically. On the way our characters will encounter enemies and locked doors, and to open the door you must activate rock platforms nearby (decorated with blue stones that are activated by Golem from on the ground, and green that are activated from an arrow launched by the boy). Some doors will open only with simultaneous activation of a few (two or three) different types of stone platforms.

Controls:

Movement - W, A, S, D
Switch character - Tab
Direction of impact \ shot - mouse (cursor position)
Attack:
Golem - LMB
Boy - When sandwiched RMB (Aim), press the LMB, for a shot
Jump - Space

TheBoyAndTheGolemSetup.exe

• 19
• 14
• 23
• 11
• 28