Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / - DBPro Coding Challenges -

Author
Message
Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 20th Apr 2009 18:32
I dont think anyone would accues you of that acelepage, but I was thinking down slightly different lines.

Perhaps something such as a lighting demo could work well?
It would test creativeness and coding...

What do people think?

acelepage
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 20th Apr 2009 18:44
Lighting hasn't been done yet. That would be a good one.
I haven't done much with lighting. I could use some education in that area.

( 2b || !2b ), that is the question. The answer: true
Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 20th Apr 2009 22:39
Lighting it is then...

Your challenge:

Create a lighting demo!

You can use any type of lighting, to make any type of demo.
Entries will be judged on lighting effects, outcome of the demo (ie how good it looks) and any extra wows.

Entry deadline :
2 Weeks
Monday 4th May

Good luck et bonne chance =)

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 21st Apr 2009 01:52
I should be entering this one, as it will help me work toward some of the goals I have for some of my projects .



calcyman
17
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 21st Apr 2009 18:46
Here's my entry - it generates seamless textures with realistic lighting effects. You can increase the speed by removing the seamless feature. This is attained by assigning a value of 0 to the Htorus and Vtorus variables. Increasing these values will make the image more seamless. You can observe the difference between the seamless and distinct images by setting one variable to 3 and the other to 0. Anyway, here's the code:





You can mess around with the magnitudes and attenuations of each of the three lights in the demo. Increasing the magnitude makes the light brighter. Increasing the attenuation makes the light more concentrated. A value of exactly 2 is used to simulate actual lights, due to Newton's Inverse Square Law.

The optimist's right, The pessimist's right.
Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 26th Apr 2009 16:06
Thats a nice demo Calcyman.

I only just checked this thread today so its nice to see an entry ready so soon.

Still a week left for the people who havent entered yet =)

Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 30th Apr 2009 21:51
Nice one. I get black dots in the middle of the lights. Presumably because you're dividing by zero. I'd suggest adding an extra term to the squared distance forumla- ie x^2+y^2+w^2 - which is also a bit like having the light dispersed over a volume of some radius ~w.

I'm hoping to have a bash at this challenge. I want to use vertexdata to do vertex lighting, so i can have an unlimited number of lights. I've got a plan. Just need to do the typing. As always.

Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 1st May 2009 02:18 Edited at: 1st May 2009 02:19
Here's a quick thing.



Next i want to be able to update lights for any given object if it moves or rotates. I will also need to get the light vector in the object's rotated frame.

After that if i have time, i'd like to have movable lights, and to implement a grid system or similar to up the speed a bit.

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 1st May 2009 02:48
Hah, that's a lot like what I was trying to do but about 10x faster. I was reading the UV data and making a lightmap for each object - the VERTEXDATA DIFFUSE commands look a lot easier!



Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 1st May 2009 22:23
Another nice entry Dr Tank!

I would like to say that although the deadline is this sunday, im probably not going to be able to judge these entries properly until monday, thus you could have an extra day if you need it. ]

Monk

Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 3rd May 2009 02:38 Edited at: 3rd May 2009 03:19
Thanks guys. Here's a better version. I capped the framerate to 60. You can uncap it and see how fast it runs if you like. Edit: just fixed a bug!



Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 3rd May 2009 03:40
By decreasing the light range, and turning down the detail on the spheres, i went up to 100 objects and 32 lights.

The time it takes to refresh, given a constant number of lights shining on an object, is proportional to the number of vertices. For high poly objects it's going to be hellaciously slow.

It's probably not a practical system, but perhaps i can look into using shaders. I'd like to make a shader where each object has it's own list of lights that are shining on it. A job for another day.



acelepage
20
Years of Service
User Offline
Joined: 2nd Jun 2004
Location: Plattsville
Posted: 4th May 2009 22:06 Edited at: 4th May 2009 23:26
I didn't have time to finish this, but I wanted to get it posted anyway. I think I might keep working on this one as it could prove useful when setting up objects. Right now it only adjusts the properties of an object that affect lighting of the object. I want to add the ability to create lights, position them, and adjust their properties.



( 2b || !2b ), that is the question. The answer: true
Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 5th May 2009 18:57 Edited at: 5th May 2009 19:18
It being tuesday, i think all the entries that will get entered have been entered, thus i am going to give my verdict.

First, thanks to you all for taking the time to make those lighting demos, its good to see people taking part in these challenges again.

There were three pretty different but all very good demos of lighting here, and its good to see different approaches being used.

Calcyman:
A very nice lighting texture maker, the lights really did look like they were on the screen. I think that if this could have been developed into 3d with a bit more interactivity and real time updating, this could have been a great demo.

Dr Tank:
An interesting approach to lighting that i dont think many people have used before, certainly one that i hadnt heard of before. It included 3d, the capability to move around and view from different angles, and it ran fairly quickly on the pc. One point though, in your code, the ... symbol in rem lines often remmed out the line below as well, which fooled me more than once .

Acelepage:
A very nice demo using the dbpro built in lighting commands, and a little scroll bar box in the top corner. Professional feel to it, and i think that it worked very well.


Winner:



Congrats to everyone else!

Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 6th May 2009 00:12
Yeah! I'm awesome! Thanks very much.

Kudos to everyone who entered too. acelepage's thing is prett interesting. I've never totally got my head around how it adds together all the different lighting contributions. This should help me figure it out.

Quote: "in your code, the ... symbol in rem lines often remmed out the line below as well, which fooled me more than once ."

I'm always doing this. Must stop. In the standard DBP editor, ... doesn't mean anything special, but in one or more alternatives, it takes it to mean rem, or ' or something, and i have a habit of writing ... a lot in my comments.

Anyway i guess i should be dreaming up a new challenge. I was pondering some kind of shooting game without movement, or with automatic movement. Mouse or arrow keys. With a fire/other action button or two. Let's say 3 "fire" buttons max.

Point Blank, fairground shooting, coconut shy. You could remake Operation Wolf with DBP primitives, or the really ambitious could do a rail shooter like Time Crisis, Gunblade NY or Starblade. I guess Space Harrier would fit within the rules at a stretch. But then maybe you could extend this to tunnel shooters, and then why not 2d shooters in general? I guess the rules aren't that well defined! Try to stick to the rail shooter "spirit"! Has this challenge been set before? Would anyone enter? Or has anyone got a better idea?

I'm thinking a couple of weeks time limit. Main judging criteria to be enjoyment.

Here are some vids if anyone wants some ideas.

Point Blank
Space Harrier (this looks really awesome. Kind of wish i was eligible to enter)
Starblade

It doesn't have to be a complete game, or long. Just fun!

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 6th May 2009 00:16
Congrats Dr Tank! A well-deserved win.

I think ... is a line concatenation symbol in some editors (so it combines the line it is on with the next line). That would explain why ...s at the end of a rem line rem out the next line.

A rail shooter sounds fun, I will do one if I have time.



Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 7th May 2009 22:22
Sweet. I look forward to seeing what you and anyone else who want to enter come up with. Remember the movement is optional- it could just be shooting balls bouncing around a screen ..

So i neglected to set a date. I guess MONDAY 18TH MAY then.

Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 7th May 2009 23:27
Ill knock summat up, Ive been meaning to look into ammuntion trajectories for a while, so if I get the time, ill aim for a marksman range. =)

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 10th May 2009 18:58
Here's the level editor for my rail shooter:


Unfortunately I forgot to save that level . I'll have to post game shots later.



BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 10th May 2009 19:32
The screenshots don't show the game that well, so I guess I'll post a little preview version.



I'm mostly concerned about difficulty, of course, so tell me how hard or easy you found it if you play it.



Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 11th May 2009 00:11 Edited at: 11th May 2009 00:13
Quote: "Ill knock summat up, Ive been meaning to look into ammuntion trajectories for a while, so if I get the time, ill aim for a marksman range. =)"

Nice. That sounds cool. Good luck!


Quote: "The screenshots don't show the game that well, so I guess I'll post a little preview version. "

Dude that was totally cool! As for difficulty - it was easily doable, but on the border of being impossible, since it was mainly about reaction time, and with one thing to shoot at at a time, your reactions are going to consistently be quick enough, or not. I guess maybe put in some more variation somehow.

BTW if you want to use mipmapping (so the ground texture doesn't "swim" in the distance), you can save your image as a file (eg .bmp), and load it up again. Mipmaps will be generated when the image is reloaded.

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 11th May 2009 00:28
Thanks for the tips . Saving and loading the image didn't seem to make the pixel swimming go away, though...



aarrowh
17
Years of Service
User Offline
Joined: 19th Oct 2007
Location:
Posted: 11th May 2009 02:19
I've been really busy lately, and have forgotten (or its just hidden the back of my head) most of my programming knowledge...I wanted to participate but I'm stuck right off the bat...I'm attempting to make a simple point and click shooter, using a line from the player to the mouse position as the cross hair. But the line will not start where the player is...no matter what I do...

the code..






Image thanks goes to AndrewT
Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 11th May 2009 02:45
You're right- it didn't! After much trial and error, it appears the problem is that non square textures won't get mipmaps. This code works...



-i changed the last flag of get image from 1 (no stretching) to 0. Now things look nice and non swimmy. Mipmapping sometimes improves framerates too.

Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 11th May 2009 02:51
aarrowh -

you're using the object's 3d world co-ordinates , but probably want to be using the object's screen coordinates. Try the commands

object screen x()
object screen y()

aarrowh
17
Years of Service
User Offline
Joined: 19th Oct 2007
Location:
Posted: 11th May 2009 03:09
That worked! Thanks...I didn't see that command in the Basic 3d section...



Image thanks goes to AndrewT
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 11th May 2009 03:27 Edited at: 11th May 2009 03:29
Wow! That's loads better! Thanks you

@aarrowh
Try positioning the camera away from the object a bit.
Edit: Woops, that would be it XD



Aurum Knight
16
Years of Service
User Offline
Joined: 15th Jul 2008
Location: the suburbs of nowhere
Posted: 11th May 2009 03:38 Edited at: 11th May 2009 03:41
Post deleted.
(Didn't see another whole page here =S )
aarrowh
17
Years of Service
User Offline
Joined: 19th Oct 2007
Location:
Posted: 11th May 2009 04:21
Okay...I'm back with yet another question..

I can easily get a sphere(what I'll be using as bullets) to appear wherever the end of the line is... but how do I make it move along the trajectory that was originally there when the mouse was clicked?

I was thinking something along the line of:


of course I have no idea how to apply most of this in actual code....



Image thanks goes to AndrewT
Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 11th May 2009 12:10


I really should check this post more often, im missing half of these posts...

Thats looking really sweet Bmaczero. If i must say anything, its that its predictable. The enemies pop up in the only cover spots, so you know roughly where theyre gonna come from...
Very nice start though

Try that =)

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 11th May 2009 16:21
Ah, that is a good point, Monk, I'l try to fix that. It would look weird if they just came out of the ground, but I could either do that or just place some false cover spots around...



aarrowh
17
Years of Service
User Offline
Joined: 19th Oct 2007
Location:
Posted: 11th May 2009 21:13
I've got the bullet, but when I try to get it to shoot...it doesn't work, it just disappears... I've been attempting to fix this for hours with no avail...






Image thanks goes to AndrewT
Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 12th May 2009 15:17
Youre mixing screen locations and 3d locations...
When you place the bullet at linex1 and liney1, youre placing them in 3d space, yet youre getting the linex1 and liney1 values from your screen...

Try this:


aarrowh
17
Years of Service
User Offline
Joined: 19th Oct 2007
Location:
Posted: 12th May 2009 16:53
Thanks Monk! Im not at my home PC right now but I'll try it out when I get home.



Image thanks goes to AndrewT
Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 14th May 2009 16:41 Edited at: 14th May 2009 16:46
Ive got a start on my target range, I havent added any of the better features such as dip or wind yet, but im getting there.
Im sorta struggling with the target collision. Im using pick object now, but that wont work later on when i include dip in the shots. I tried sparkys collision, but that wont work for me, or im doing something wrong (likely). If someone could give me a few pointers, thatd be gratefully accepted.
Anyway, heres what Ive got so far.



DB PROgrammer
17
Years of Service
User Offline
Joined: 9th Feb 2007
Location: Nowhere But Everywhere
Posted: 15th May 2009 18:35
This contest has peeked my interest. I started a entry; although, I started late so it's going to be hard to finish it on time.


DBPro, limited by the programmer.
BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 17th May 2009 04:11
Okay, this will probably be the final version of my shooter. I'm posting it now in case I forget later:



Editor:




Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 17th May 2009 05:23 Edited at: 17th May 2009 05:25
Great stuff guys!

aarrowh - good luck!

BMacZero- difficulty level feels right now! I found it difficult, but doable. Great stuff. I'll make more of a review after the deadline. If you want to add anything then that would be sweet. Howabout disintegrating targets?

Monk - seems to work well! Looking at DBP's help file, i think you should check out the command "intersect object". This way you can check for line collision with objects- each frame, the line is from the bullet's start position, to its end position in that frame.

This way, in addition to being able to have curved trajecteories, you can have the targets hit when the bullets get there, rather than when you fire the gun.

Good luck! If you get stuck i'll have a go at it.



BTW to both of you - cool guns!

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 17th May 2009 06:29 Edited at: 17th May 2009 06:31
Thanks, Dr Tank! Good news . This might be a good opportunity to use your exploding code snippet, huh?

@Monk - Seems to be coming along nicely. Might be needing a scope, though - it's hard to aim right at the ones far away.



Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 17th May 2009 18:35
I have only 3 possible additions to your game bmaczero, elsewise its nicely done =)

More ammo ! I ran out bout half way through the level... =(

Make it so that you can actually die, otherwise you have to sit and wait and get shot once youve run out of ammo =(

And this isnt a gameplay thing, but I had to change make object plane to make object plain. Not a big thing.

Very good game though =)!

Ill post my game in a min, turns out that sparkys was working fine, I was just being a muppet and missed out a few things such as, delete memblock 1 at the end of the code etc.

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 17th May 2009 19:20 Edited at: 17th May 2009 19:21
Thanks for those, Monk!

Quote: "More ammo ! I ran out bout half way through the level..."

Okay, I increased the ammo (I'd just decreased it on the last update, guess I shouldn't have). You can change it on line 190 if you want to cheat or something

Quote: "Make it so that you can actually die, otherwise you have to sit and wait and get shot once youve run out of ammo =("

Dang, I completely forgot about that . Thanks!

Quote: "And this isnt a gameplay thing, but I had to change make object plane to make object plain. Not a big thing."

What version do you have? I think in one of the more recent versions they just had both commands do the same thing. I changed it, though.

Okay, here's the newest version of the game. The editor is still the same, but I've added Monk's suggestions (with some fog), and made a new "hit" effect.





Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 17th May 2009 19:48 Edited at: 17th May 2009 20:00
Thats much better Bmac !
I died first time =)

The only slight crit now, is that theyre arent enough enemies, but thats my opinion. Maybe itll be different for someone else...


Heres my done entry. Ive added optional physics, auto or single shot firing, and the collision works as well as its gonna =)
Its just a simple, shoot-them-all-as-fast-as-you-can game. Enjoy!



Edit: Fixed a reload bug when phys is on.

It is possible to hit the long distance target with wind and dip on, I managed to complete the range in 91 secs with phys and 31 without =)

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 17th May 2009 22:49
Cool game. I think maybe wind and physics should just be on all the time, it's too easy without them. With them, it is challenging but defintely not impossible (I had to switch to auto and fire about 3 clips before I hit the long one).

Now if you have time, you just need some regional scoring based on where you hit the target... .



Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 17th May 2009 22:56
I thought about that, I could use dummy objects in front of the bulls eye to pick up the better hits, and then tally a score, but Im happy with this, and when I get the time, Ill use it in my FPS, hence why I wanted to put wind and dip in =)

Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 18th May 2009 02:48
Dudes! Good work. I was hoping judging would be easy but it's going to be a pig. Why couldn't there just be one really good entry? So, i remember i said the deadline was Monday. Presumably that's midnight (before Tuesday morning) What with all these timezones it's kind of tricky. Are we going by GMT or what?

Monk - haven't played your latest yet. Will get that sparky collision tomorrow.

Need to update DBP too - i had the plane/plain problem, plus i need to knock off the last variables in set display mode, and add a background colour for ink. :S

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 18th May 2009 04:33
Quote: "Need to update DBP too - i had the plane/plain problem, plus i need to knock off the last variables in set display mode, and add a background colour for ink."

Wow, you're 3 or 4 versions behind if you don't have the antialiasing parameters in SET DISPLAY MODE .

I'm glad that they removed the background color requirment for INK, I would always forget it and get yelled at by the compiler, now I can finally get away with it .



Monk
16
Years of Service
User Offline
Joined: 25th Sep 2008
Location: Standing in the snow =D
Posted: 18th May 2009 12:45
You dont need to add a background ink setting? Nice, it always annoys me having to type out the second set of rgb...
Any chance that works in v6.9? Thats the version Im using because the versions after that have problems with indexdata or something similar...

BMacZero
18
Years of Service
User Offline
Joined: 30th Dec 2005
Location: E:/ NA / USA
Posted: 18th May 2009 16:05
I think it was changed in 7.3 or 7.4.



DB PROgrammer
17
Years of Service
User Offline
Joined: 9th Feb 2007
Location: Nowhere But Everywhere
Posted: 19th May 2009 00:33 Edited at: 19th May 2009 00:34
Of course, when I decide to do one of these I end up not being able to. I only got as far as the editor so I have nothing to post, but if I finish it within a week or so I'll post it here anyway so you can all have a try at it.

Good luck to those who entered, I'll take a look at them later and comment.


DBPro, limited by the programmer.
Dr Tank
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Southampton, UK
Posted: 20th May 2009 05:18
Can't stop long. Will judge tomorrow. Need sleep.

Login to post a reply

Server time is: 2024-11-24 14:36:23
Your offset time is: 2024-11-24 14:36:23