Coding Challenge Thread

BlitzMax Forums/BlitzMax Programming/Coding Challenge Thread

SillyPutty(Posted 2005) [#1]
Hi all

Could we maybe start a series of friendly coding challenges ? Based on certain topics decided mutually, for example - lighting, then everyone codes a sample and posts their code. Then the starter of the challenge chooses a winner etc... And so the process goes ?

I have seen this on a similar forum and the response is amazing, with some awsome samples and inspiration.


Filax(Posted 2005) [#2]
It's a good idea :)


SillyPutty(Posted 2005) [#3]
cool !

what should the first challenge be ?


ImaginaryHuman(Posted 2005) [#4]
How about some kind of area that a lot of people need some help with, like maybe tilescrolling, or isometric, or jumping around on platforms, or networking?


Sarge(Posted 2005) [#5]
Umm...

2D Single Or Multiplayer Player
---------------------------------------------------
Racing Game - Wipout
TitleScrolling - Mario Brother,Sonic Style Game
Sport Game - Soccer, Rugby, Basketball, Snooker
Shooter Game - Sniper, Doom, Space Shooter
Old Games - Tetris, Pong
---------------------------------------------------

Module
---------------------------------------------------
2D Graphics
Network
Maths
Physics
Simulator
---------------------------------------------------

Thats all i can think of.


SillyPutty(Posted 2005) [#6]
some nice suggestions there !

I like the Racing type and shooter !

and physics is always good.

Thoughts ?


Sarge(Posted 2005) [#7]
I think a Racing type game will be a good start for a BlitzMax Coding Challange.

I hope this goes as planned, i will be there 100%


SillyPutty(Posted 2005) [#8]
ok, we need to set some rules though, like time frame, and also no media, so ease of use will be a priority.

I am in !

What other rules ?


Sarge(Posted 2005) [#9]
Im in if there is more than just me and Deux!

Rules
------------
1: There can not be a team only 1 coder
2: You can make a 2D or 3D racing game
3: No Media
4: You can have multiplayer or single player

i dont know, what else should we have


Cartman(Posted 2005) [#10]
I would suggest that we go with the rules that some of the other contest have used. These have been tried and tested and would save us alot of work. The we should decide on a weekend to do it. I would suggest we just have some way to randomly choose the contest theme. That way everyone doesn't have time to plan. It makes it more spontaneous.

The http://www.gameinaday.com/ has a good reputation and can provide us with a model to follow.

Also, most have an IRC channel they use.

Any way you guys want to go, I'll plan to participate.


ImaginaryHuman(Posted 2005) [#11]
Isn't `a racing game` kind of plain and ordinary? What about adding some kind of theme that it has to be modelled around? Maybe it should be some non-earthbound location, like it has to be set on another planet or some other outer space location?


Sarge(Posted 2005) [#12]
I really like that AngelDaniel.

So we have diffrent levels like mars,jupitor,sun,moon,pluto ect

that is a really good idea thanks for that.


LarsG(Posted 2005) [#13]
"The Jupiter Run" :p


ImaginaryHuman(Posted 2005) [#14]
Well it doesn't have to be planets, it could be whatever your creativity comes up with. Just seems like most racing games are based on being on some racetrack somewhere on earth, swirling around some city. You could be racing around like in the star wars film, or flying around an asteroid, or through open space, or even some non-literal take on `space` with gravity and stuff. Who knows. I just think there needs to be some kind of `contrast` so that there can be enough ideas to work with .. like a race game, but set in space, or flying but underwater, or something.


Sarge(Posted 2005) [#15]
Very creative i like were your heading it gives us a new perspective for racing games.

AngelDaniel, LarsG, Cartmen, Filax are you in.

others come on its a good start with blitzmax


SillyPutty(Posted 2005) [#16]
I am in 100%

I love AngelDaniel's idea.


ImaginaryHuman(Posted 2005) [#17]
I don't know if I'm in, in terms of actually putting in a submission for this contest, but we're all kind of in the discussion stage at the moment so who knows.

So the basic idea is it's gotta be a racing game, and it's got to have a space/alien/non-human theme. Unless someone has a better idea.

Is there going to be any restriction on whether it is 3D or 2D? What about whether Max2D is used or direct OpenGL? Or any other 2D/3D engine?

And what about the idea of not having any media? Does everyone agree to that? You have to create all your graphics at runtime - there mustn't be any loading of files, even sound effects, title screens, player ships etc?

Is there any requirement of how big it has to be, like say it has to have at least 2 levels, or has to have at least 10 minutes of gameplay?


SillyPutty(Posted 2005) [#18]
I say we must use bmax, whatever module 2d/3d you choose.

No media - as this can be a real pain to download etc... rather just copy and paste code.

The gist is to learn from each other while challenging ourselves.

It does not have to be AMAZING specimens, as in fully fledged games. demos. etc...

Finally, it is for the fun !!!

AngelDaniel, you gotta join in !


StuC(Posted 2005) [#19]
Media could be included if it is as 'data' statements in the code.


Clyde(Posted 2005) [#20]
Special Effects demonstrations would be ideal I recon, as they'll be varied no matter what kind of theme and they'd be much more interesting to watch and learn from! :D


ImaginaryHuman(Posted 2005) [#21]
True, there's such a huge variety of special effects possible.


SillyPutty(Posted 2005) [#22]
ok, so we have

racer - offowrld type thing
special effects.

Lets have a final rule and challenge vote. Then we can get started !


Sarge(Posted 2005) [#23]
well acually the first thouht that had gone in my head when i was tying that list above was a special effect intro so im up for it.


SillyPutty(Posted 2005) [#24]
ok, how long should each challenge last ?

a week ? 3 days ?


SillyPutty(Posted 2005) [#25]
btw

I vote for Special Effects:
1 week
no media

the winner, voted by your peers in this thread, chooses the next challenge.


Clyde(Posted 2005) [#26]
5 days sounds like a good one, that way they can have a chance to judge any submissions, and give some time for a new idea.


ImaginaryHuman(Posted 2005) [#27]
5 days? that doesn't sound very long at all. How about 2 weeks?
I don't hardly get much time to code, anyway, so I probably wont be able to do this.


Cartman(Posted 2005) [#28]
I was thinking of more of a 48 hour challenge like the other contests out there with a more vague theme. For example, the last one i saw was "excessive violence".

I dont' have the time to dedicate a week or two to an experimental game. I'm trying to complete my full game already.


altitudems(Posted 2005) [#29]
I think if you go for something more simple, you will get more people interested in this. But I'll try and compete, whatever you choose to do.


SillyPutty(Posted 2005) [#30]
I think 2 weeks may be quite a bit too long, I feel 5 days is perfect for special effects, it does not have to be award winning, just simple and cool :)


ImaginaryHuman(Posted 2005) [#31]
So the topic has changed from racing game to special effects then?


SillyPutty(Posted 2005) [#32]
I think so, it should be easier to throw some simple code together, rather than a whole racing game.


ImaginaryHuman(Posted 2005) [#33]
Ok so we've got 1 week, there's no media, it's gotta be some kind of visual effect, so when is the start date?


Curtastic(Posted 2005) [#34]
I vote:

1 week for the effects compo.
Then 1 month for the racing-shooter-in-space.


SillyPutty(Posted 2005) [#35]
Starting 23/04/2005 ? :)


ImaginaryHuman(Posted 2005) [#36]
What is the submission deadline?


SillyPutty(Posted 2005) [#37]
one week from that so it is Sat the 30th


ImaginaryHuman(Posted 2005) [#38]
Has to be submitted BEFORE that day?


SillyPutty(Posted 2005) [#39]
yeah ok cool !


Scott Shaver(Posted 2005) [#40]
A few questions:

1> By no media are you saying no graphic files?

2> Are we just supposed to post the code up here in the forum or can we make exes?

3> Can I use some effects I put in the DBF particle competition?


ImaginaryHuman(Posted 2005) [#41]
Since every man and his dog is acting as judge (btw, who will judge this contest?), here are my 2 cents worth ...

1) Your program has to work just by cutting and pasting the program code and compiling it. There must be no other required files, other than perhaps additional sourcecode files that you include. You can use a graphic file but you must include it as Data statements. The sourcecode has to be fully self sufficient.

2) I guess so, we could just create a thread for the postings of our submissions. Include the sourcecode in a message and that's it. Or maybe they get uploaded to the code archives. What does everyone else think?

3) I think there's gunna be loose and un-policeable boundaries about whether you use previously created stuff, stuff you already started working on secretly behind the scenes, or whatever. It's up to you. I would say if it hasn't been SEEN before by anyone then it's still new, at least for this first contest. ie don't just post some old thing you made ages ago. Technically it should be a program that you have not written any of the sourcecode to before, I guess.

Since the ultimate aim here is to just have some casual fun with it and to generate some cool sourcecode for people to use, I don't think it has to be totally strict.


Sarge(Posted 2005) [#42]
If nobody want to come forward then i will be the Judge, Does this mean im out of the comp though.


ImaginaryHuman(Posted 2005) [#43]
I guess you can't be competing and judging or you wouldn't be impartial, unless of course you were completely emotionally detached from your own submission and focussed on the good of the group ;-)

So... I guess we gotta come up with some visual effect thing then, eh.


Sarge(Posted 2005) [#44]
No i will judge a fair compertion.


Diordna(Posted 2005) [#45]
Here is how I believe this should work:

-You have one week (or two weeks) to write some kind of program. Whatever kind is fine, but please no racing, because I just entered one with that, and I HATE RACING AI. *tears hair out*
-No graphics or sound files (aka no resources)
-The community votes, either by email or by web script

I really like the idea of "special effects." Entrants could be a game, or just a cool demo.


SillyPutty(Posted 2005) [#46]
Well I think the rules are decided now :) However, I think all those who enter should vote, and you arent allowed voting for yourself.

Lets just get this started please.


Sarge(Posted 2005) [#47]
This is not my submition just a little effect

Type Rect
	Field x
	Field y
End Type

Graphics 800,600,0

Local box:rect = New rect
box.x=100
box.y=100

While Not KeyHit(key_escape)

box.y:+1
Move(box.x,box.y,box.x)

If box.y=500 Then
box.y=0
End If

Flip
Wend
End

Function Move:Rect(x,y,xy)

Local obj:rect = New rect

obj.x:+x/2
obj.y:+y-xy/1

SetLineWidth( 10 )
SetColor Rand(255),Rand(255),Rand(255)
DrawLine obj.x,obj.y,obj.y,obj.x,True
DrawLine obj.x,obj.y,obj.y,obj.y,True
DrawLine obj.y,obj.x,obj.y,obj.y,True

End Function



SillyPutty(Posted 2005) [#48]
awsome, will check later when I get home from work :/


ImaginaryHuman(Posted 2005) [#49]
I think that's a good idea, that all entrants are the judges and can't vote for their own. (and hopefully we won't see the phenomenon of television where people start ganging up and cannaiving behind the scenes ;-)

The contest is already underway. The deadline for submission is Friday at midnight. Then we can judge/test them over the weekend.

I'm not sure whether I'm entering yet, I haven't thought of an effect to do and the more interesting blobby-object routines I have all need graphics files for loading.


SillyPutty(Posted 2005) [#50]
AngelDaniel ! you gotta enter !

times a ticking folks, it is underway !

*runs off to think of a cool effect*


SillyPutty(Posted 2005) [#51]
is anyone else entering, it is really gonna be a waste if it is just me.


Koekelas(Posted 2005) [#52]
I would love to enter but effects aren't really my strongest point. Look at it from the bright sight. If you're the only one who enters you're the only one who can win :).


Nicolas.


ImaginaryHuman(Posted 2005) [#53]
I don't think I'm really gunna have time to do this or at least anything that is good enough quality. I'm also kind of in a non-programming mode at the moment. But I'm sure there are other people entering.


Suco-X(Posted 2005) [#54]
Simple Matrix effect from me.

Strict 

TMatrix.ObjectList = New TList 

Type TMatrix

	Global ObjectList:TList 
	
	Field Char:Byte
	Field ListLink:TLink 
	Field x:Float, y:Float
	Field Speed:Float
	Field Size:Int 
	Field CharHeight:Int 
	
	
	Method New()
		self.ListLink = self.ObjectList.AddLAst(Self)
	End Method
	
	
	Method Remove()
		self.ListLink.Remove()
	End Method
	
	
	Function GetInstance:TMatrix(x:Float,y:Float,Speed:Float,Size:Int,Char:Byte)
		Local TempObject:TMatrix = New TMatrix
		TempObject.Char       = Char
		TempObject.x          = x
		TempObject.y          = y
		TempObject.Speed      = Speed
		TempObject.Size       = Size
		TempObject.CharHeight = TextHeight(" ")
		Return TempObject
	End Function


	Function Idle()
		For Local TempObject:TMatrix = EachIn self.ObjectList
			TempObject.Update()
			TempObject.Render()
		Next 
	End Function 	

	
	Method Update()
		self.y:+(GameSpeed*self.speed)
		
		If self.y>GraphicsHeight()+(self.CharHeight*self.Size)
			self.Remove()
		EndIf
		
	End Method
	
	
	Method Render()
	
		SetColor 0,255,0
		SetBlend LIGHTBLEND
		SetScale 1.0,1.0
		For Local i:Int = 0 To self.size
			SetAlpha i/Float(self.size)
			DrawText Chr(self.Char+Rand(-20,20)),self.x,self.y-(i*self.CharHeight)
		Next 
		
	End Method
	
	
End Type




Function GetFPS()
	Global fps,tfps,time
	
	If MilliSecs()-time>1000
		fps = tfps
		tfps = 0
		time = MilliSecs()
	EndIf
	tfps:+1
	Return fps
End Function 



Function GetGameSpeed:Float(Hz:Int)
   Global _LoopTime:Int
   Local Speed:Float
   
   speed = MilliSecs()-_LoopTime
   speed = (Speed/1000.0)*Hz
   _LoopTime = MilliSecs()
   Return Speed
End Function




Graphics 1024,768,32

bglSetSwapInterval(0)

SeedRnd(MilliSecs())


Global GameSpeed:Float 
Local Timer


Repeat
Cls

GameSpeed = GetGameSpeed(60)

If MilliSecs()-Timer>15
	TMatrix.GetInstance(rnd(0,GraphicsWidth()),-1,rnd(2.0,7.0),Rand(5,20),Rand(30,128))
	Timer = MilliSecs()
EndIf


TMatrix.Idle()


SetColor 255,255,255
SetAlpha 1.0
SetBlend MASKBLEND
SetScale 2.0,2.0
DrawText "FPS: "+GetFPS(),10,10


Flip
FlushMem()
Until KeyHit(KEY_ESCAPE)


Mfg Suco


Koekelas(Posted 2005) [#55]
Not bad at all. I know it's forbidden to use media but the font used in the real effect is Katakana, a Japanese font but whit a twist, the characters are displayed backwards. Also the brighter part of a trail is at the beginning of the trail en is almost pure whit.


Nicolas.


SillyPutty(Posted 2005) [#56]
very nice effect Suco-X


ImaginaryHuman(Posted 2005) [#57]
I get 74 fps here. A bit fast in terms of the animation frames but looks nice nonetheless.


ImaginaryHuman(Posted 2005) [#58]
Here is my submission:

http://www.blitzbasic.com/Community/posts.php?topic=46378

But it needs media (included on that thread), so may be disqualified. No matter, just wanted to share it anyway.


Koekelas(Posted 2005) [#59]
Very impressive AngleDaniel.


Nicolas.


ImaginaryHuman(Posted 2005) [#60]
Soooo... er, is this competition over now, then? ARe there any other submissions?


SillyPutty(Posted 2005) [#61]
nope, turns out only 2 people entered, do you think it is worth carrying on with this ?


Koekelas(Posted 2005) [#62]
One word Deux, yes!


Nicolas.


ImaginaryHuman(Posted 2005) [#63]
Maybe it needs to start over with a proper more official-sounding announcement and structure and rules decided beforehand and the topic/genre whatever decided as well. Keeping it all hidden on this one thread doesn't advertise very well.


Scott Shaver(Posted 2005) [#64]
I didn't enter simply because it was stated that you couldn't use media.


ImaginaryHuman(Posted 2005) [#65]
Well, yeah, that was a bit of a deterrant. I wouldn't personally have a problem with having to save off some image files or download a zip file to be able to test this stuff out - and somebody could collate all the submissions into a single zip.


Xip(Posted 2005) [#66]
whod love to join, but i only found this tread now :P
in fact, i were googeling around the net this morning, looking for an contest to join, well, here might not be a very big price, but for the greater good of bmax, why not :P

some more public info and dates(with alot of time so more people can join) whod be nice.

maby even ask for some notice on biger sites like cw.com or bb.com?, cant hurt can it? :)


SillyPutty(Posted 2006) [#67]
hmmm this is a year old, sorry to bump this puppy, but it would really be cool if we got something like this off the ground.


H&K(Posted 2006) [#68]
Ive not bothered reading the thread, (At all), but that 20Line Chalange thing they have at TGC is cool
20 line Challange board

1) A line is defined as a line of text, terminated with a carriage return.
2) You can stack multiple commands per line up to a maximum of 25 commands per line.
3) External media is allowed but must be supplied for download or your post will be deleted.
4) External media cannot be larger than 200k in size UNCOMPRESSED.
5) State in the subject or body of the post if it's a DB or DBPro program (or both)
6) Lines with comments (remarks) on are not included in the 20 line maximum and are encouraged to help others understand your code
7) You are free to use blank lines to space out your code for readability, they are not included in the 20 line maximum. The second a line has a command on it it's included.
Obviously number 5) would need to be changed


SillyPutty(Posted 2006) [#69]
20 line challenge is daft, they just string all their commands onto 20 lines. Pain in the butt to read etc...

If you read this thread, the idea is to have a certain topic as a challenge, then a week or 2 deadline, winner gets chosen, and winner decides on next challenge.


H&K(Posted 2006) [#70]
If you read the rules its really a 500 commands challange, and most people post the spread out version as well, so no, its not that hard to read

But if you want Ill read all these posts in this competition Idea that totaly failed to work last time


SillyPutty(Posted 2006) [#71]
It would be neat if this could take off. 20 line challenge or not.

But if you want Ill read all these posts in this competition Idea that totaly failed to work last time


Easy Opera, no need to get all highly strung. I'd rather not even suggest the idea if it is gonna be met with sarcasm and holyier than thou attitude.


H&K(Posted 2006) [#72]
20 line challenge is daft

Its quite suprising how when you call someones idea daft, and they defend it. They are suddenly labled with a "holyeir than thou attitude"

If you dont want to be replied to in a sarcastic manner, try to use adjectives that are not so inflamatary


SillyPutty(Posted 2006) [#73]
It would be neat if this could take off. 20 line challenge or not.


I am not against the idea, if it will generate some code challenges. The reason I thought it is daft is because having looked at those 20 liners before, although it seemed cool, they were difficult to read. However if there is a version which aint to stacked, then fine.


If you dont want to be replied to in a sarcastic manner, try to use adjectives that are not so inflamatary


kinda like this ?

Ive not bothered reading the thread, (At all)


anyway ( not wanting to fight ), I am keen on whatever form people would enjoy. If it aint a good idea at all, then that is fine too.


H&K(Posted 2006) [#74]
Ive not bothered reading the thread, (At all)
There is nothing inflamatary about that, the thread title is "Coding Challenge Thread", ive not read any of the thread. This was a simple statement of fact. I then said the 20 line competition at TGC was cool. And you told me it was a "daft" idea.

You mightnt want a fight. But equaly you dont want to accept that you "Attacked" me first


SillyPutty(Posted 2006) [#75]
oh boy

I was not attacking your idea so much as I was mentioning how I feel that the 20 line challenge at TGC is daft

You mightnt want a fight. But equaly you dont want to accept that you "Attacked" me first


This is seriously starting to sound very Red October/Noel like, so wanting to move on, I will accept that I attacked you first.

*Extends hand apologetically*


H&K(Posted 2006) [#76]
I do agree that some sort of "coffee break" competition would be a good thing.

Edit. Excepts hand and shakes vigigosly.

Maybe the 20 lines bit is daft. (I dont think so), but the idea that it gets its own board is good


SillyPutty(Posted 2006) [#77]
I do agree that some sort of "coffee break" competition would be a good thing.


hear hear, it has worked very well at TGC, and it would stimulate some good ideas, learning experience and healthy competition.


SillyPutty(Posted 2006) [#78]
It would be awesome if it had its own board yeah.

Any ideas on what you would like to see as a first challenge of sorts ?


H&K(Posted 2006) [#79]
If you search in the "General board", I think the thing of the moment would have to be "Pong"

I realise this started as a joke at Ram, but it would probably carry the day if you put it to a vote.

You need to get a site moderator on board first though. And if you could get Mark to Garantee that the entries would be included in the Bmax download or next sample CD, all the better.

The reason I like the idea of a limited number of commands is that it stops you from going mad with options, and you have to decide what the program really needs


SillyPutty(Posted 2006) [#80]
For interests sake, who are all the moderators ? It would be awesome if Mark could do that.


H&K(Posted 2006) [#81]
Errr, Skid

Maybe Gfk is, but I dont know