View Full Version : EyeCandy Contest

19-12-2006, 06:39 AM
Did you know about the "FreePascal EyeCandy Contest"?

Copied from the Lazarus Forums (http://www.lazarus.freepascal.org/index.php?name=PNphpBB2&file=viewtopic&t=3049):

I'd like to show to some people that FreePascal (and Lazarus) can do good graphical and efficient things Surprised)
So I organise an eye candy contest, with some simple rules, and I'll give three rewards ($150, $100 and $50) for the three best programs.

The rules :
-The end of the contest is December 15th (i may change the date if it shows to be way too short)
-The source code of the program (and used pictures + ressources) will be posted on Internet under the GPL, so be sure of what you use

-The program MUST : *Compile and work in fullscreen mode under Ubuntu 6.10 (i386), in at least 640x480, 800x600 and 1024x768 with Gnome or KDE
*Be readable (the will be used as a tutorial for graphics with FP)

-The program COULD :
*Also compile under Win32 and/or MacOS (not necessary but will be good to show how powerful FPC is)
*Support some options : printing the FPS, a max FPS limit, or the use of a "bpm" global (to synchronise it with music)
*Be used as a screensaver in Linux

You can use anything you want : GLScene, Jedi-SDL, etc...
The test machine will be an Athlon 64 3800+, 1Go DDR, Geforce 7900GTO with nvidia proprietary drivers.

What is an eye candy ?
These are Eye-Candy ScreenSavers Wink

Ask if you had questions !

Until now nobody has submitted any entry, which is a bit disapointing. If you are interested, let MarcP know, he will consider a two months extension.

19-12-2006, 08:29 AM
So how do you write a screensaver in Linux with Free Pascal?

19-12-2006, 09:58 AM
And it seems we are past the deadline.

19-12-2006, 11:34 AM
And it seems we are past the deadline.

As you can see in the thread on the Lazarus forum, MarcP is willing to extend the dead line by two months. But if nobody is interested, ....

19-12-2006, 12:06 PM
I'd have loved to give it a try, but I dont have a Linux box available so not much point in giving it a try. :(

19-12-2006, 02:35 PM
Wow, I can't believe that noone ever tells me about this stuff. :P

This is defiantly newsworthy, I've moved it to the Events forum and made it a news item. Hopefully this will bring more attention to the event.

Any more things like this, please surely let us know about it here, Vincent. Good eye. ;)

19-12-2006, 03:03 PM
I've moved it to the Events forum and made it a news item.

Ah, you moved it, that is why I couldn't find the topic anymore after I got the reply notification. :)

BTW: Does this forum have a "view post since last visit"? I already found the Search button hidden in the 'electron tube' or 'water tank', but not the "view post since last visit" like teh one on the Lazarus Forums.

19-12-2006, 03:13 PM
I see "View Forum post since last visit" is on the news page, but not on the Forum page. Well, maybe that is the correct place for posts since last visit, they are new after all. I just expected them somewhere on the forum page. :?

19-12-2006, 03:25 PM
Ah, yeah there is a 'view post since last visit' link that supposed to be on the forums page, but there is a tiny login bug we have yet to squash. :P

So anyone here gonna slam-dance this compo? :) I'm sure that a graphics guy and a Linux guy can team up and/or a Linux guy can help the graphics ppl come up with a compatible template that will compile nicely.

Personally, I'd have gone with the Linux & Win32s platform screensavers as it's hard to find Pascal game programmers working in Linux these days. With a few exceptions of course. ;)

19-12-2006, 06:55 PM
Would be a nice PGD compo to build a screensaver :)

Somehow I always thinking on a tank screen saver which all clients connect to a server and battle it out (without user input)

16-01-2007, 07:51 AM
So, is there anybody interested in the contest ? :)

16-01-2007, 08:29 AM
Hi MarcP

I'd be interested in doing something but I only have access to windows. So

-The program MUST : *Compile and work in fullscreen mode under Ubuntu 6.10 (i386), in at least 640x480, 800x600 and 1024x768 with Gnome or KDE
*Support some options : or the use of a "bpm" global (to synchronise it with music)
*Be used as a screensaver in Linux

I have no idea how to do :(


16-01-2007, 08:50 AM
So, is there anybody interested in the contest ? :)

I am interested, but I have no idea how to create a screensaver in Linux with Free Pascal (or Lazarus). Nor have I seen or heard of anyone else doing that.

16-01-2007, 09:34 AM
That ain't so hard no? I'd there are enough toolkits available to do some graphical things; JEDI-SDL, PTCPas, GLScene, ...

16-01-2007, 02:32 PM
Hey Marc! Welcome to the PGD forums. :)

I really like the concept of the Eye Candy contest, however my years of experience of being involved in the Pascal game programming community is telling me that your contest is trying to break down too many barriers.

1) Take up a new dev tool (FPC/Lazarus) for many.

Even though the usage of these great projects is growing, it is still nowhere near the level of Delphi. Eventually if things continue to go the way they are I'm sure it can be very different, but take-up of a new tool such as Lazarus or even FPC alone (the concept of a the command line at this era of software design is quite foreign to most young people just getting into 'fun' programming these days) is a barrier in it's self to overcome.

2) Linux

Most eye-candy gurus in the Pascal world come from a Windows only background. Ala Delphi or Turbo Pascal. As of yet only Free Pascal/Laz and GNU Pascal (though it's basically a dead project by now) offer Linux solutions let alone other platforms. Kylix doesn't count as it was plagued with problems and dropped on it's head at birth by Borland. (*ahem* Inprise, I mean *ahem*) Linux is a new platform for many so this is a yet a challenge as the transition is not so easy for quite a few Windows users. Furthering issues Lazarus packaging not too long ago was a horrible mess from distro to distro (probably because Linux standards are such a horrible mess from distro to distro)

3) ScreenSavers

As point #2 shows, Linux is a new neich, yet. So it's obvious as to why not very many, if any is it where would be up to the task of learning how to make a screensaver in Linux of all things. Many don't even know how to make a screensaver in Windows let alone another OS. This one is probably the toughest out of the bunch mostly because it's a cascade of the Linux issue and so far removed from the mainstream.

That all said, I honestly and truly do commend your efforts. It's great that we have interest in creating and running more competitions where Pascal and graphics are concerned. I think the concept of an eye-candy contest would turn out great, however if approached right.

My rather strong recommendation (and this is from someone who has hosted and helped run soon to be 3 competitions where external participation and involvement is key) is to keep the basic concept in place and continue to try to knock down barriers, but just take smaller bites. One major barrier is okay to challenge, but 2, 3 or more can get daunting and will scare away most if not all participation in your ventures.

16-01-2007, 02:45 PM
I'll leave 1) and 2) as they are but point 3 is nonsense; a screensaver is just a normal program that runs full screen.

16-01-2007, 02:52 PM
Maybe in Linux to a Linux programmer this is a reality, but not quite so to a Windows programmer. At least the way he understands it. Hence part of the barrier.

See in Win32 you have to do a few tricks to make a .scr file. There is a little bit involved in compiling it. (I've played with it just a little bit some time ago. Enough to know it's not compile and go to make a Windows screensaver anyways.)

It very well may be simple and easy to do, but noone knows how to do it or how it's done. You have to cater to your audience not yourself. If you want to introduce something simple, but not commonplace knowledge, provide a tutorial or a demo and/or concept for others to see and follow.

16-01-2007, 06:45 PM
I think there is only one answer to this problem: Team up with a Linux developer. It is no problem that not every programmer has no Linux experience, in fact, thanks to portable toolkits you can develop pretty well on Windows. But you need a Linux developer to answer these trivial questions.

Removing the Linux requirement is no option, as we'll never get portable software then.

16-01-2007, 07:53 PM
Hi, happy to some some people react ;)
Well, i said that the program COULD be run as a screen saver. It's not necessary (even if quite easy to do).
For the Linux, you can do as i do :
I had to recognize that Lazarus is not as user-friendly as Delphi.
So i do most of my code with Delphi, then use Linux to change the few parts that need to be converted. But if Lazarus is not so user friendly, FPC is really Delphi-Compatible and the programs needs only small changes to run with Linux.
So why i ask Linux and not Windows ? Because it's way much easier to convert Linux=>Win32
So i would say : Start to see what run under Linux (i'm not sure that all Delphi stuff like GLScene is already ported to Linux), code it and test it with Windows, then port it. The idea of Daniel is also good : team up with a Linux developper.

17-01-2007, 04:01 AM
Yes, WILL gets it. The only Linux screensavers I have on my system are xscreensaver ones written in C, and using the xscreensaver API. How to get xscreensaver to run my Pascal program? That may be trivial, but if it was trivial, someone would tell us how with a very short post.

As I said before, I have never seen a Linux screensaver written in Free Pascal (I've seen Windows screensavers written in Free Pascal, because there we have Pascal translations of the win32 screensaver API). I suspect if it was trivial, it would have been done by now, even taking into account the relatively small number of Linux Free Pascal developers.

17-01-2007, 04:06 AM
FPC is really good and I maintaining compatiblity of all my projects with it.
But Linux is not in my plans yet (at least for next 2-3 months).
Another barrier for me is open sources. It's ok for an entry itself but not for entire framework/engine.

17-01-2007, 04:09 AM
What Linux C developers do is use the xscreensaver API. Here is a description:

================================================== ========================
The XScreenSaver API
================================================== ========================

- Start with #include "screenhack.h"

- Define 2 global variables:

yoursavername_defaults -- Default values for the resources you use.
yoursavername_options -- The command-line options you accept.

- Define 5 functions:

yoursavername_init -- Return an object holding your global state.
yoursavername_draw -- Draw a single frame, quickly.
yoursavername_free -- Free everything you've allocated.
yoursavername_reshape -- Called when the window is resized.
yoursavername_event -- Called when a keyboard or mouse event happens.
The "reshape" and "event" functions are only
called when running in a window (not as a
screen saver). It's ok for them to do nothing.

- All other functions should be static.

- The last line of the file should be
XSCREENSAVER_MODULE ("YourSaverName", yoursavername)

- Finally, edit the Makefile to add a rule for your program.
Just cut-and-paste one of the existing rules.

Your "draw" must not run for more than a fraction of a second without
returning. This means "don't call usleep()". Everything has to be a
state machine.

You may not store global state in global variables, or in function-local
static variables. All of your runtime state must be encapsulted in the
"state" object created by your "init" function. If you use global or
static variables, your screen saver will not work properly on MacOS.

Do not call XSync() or XFlush(). If you think you need to do that, it
probably means that you are you are relying on the speed of the graphics
card for timing, which probably means that your "draw" function is
taking too long.

So you can see it's quite easy to do it in C. It seems that we would need to translate all of the xscreensaver code, or the guts of it, to get a Pascal version working. Or maybe just the screenhack.h header?

I think this should be a challenge. Write a Linux screensaver in Object Pascal!

17-01-2007, 04:29 AM
a screensaver is just a normal program that runs full screen.

Except that you're not finished. A screensaver is a program that runs full screen after a set time interval of user-input inactivity. You need to find some way to monitor user-input activity, and when there is no such activity after the specified time, you can then start the full-screen program. On Linux the vast majority of screensaver developers let xscreensaver monitor user-input activity, and then simply interface their full screen program with xscreensaver.

So the task for Free Pascal developers on Linux is to either find out how to properly interface with xscreensaver (which nearly every Linux user uses), or create our own user-activity monitoring software and interface with that. The disadvantage with the latter method is that to use our screensaver, nearly every Linux user would have to disable their xscreensaver program, which I suspect they would be very loathe to do. Thus, I think it's more desirable to try the former method. That would require someone who is highly skilled in both C and Object Pascal.

I think you begin to see now why there are currently no Linux screensavers written in Free Pascal.

17-01-2007, 04:36 AM
Doesn't linux check for the no activity and then call the "screensaver" app. The App needs to check for any input and then exit cleanly.

17-01-2007, 04:43 AM
Well, if you consider xscreensaver to be a fundamental part of Linux, then yes. But your program still needs to interface properly with xscreensaver. Maybe it's easier than I think, I will look into it. 8) Edit: Oh and if you interface properly with xscreensaver, you don't need to check for input; your program will be shut down by xscreensaver.

17-01-2007, 05:18 AM
Understood. Our plan currently is just to make a series of 2D demo effects. We'll cycle through states showing different effects (and making it easy to use as learning code). And just close based on input. We'll be ignoring the xscreensaver stuff for now.

17-01-2007, 06:21 AM
xscreensaver will lauch your program based on the configuration file /usr/lib/X11/app-defaults/XScreenSaver. Most screensavers have a command line option to switch between full screen and window. When user input occurs, xscreensaver will shut down your program. So, you don't need to do any weird things, just concentrate on the graphics.

17-01-2007, 08:29 AM
xscreensaver will launch your program, but if your program is not drawing on the X root window, then you can whistle Dixie all you like because you won't see your wonderful special effects on screen since xscreensaver will display the X root window over the top of your window. So you really ought to be drawing on the X root window, which means that you have to get down and dirty with the X windows API. Which will probably force you into using GLX, instead of SDL or GLUT (whose fullscreen modes do not use the root window).

But I may be wrong. Have you tried it yourself? If so, please post some example GLUT or SDL source code, and the line that you add to the xscreensaver config file.

Here's some stuff I found in the xscreensaver manual:

To use a program as a screensaver, two things are required:
that that program draw on the root window (or be able to be
configured to draw on the root window); and that that program
understand ``virtual root'' windows, as used by virtual window
managers such as tvtwm(1). (Generally, this is accomplished by
just including the "vroot.h" header file in the program's

When it is time to activate the screensaver, a full-screen black window
is created on each screen of the display. Each window is created in
such a way that, to any subsequently-created programs, it will appear
to be a ``virtual root'' window. Because of this, any program which
draws on the root window (and which understands virtual roots) can be
used as a screensaver.

17-01-2007, 08:31 AM
I have tested it with GLUT and I get the problem I describe in the first paragraph of my previous post. Tomorrow I will test it with SDL.

17-01-2007, 09:53 AM
No, I haven't tested it, so you are probably right.

17-01-2007, 12:21 PM
Please remember than making it run as screensaver is just an option.
Most of the port is trivial (only a few functions to add, should be done with a component), but there's an issue for the moment with the X window handle.
By the way, to draw the root window is easy : it's just an handle like a normal handle ;)
For the "opensource problem", it's done for two things :
1)I want to use the code as tutorial. Most people think that Pascal = Windev or Visual Basic
2)It wouldn't be fair with other competitors if some can use an engine that other can't.
If the engine is usable by everybody (for free purposes) without paying a license, no problem for me that a part of the code is closed.

17-01-2007, 05:42 PM
Marc, what I'd recommend for you do, --because this idea is a good one-- is to create a site/page detailing how to do what you propose. Even better would be to also include a decent tutorial on how to do some of these things.

This will:

1) Show you're serious

2) Attract young people who are usually more interested if they can see or visualize it.

3) Acts as a great showcase later once the competition is over to show off all that was done in the end.

Truth is you have to put in more effort that you expect back to get any results.

17-01-2007, 08:12 PM
Well, there is no special tutorial.
it depends if it 2d, 3d, opengl, SDL...
The simple way is to use Lazarus in Windows.
If use any component, just check on the web that they work with Linux.
Or install a linux in windows (VMWare is free, ubuntu is easier to install than windows, and Lazarus can be installed in 2 clicks in Linux)
I don't have to much spare time for the moment, but i'll try to code a little demo to show how simple it is ;)

17-01-2007, 09:11 PM
Tutorials are nice, but I don't think they are your responsibility. The respective technologies, like JEDI-SDL, OpenGL have their own documentation and tutorials, and looking at the projects that are presented in this community, there are quite a few people that know how to use them. A web page on the other hand, is very important I think. However, it doesn't need to be big, just make a small web page with clear goals, rules, deadlines, and just link to the technologies people can use, like Free Pascal, JEDI-SDL, OpenGL.

18-01-2007, 03:38 AM
The contest is to display graphic effects.

The screen saver stuff is nice to have.

Anyone on this site can write a graphic demo - in this case it needs to run in linux - so anyone using SDL or OpenGL should be able to do a demo.

Personally I think we are being too hard on MarcP.

18-01-2007, 04:06 AM
MarcP should not take my screensaver posts in this thread to be a criticism of his competition idea. I was just naturally curious as to how one would go about creating a screensaver in Linux.

18-01-2007, 06:15 AM
The contest seems a really nice idea with an effort put to it, considering that it even has some prizes! Btw, Marc, are you giving away your own cash or is it some sort of community share?

However, since it requires to run on Linux, it enforces the usage of OpenGL, which hurts all those who work with Direct3D on Windoze. :( Feels like having a Microsoft flavor added to it, but on the Linux part. Why not relaxing the platform requirement a bit, but giving big extra points for every additional supported platform? I mean, you are not promoting a commercial product, but a development freedom, right?

My few cents...

19-01-2007, 05:12 AM
So MarcP is this going to be a contest and if so when does it end?

dmantione and I are busy building our entry. We just need to know when to hand it in :)

19-01-2007, 08:05 PM
The contest seems a really nice idea with an effort put to it, considering that it even has some prizes! Btw, Marc, are you giving away your own cash or is it some sort of community share?

However, since it requires to run on Linux, it enforces the usage of OpenGL, which hurts all those who work with Direct3D on Windoze. :( Feels like having a Microsoft flavor added to it, but on the Linux part. Why not relaxing the platform requirement a bit, but giving big extra points for every additional supported platform? I mean, you are not promoting a commercial product, but a development freedom, right?

My few cents...
It's my own cash ;)
Btw, i do not enforce to use something. If you use DirectX, there is no chance to port the demo to Linux, so it's a bad example to show the power of (free)pascal.
But if it run with Linux, it'll probably run in windows easily.
I'm promoting development freedom, but if the software is stuck on one commercial plateform, where is freedom ? ;)
OpenGl is available on most of the platforms, SDL too.
Also, i hope that the contest will show to some people here that a multiplatform code is not so hard to do ;)

And for the new end date of the contest, i just need a few competitors who said '"i'm working on it", then i'll give you ? 3 month delay, should be enough ? :)

22-01-2007, 06:22 AM
i'll give you ? 3 month delay, should be enough ?

Then that goes into the same time as the PGD annual contest and I WONT be entering :(

We have started and I'll give you the final version at the end of the month - and you can judge it when the contest ends....