Wednesday, May 30, 2012

Generic Video Solution for Games

Hi all

this time i will talk about the video in your game..
well, first i will say that this issue was back in my head for long time, but recently, after i talked with my friend who has to buy video solution for their game, it popped to my head again...
why is it so complicated to make video solution for games?
my friend answer was, if you are going to make a cross platform game, want real-time speed, alpha channel support then you don't have any alternatives but to buy bink.

for these who don't now, bink is a cross platform video solution developed by rad game tools, its fast and easy to use and the quality isn't so bad either.
so what's the problem you ask? well, the price! its too expensive, 8500$ per platform per game, yes yes you read this right.

so for example, if you are a small indie developer and you are going to make a windows and xbox360 game, you will have to pay 17,000$, that's a lot of money for indie! hell, its a lot of money period!.

besides, most of the games will need to play video only at the beginning of the game, for example, some game story video, hardware video (nvidia, havok, amd) etc.. and for that its a real pain that you need to pay that kind of money.

anyway, what else you can do? well, you can create you own video solution for both xbox360 and windows.
for windows: use windows vfw lib
for xbox360, use xmedia lib

but this will take time, and you will have to design some nice lib to have same functions in both windows and xbox360 for the same/different features you have in each platform, and that's if you have 2 platform, it gets really dirty for more.

in my experience, if you need to create your own video solution for the ps3, you are unlucky, in the past i created video solution for an in-game ads company, and i used libsail that comes with sony sdk to support video playing on the ps3, let me tell you that in one word: nightmare!

lets say you want to play videos without sounds, lets say for explosions, menus etc... and the sound comes from your sound system (that you already licensed) triggered sounds when needed.
well, you don't have any kind of solution for this one too... same problem as i said above.

so it turns out that you don't really have any generic video solution for you game, that doesn't rip your wallet...

so why don't we have anything other than bink for games you ask? well i can't really answer this question, as i'm asking it myself for some time.
i turn out that even if you think you have what it takes to write something like bink, it is very difficult to do that, thats because its not so easy, and there is a lot of patents around video/audio compression that you need to carefully walk around so you won't land on a mine.

so maybe you ask yourself, what all these words, i already know that, so don't walk on my wounds...

what if tell you that there is an alternative!
maybe not so complete unit as bink (not supporting all the platforms etc), but will support:
* popular platforms and will add new ones in time.
* alpha channel in videos
* real-time speed
* good compression ratio.

and the crazy thing about it, it won't cost 8500$ per platform per game!

so the real question is:
will you be interesting in such solution?
if so, please write a comment to this post and i appreciate if you could write what features you want in such solution, how much do you think it worth paying for etc..

thanks and stay tuned, cya


dotsquid said...

Isn't Theora enough?

dotsquid said...
This comment has been removed by the author.
orenk2k said...

you asked if its enough, well, it depends what are you trying to do and on which platforms.
i can say few things about theora:
1. BSD license
2. its general video solution so its not direct for games.
3. no alpha channel support (again not direct for games)
4. depends on other libs, so code will be large.
5. they say its cross platform, but they don't have specialized code for each platform, so performance won't be good enough.

what i'm talking about is a simple lib, direct for developers that doesn't need to dig and understand how to compile and why performance isn't good, just call open, get the frame and you are done, and all in all inside simple small and optimized lib.
simplicity of bink with nice price for everyone.
thanks for your comment, cya

Mau78 said...

Hi Oren!

I would love to have such a small footprint library for my own project.

Also looking for UI library for both menus and in-game UI....

About "how much" for that kind of work I really don't know...I could be intersted on a "per-project" license....

Best Regards

orenk2k said...

for video, soon i will put download files for testing and checking my solution (encoder and player)

as for ui solution, i have pretty good one too, but no plans to make it public.

thanks for your comment

Mau78 said...

UI "not for the public" you mean neither upon a license fee??


orenk2k said...

yes, its too much of a work to make it public.

Joost van Dongen said...

You are indeed tackling a common and irritating problem here, I think. Since Bink is too expensive, we have implemented video ourselves on 360, PS3 and PC/Mac, using different libraries on each platform. Especially PS3 was hell, but it is also horrible that we need to compress our movies for each platform separately.

Since we already have this, I don't think we would by your solution, but I guess any feedback is welcome for your project. If we didn't have this already, then I would be interested if your library had the following properties:

-$500 per game (or per studio?) for indies, not more!
-Support for at least Windows, Mac, Linux, PS3, 360 and WiiU (shortly after release of that console at the latest). Preferable also 3DS, Vita, iOS and Android, but those are less important for me personally.
-Not just video decompression, but also easy to use with several APIs. So I would want this tool to just have a texture ID for me every frame that I can use however I want. This means that the library would need implementations of video textures for at least DirectX (PC/360), OpenGL (PS3, Linux, Mac), GCM (PS3) and whatever the WiiU has.
-Same for audio. It should be easy enough to plug the output from this into any audio library. Probably by being able to ask for the latest samples, or by letting your library output to a small looping ring soundbuffer.
-Easy to use, automated tool chain that compresses tons of movies to all necessary platforms at once. Should have full command line support for easy integration into automated build processes

orenk2k said...

hi 'Joost van Dongen'

i appreciate your comment.
you mentioned the features you would like to have in such tool and i think you are right.
here is few of whats i'm going to

expose at first stage:
1. no internal video texture handling as video texture stuff have its own implementation/optimizations on each platform.
you will get relevant frame info and its uncompressed pixels so what you have left to do is to lock your texture copy and unlock, done.

2. audio same thing, like you mentioned, you will get relevant audio info and audio data so you could inject/streamed buffer it to your own lib (fmod/openal/miles etc..)

3. command line tool for easy batch conversion etc.

4. UI for that command line tool for easy conversion

5. very easy to use api.

6. supported platforms: pc/linux/mac, because as you know, getting permission for xbox360/ps3 isn't easy as downloading xcode for mac, i need to talk with sony/ms for permission to do that and its wont be so cheap to get a devkit for these consoles so this will be at a later stage depending on sells.

7. few or more samples to show you how to use it, opengl/direct/fmod etc, all these will depend on users response, this takes time and i want to be sure any sample/demo i will put in the sdk is worth the time.

btw: if you know people who have a word in this area or think they will need such tool in the future it will be great if they could vote.

once again, thanks for your commenta, really helps.


Joost van Dongen said...

I know it is difficult to get permission from console manufacturers, but at the same time: if you only support PC/Linux/Mac, then I doubt there will be a lot of market for what you are making. Theora is quite good and easy enough, so why spend any money on something else? To me the library becomes useful only if it supports a lot of platforms, since each individual platform has at least one acceptable free alternative already.

orenk2k said...

as far as i know, lib theora isn't fast enough, not supporting alpha channels, and depends on more than one file.
also memory usage is very important in games, i know what i will use, and as far as i know its smaller than any other lib i know, free or not.
how much theora is using?