It's competition time!

General discussion for topics related to the FreeBASIC project or its community.
Post Reply
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

KristopherWindsor wrote:You know, Ciw1973 could just provide a 24-bit bitmap to begin with, but he didn't...
Exactly!
1) Can I use Draw String? I don't see why I should load a font from a bitmap that is so much like the built-in font.
I had that sprite sheet converted to 16bit, scaled up 2x, and was printing chars and sprites on the screen in 3 hours. I don't understand all the whining about BPP and fonts!

Contest Rules
- You must use the graphics and sound files provided and no others.
- You can use graphics primitives in your game if you wish, but the main objects in the game should be those provided.


I would consider altering the image BPP and loading an alternate file as a violation of these stated rules.

I am fairly certain that if these rules change now, after we have already started the compo, that I will drop out, since I have already been following these guidlines.

-Vince
Lachie Dazdarian
Posts: 2338
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Post by Lachie Dazdarian »

I think you are getting too defensive regarding this rule. I’m pretty sure ciw would include 24-bit versions of the image if he thought of that. I think it’s an omission before than a though-out choice of his.

I just think finding the routine for conversion from 8-bit to another bit-depth inside the code and using it is not quite newbie-friendly, and if I’m not mistaken that was one of the ideas ciw had - to make the compo approachable to the widest circle possible.

But like I said, not a problem for me anymore.
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Post by KristopherWindsor »

Presumptuous, aren't we?
If I don't have a good idea, I can try a few. ;-)
I had that sprite sheet converted to 16bit, scaled up 2x, and was printing chars and sprites on the screen in 3 hours. I don't understand all the whining about BPP and fonts!

Contest Rules
- You must use the graphics and sound files provided and no others.
- You can use graphics primitives in your game if you wish, but the main objects in the game should be those provided.

I would consider altering the image BPP and loading an alternate file as a violation of these stated rules.
Those two rules contradict each other, since Draw String is a graphics primitive.
counting_pine
Site Admin
Posts: 6323
Joined: Jul 05, 2005 17:32
Location: Manchester, Lancs

Post by counting_pine »

I don't think changing the BMP's bit depth is against the spirit of the competition, but if you're really worried about the bit depth issue, just use this quick and simple function. It will load the BMP file provided, as an image of whatever bit depth you're using.

Code: Select all

Function loadgraphics( _
    Byval fgcol As Uinteger = RGB(255, 255, 255), _
    Byval bgcol As Uinteger = RGB(  0,   0,   0) ) As Any Ptr
   
    Const GRAPHICS_BMP = "./graphics/graphics.bmp"
   
    var f = Freefile()
    If Open (GRAPHICS_BMP For Binary Access Read As #f) = 0 Then
        Dim As Any Ptr p = ImageCreate(128, 64): If p = 0 Then Close #f: Return 0
        Dim As Ubyte col
        For y As Integer = 0 To 63
            For x As Integer = 0 To 127
                Get #f, (&h436 + (63 - y) * 128 + x + 1), col
                If col = 255 Then 'white
                    PSet p, (x, y), fgcol
                Elseif col = 253 Then 'magenta
                    PSet p, (x, y), bgcol
                End If
            Next x
        Next y
        Close #f
        Return p
    Else
        Return 0
    End If
   
End Function


'' example usage
#include "fbgfx.bi"

'Const BITS_PER_PIXEL = 32, FG_COLOR = RGB(0, 255, 0), BG_COLOR = RGB(255, 0, 255)
Const BITS_PER_PIXEL = 8, FG_COLOR = 10, BG_COLOR = 0

Screenres 320, 200, BITS_PER_PIXEL

Dim As FB.IMAGE Ptr p = loadgraphics(FG_COLOR, BG_COLOR)

If p Then
    Put (10, 10), p, trans
Else
    Print "Error loading graphics"
End If

Sleep
Some example code is provided. It's easy to use. And, if you're happy with the default colors, you don't even need to give the parameters. Just make sure you change GRAPHICS_BMP in the function, if necessary, to point to the right place.
The function will work as long as the BMP file doesn't change.
Hopefully, this will resolve the issue, and allow you to concentrate on other things instead.

EDIT: Just a small change to the code, now it closes the file if it fails to create the image.
Last edited by counting_pine on Nov 04, 2007 14:20, edited 1 time in total.
ciw1973
Posts: 157
Joined: Jun 12, 2007 15:03
Location: Isle of Man (United Kingdom)

Post by ciw1973 »

Hi everyone.

I'm in London at the moment, and have been really busy with only had my Blackberry for Internet access, which isn't exactly ideal for viewing this forum, so this is the first time I've read through the replies from last night and today.

I'm sorry that the bit depth of the image I provided has become such an issue. The reason it was provided in 8bpp format, was that I thought it would be by far the most flexible and easiest to use, and as it is actually a 1bpp image, providing it in 24bpp format seemed more than a little excessive.

My intention was that the actual images be used, and there are many published ways of converting these in code to the bit depth you require. Had we not been two days into the competition, I simply would have also provided a 24bpp image or allowed you to convert it yourself in an external image program, but Vince would be perfectly right to be annoyed if this happens now after he has put a lot of work into coding around the fact that the original image is in a different format to what he requires.

However, I also accept that for beginners the process of converting images in code is quite complex, although I'd suggest that there's no reason why a beginner couldn't just use the 8bpp version a is for making his or her game.

So, I'm going to leave the decision as to how we proceed up to Vince. I don't want him to feel annoyed enough that he abandons the competition, but at the same time I would have been happy to allow people to convert the original image to different bit depths, and even the change the colours (the purple is only there because it is the default colour key) if they required, as long as that was the only non-code processing that was applied.

As far as using DrawString is concerned, whilst it is provided as part of the standard library, I don't consider this to be a graphics primitive. I've provided all of the basic ASCII characters excluding lower case letters in the graphics file to allow for most normal text presentation requirements, mostly because I didn't want people making use of system fonts which included symbols and other graphical objects in their games.
Lachie Dazdarian
Posts: 2338
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Post by Lachie Dazdarian »

Well, since counting_pine provided the quick solution no need to think about changing the rules now. I was mainly reacting to Vince's partially overblown reaction to image bit-depth conversion than actually insisting on rule changing. Anyway, I'm ok with all staying the same.

Erm, if Draw String is not allowed, how about PRINT?

If you are trying to prevent ASCII graphics, why not making it a rule?
Last edited by Lachie Dazdarian on Nov 04, 2007 3:28, edited 1 time in total.
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

Well seeing as we are in day 3 of the compo, I would prefer to keep the rules intact. There are plenty of examples to load and convert the file. I really wouldn't care people posted different examples to convert this specific image. Take your pick and lets move on and lets just note this issue for the next (if any) compo.

Cheers!
-Vince
vdecampo
Posts: 2992
Joined: Aug 07, 2007 23:20
Location: Maryland, USA
Contact:

Post by vdecampo »

Lachie Dazdarian wrote:Well, since counting_pine provided the quick solution no need to think about changing the rules now. I was mainly reacting to Vince's partially overblown reaction to image bit-depth conversion than actually insisting on rule changing. Anyway, I'm ok with all staying the same.
OVERBLOWN! :8

I'm just anal, like you said!

And knowing is half the battle.

-Vince
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Post by KristopherWindsor »

Lachie Dazdarian wrote:Erm, if Draw String is not allowed, how about PRINT?
ERM

Draw String and Print are essentially the same functionality, so Print is therefore not allowed, either.
ciw1973
Posts: 157
Joined: Jun 12, 2007 15:03
Location: Isle of Man (United Kingdom)

Post by ciw1973 »

As I've already said, the reason for providing the font as part of the graphics file, is that if I say it's OK to use system fonts, then people could use fonts which contain essentially graphics characters.

For a beginner, loading the BMP file into FreeBASIC is extremely easy as it uses the expected colour key. Writing a simple printing routine is also easy, especialy as the font characters are already in the correct positions. These are both fundamental things for anyone writing a game, whether it's their first or fiftieth, and depending on the design, they may be the only requirement as far as graphics are concerned.

I get back home from my travels later today so will probably start designing my game tomorrow night. Whilst I've obviuosly known the basis of the competition and the graphics for a while, I've deliberately avoided any work on a game using them. I like a challenge as much as anyone.
ssjx
Posts: 34
Joined: Oct 23, 2007 8:51
Contact:

Post by ssjx »

How do we actually submit the games? I noticed that there is not an 'attach download' option on the forum. Mine is not ready yet, i am just curious!

Reading through the previous comp thread, games could be submit during the competition for people to view, is that still the case?

I am using this competition as a way to get a lot of reusable code blocks made, the time constraint gives a bit of pressure to get moving!

Given that so far my game lacks depth, orignality (combination of 2 retro games..) and currently has no sound whatsoever, i am hoping my score will at least reach double figures :)
Lachie Dazdarian
Posts: 2338
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Post by Lachie Dazdarian »

Now how will the judging actually go, having in mind you will participate?

I'm not so keen to see a forum poll. People like to abuse such stuff. I'm not saying someone will register more accounts. It just, many people will vote not playing all the entries, or vote against someone because they don't like this specific person.
badmrbox
Posts: 664
Joined: Oct 27, 2005 14:40
Location: Sweden
Contact:

Post by badmrbox »

How do we actually submit the games? I noticed that there is not an 'attach download' option on the forum. Mine is not ready yet, i am just curious!
There is tons of free downloads site's out there (each one worse than the other) that you could use. My advice is just to grab a googlepage, geocities or whatever free alternative there is.
ssjx
Posts: 34
Joined: Oct 23, 2007 8:51
Contact:

Post by ssjx »

Cool, i have a site anyway so i will just stick it on that! I wasn't sure if there was a particular procedure or anything. Thanks!

Edit:
Here's the page with the work in progress of my game:

http://ssjx.co.uk/windows/invaders.php
Lachie Dazdarian
Posts: 2338
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Post by Lachie Dazdarian »

Version 1.00 and the game is work in progress?

Anyway, really cool idea. Makes me doubt my choice of gameplay.

Nice work on recoloring the font. I wonder how you did that.

Anyway, the game supposed to end when I get one drone up?

A suggestion: Allow the player to pickup a falling drone in air.


This is going to be tough.
Post Reply