Commercials on the game

BlitzMax Forums/BlitzMax Programming/Commercials on the game

Hardcoal(Posted 2012) [#1]
Lets say i want to put an online commercial in the game.
like a billboard.

is it possible to do so?


Zethrax(Posted 2012) [#2]
You're going to have to provide a bit more info.

Is this a 2D game or a 3D game? Which rendering library are you using for the game (Max2D, MiniB3D, etc)?

How do you want to display the ad? As a static image? As an animated image? As a movie? Do you want to render it fullscreen, in a viewport, on a 2D sprite, on a texture? Do you want the ad to be interactive (clickable to take the user to a website, etc), or is the ad purely for branding?

The more info you provide the better an answer you'll get.

You can certainly find a way to show an ad in most types of games, but if you need something elaborate like a movie playing on a 3D texture then you may be more restricted depending on the capabilities of the rendering library. Something along the lines of an animated image is certainly doable.


xlsior(Posted 2012) [#3]
is it possible to do so?


Yes...

You can load files from the web easily within blitzmax: Here's an example to download and display one of the google doodles:

Graphics 640,480
myimage:TImage=LoadImage(LoadBank("http::www.google.com/logos/2011/newyearseve-2011-hp.jpg"))
If MyImage<>Null Then DrawImage (MyImage,0,0)
Flip
WaitKey()


couple of points:
1) Notice that it says http:: , NOT http://
2) Loading to a bank first (as above) seems more reliable than trying to use loadimage directly
3) Always make sure that the image image is valid / loaded correctly before trying to draw it
4) Do note that there are many possible reasons this can fail, e.g. no working internet connection, or a firewall that's blocking access to the internet. e.g. ZoneAlarm requires you to allow internet access for each application that requests it, and the user has the ability to block it altogether.
Also keep in mind that there is also no telling how long it would take to download your data, so keep that in mind within your code. It may be a smarter idea to try to pre-fetch some data ahead of time rather than wait until the last moment when you actually need it right away.

Last but not least: If there is no internet access at the time of loading, it may freeze the program for a significant time before it continues. You may want to spin off a seperate process to obtain the ad data for you, and write the results to disk somewhere. That way the ad serv ice won't block your entire program from running.
(Better yet, you may want to pre-populate a default 'offline' ad to show in case your program turns out to be unable to communicate and obtain new information. At least that way you have -some- data to work with)


Hardcoal(Posted 2012) [#4]
tnx .. is it also possible to run flash commercials?


Derron(Posted 2012) [#5]
Do you take your question serious ? (not the beginners forum and you have 130+ posts).

Just take a breath and think about it by yourself - why are you able to draw an remote loaded jpeg image - because you included a jpeg loader, why a png, because of the png loader.
Hmmm now try to find a flash-"loader" in the blitzmax modules... seems you will not have luck to get one.



short: no it is not possible.


bye
Ron


PS: general answer to that question: just edit the users hosts file (etc/hosts or in the windows/system.../) and redirect your ad-server to localhost and voila... no ads - or even trickier: load a small server "sending" black images back to your game).

Last edited 2012