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
Darth Vader
21
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 15th Feb 2006 04:44
Don't worry I will post on the DBP forum
Thanks Anyway


You Don't know the power of the Dark Side!!
Oh but I do!!
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 15th Feb 2006 11:52 Edited at: 15th Feb 2006 11:52
@Darth Vader - I fixed a few problems in your Asteroids-ODE code, you can change things back when you want to. I colored walls, boxes,etc, just so the showed up better, and I could tell where everything was.



ODE may cause you more problems with this compo then they are worth, but feel free to keep learning by using it. You may come up with some clever ideas for an Asteroids game.

Hope This helps!
Darth Vader
21
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 15th Feb 2006 12:06
Ahh BillR thanks alot!!!!!
I think I now know I was creating the ode copies befor I had positioned the objects!

I know who I am emailing for ODE help!

You Don't know the power of the Dark Side!!
Oh but I do!!
Darth Vader
21
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 15th Feb 2006 12:20
Oh yeah that really helped just one more problem I changed the code into my original program and the cone and one box fly out of wall number 44


This is going realy well now thanks to BillR

You Don't know the power of the Dark Side!!
Oh but I do!!
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 15th Feb 2006 16:46
oh what kind of BS is this? I used to be able to pass UDT's into functions. Now it tells me you cant do that from an array.




Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 15th Feb 2006 17:46
No problems with that here:



Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 15th Feb 2006 18:20
Ric - you're passing a float, not the entire object.

Phaelax - are you sure you used to be able to pass entire UDT's? I have never been able to and, as far as i'm aware, I thought it was never able to do so due to design (its not really an OO language).

Milkman
20
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 15th Feb 2006 20:39
@Phaelax

you wouldn't need to pass in the entire array to the function, as arrays are global by default and can be accessed from the function already

formerly xMik
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 15th Feb 2006 22:36 Edited at: 15th Feb 2006 23:35
Feeling thick - what am I doing wrong here????



Just started and i cant even draw an asteroid!! Its the generation code at the begining - currently, it should draw a 24 sided "circle" as I've locked the radius to 95% of half the width of the image... Why is it making this wierd shape..



EDIT:
this is a dump of the coords it does for it...


Any idea's? What am I doing wrong?

EDIT: Neatened up numbers...

Edit: Anyone? *sob sob*

BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 15th Feb 2006 23:46
@Darth Vader - a few things for you to fix.

1) you should only have 1 sync, it goes in your main do-loop
2) same thing with ode update, 1 in your main loop
3) your objects are flying apart because you place them too close together, and ode update blasts them apart
4) so...change the way you position objects for the boxes and cone.

good luck
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 15th Feb 2006 23:54
@Nicholas - it is your last point that is having the problem, I added line 42 and 46 to show you.



Hope this helps, sorry had to run out to a seminar with Electronic Arts, I will be back later.
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 16th Feb 2006 00:16
cheers - it seems to be the last 2 points causing the wierd pointy bit - but it still doesn't explain why its elliptical at 45 degrees rather than a "perfect" circle...

Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 16th Feb 2006 03:42
nicholas, i tried to do the same type of asteroids and had the same funny shaped problem


Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 16th Feb 2006 03:45 Edited at: 16th Feb 2006 03:46
im not passing an array, just an element from the array.
You can pass a UDT into a function, but when calling a UDT element from an array.



oops, posted twice


Milkman
20
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 16th Feb 2006 04:09 Edited at: 16th Feb 2006 04:13
ah, i see what you mean now i wasn't paying close attention to what you meant at first

anyways, your right about that - it should work, but it doesn't

formerly xMik
Darth Vader
21
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 16th Feb 2006 04:14
@BillR

Okay I did what you reccomended but things still fly through one of the walls is this because the asteroids a still to close together?

Quote: "Hope this helps, sorry had to run out to a seminar with Electronic Arts, I will be back later."

Do you work for EA?

You Don't know the power of the Dark Side!!
Oh but I do!!
CodemanV
20
Years of Service
User Offline
Joined: 25th Aug 2005
Location: South Wales Valleys, UK
Posted: 16th Feb 2006 04:46 Edited at: 16th Feb 2006 05:05
@Nicholas Thompson - Hello Your problem stems from your array dimensions and the loop-counter values.

The PseudoLineArray has been dimmed with 24 elements which are counted as 0 to 23 but the loop-counters count from 1 to 24.

Here are some tips for your problem
(a) the current angle is computed not the next one, this automatically resets the angle to 0 and also makes the last point
(b) the first loop counter should count from 0 to 24 when generating the dots
(c) the draw loop counter should count from 0 to 23 when drawing the lines.
(d) the last points are now 23 (i.e. ASTEROID_POINTS - 1) and 0

The code is fixed but as this is a Coding Challenge, I thought I'd let you try and fix it yourself first

*** Edit *** Stupid Typo's

PseudoLineArray(ASTEROID_POINTS) seems to allow the 24th element!? so you're actually dealing with 25 elements not, 24 - I wondered why the fix worked!?
Darth Vader
21
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 16th Feb 2006 05:42
Okay here is the code again (I am sorry if I sound like I am asking for you to do it for me I am not I am just new at ODE!!)


The object seem to never get near themselves and they also fly out of the top wall. I did what BillR said about placing them a bit farther apart. The gravity is set so that I could test the objects.

Sorry guys and Thanks!


You Don't know the power of the Dark Side!!
Oh but I do!!
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 16th Feb 2006 08:27 Edited at: 16th Feb 2006 08:30
@Darth - here you go, read my comments in the source



In the real asteroids game, there were no walls to bounce off of, everything wrapped around the screen.

Also, I think ODE might not work well for this compo, moving objects yourself is probably much easier for an asteroids game. I won't be using ode for this.
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 16th Feb 2006 10:10
@CodemanV: Thank you VERY much for that explanation! I'm at work now and will try to make time tonight to sort it out. I dont get why its making the wierd shape though - however it DOES explain why its making the wierd "fin" on the elipse.

Darth Vader
21
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 16th Feb 2006 11:48
@BillR
Is there a way to use ODE with DBP inbuilt collision functions? Or isn't it needed?

Thanks Again

You Don't know the power of the Dark Side!!
Oh but I do!!
CodemanV
20
Years of Service
User Offline
Joined: 25th Aug 2005
Location: South Wales Valleys, UK
Posted: 16th Feb 2006 12:03 Edited at: 16th Feb 2006 12:21
@Nicholas Thompson - Hello again lol - I thought you wanted that funny shape

The "elliptical" problem is due to the order that the PseudoLine and PseudoPoint UDT's are declared. The two level type declaration isn't storing the values correctly.

You need to place the declaration of the PseduoPoint UDT before the PseudoLine UDT. I also recommend placing the UDT declarations at the beginning of the code so they get declared before any calls to them are made.

If you add the last bit of waffle to my first bit of waffle then you get code which produces a slightly uneven circle.

Hope that helps you out

*** Quick Edit ***
both the loops count from 0 to (ASTEROID_POINTS-1) and the angle equation also uses (ASTEROID_POINTS-1)
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 16th Feb 2006 12:34
Oooo I see!! I thought I was being clever leaving them down there neatly out the way - forgot that BASIC was never designed with neatness in mind!

Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 16th Feb 2006 19:02 Edited at: 16th Feb 2006 19:35
Here's mine

W=forward
Space=fire
Mouse=turn
Enter=Bring you back to 0,0,0



MIDI attached incase you want to un-comment the three lines at the beginning

After playing this for awhile...wooa..everything is spinning!
Now I need to add dying... =.=

FunkyStickmen: Battle of the Races (1%)
Milkman
20
Years of Service
User Offline
Joined: 30th Nov 2005
Location: United States
Posted: 16th Feb 2006 20:41
i can't see straight

formerly xMik
Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 16th Feb 2006 21:32
lol

FunkyStickmen: Battle of the Races (1%)
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 16th Feb 2006 21:50 Edited at: 16th Feb 2006 22:17
Owch - I actually feel dizzy!! Looks quite nice if you turn ambient light off.

EDIT: CodemanV - your tip with the Types worked great!! Cheers.

Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 16th Feb 2006 22:17
Here's an update



Fixed the ship and varied the asteroid sizes

FunkyStickmen: Battle of the Races (1%)
Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 17th Feb 2006 00:44
I can die now, but the stupid message won't appear. o_O



it just instantly disappears.

FunkyStickmen: Battle of the Races (1%)
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 17th Feb 2006 01:05 Edited at: 17th Feb 2006 01:07
This is mine so far:


No game as such yet - but its pretty to look at

I might have gone a little OTT on the asteroid development... But I'm planning on making it pixel perfect collision. Shouldn't be TOO hard. I also store all the vertex data for each asteroid so I SHOULD be able to do better than pixel perfect, I should be able to do mathematically perfect, as long as I can test if any vertices of polygons are overlapping. Easily done using one of these methods:
http://astronomy.swin.edu.au/~pbourke/geometry/insidepoly/

I use those in the code to make the memblock fill in the asteroid

I need to re-learn all my matrice's stuff from my degree... actually.. when I say relearn, what I really mean is... learn...



BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 18th Feb 2006 02:51
I don't know why I'm sruggling so much with this challenge, when I see some people just screaming their programs together, and all of them looking so great!

I'm trying some new things I haven't tried before, hopefully they will look interesting, and that I will have something that works at least a little bit(which isn't the case yet) so I can post it here.

Anyway, back to the struggle!
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 18th Feb 2006 04:30 Edited at: 18th Feb 2006 04:39
@Darth
Quote: "Is there a way to use ODE with DBP inbuilt collision functions? Or isn't it needed?"


Here is what I understand so far, although I am certainly NOT an ODE expert.

ODE and DBPro each use their own world to store their own object data,etc.
ODE calculates physics by itself, then updates the position,rotation,etc. of it's own objects in it's own world.....THEN updates object positions,rotation,etc. in the DBPro world, so that the DBPro game engine can render the scene on the screen.
Everything works as long as the 2 worlds stay in sync.

That means they each have their on collision systems running.
You can trigger effect using either one, but you wouldn't want to control position and rotation with both, because then you will cause them to get out of sync.

Once you set up the ODE world, don't use DBPro to move or rotate objects that are also controlled by the ODE world.

That's why you were having problems moving and rotating objects in the DBPro world, after you had copied the into the ODE world, objects got out of sync between the 2 worlds. Set up your objects COMPLETELY in the DBPro world, then as the last thing you do, set them up in the ODE world, then don't touch them again in the DBPro world.

So back to your question...
1) Let ODE control the collisions & physics of all the objects it has in its world.

2) You can use either DBPro or ODE to trigger effects using their own collision system, as long as the effects are simple like color changes, or any other effect NOT effecting the objects position,rotation,scale,etc.

Hope this helps, good luck with your learning more about ODE, it can do some cool things, but it can be very frustrating to use.
Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 18th Feb 2006 16:31 Edited at: 18th Feb 2006 16:46
Update! Now everything works...and no more spawn dying! Two precious seconds of invulnerability



Mouse=turn
LeftClick=shoot
RightClick=boost

FunkyStickmen: Battle of the Races (1%)
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 18th Feb 2006 19:09
Nice Image all. It's very tough though. Maybe a few (and I mean maybe 3 or 4) fewer astroids, and not so large, would make it a little more playable. Or maybe a larger playing area.


Open MMORPG: It's your game!
Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 18th Feb 2006 20:11
Huh. I got ~ 1042 points

(Screenie taken 3-4 seconds before game over)


FunkyStickmen: Battle of the Races (1%)
RiiDii
21
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 19th Feb 2006 17:42
That's odd. I could barely survive a few seconds, and not for a lack of skill or trying. Moving around helped, but not very much. I can accept though that maybe it's me. But it could also run different on different pc's. Do you have your Window settings in the IDE set to something other than the default?


Open MMORPG: It's your game!
Segan
20
Years of Service
User Offline
Joined: 28th Aug 2005
Location: Canada
Posted: 20th Feb 2006 02:25
Heh. I died very quickly too... And that screenie doesn't look anything like what I would get (other than at the very beginning) because there is usually an average of 10 asteroids visible at once.(moving at high speeds). Perhaps has something to do with the sync rate?
Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 20th Feb 2006 07:12 Edited at: 20th Feb 2006 07:19
10? You call that alot? hehe...that's more like average.



Just capped the frames to 50 - I found out I was only squeezing 44-48 out of it, so it was going nicely for me



FunkyStickmen: Battle of the Races (1%)
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 20th Feb 2006 10:28
I've been thinking abut my entry and it should be VERY easy to do collision checking mathematically. I've already written the code that checks if a point is within a polygon. All I have to do it check if n polygons from asteroids are within another asteroid...

Darth Vader
21
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 20th Feb 2006 10:37
Guys I don't think I am going to make it, so good luck!!


You Don't know the power of the Dark Side!!
Oh but I do!!
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 20th Feb 2006 14:09 Edited at: 20th Feb 2006 14:09
I am working on my Asteroids game, but I am getting screen flashes during the game.

It happens everytime I make a sphere during the game.
Here is some sample code that makes my screen flash.


Does anyone elses screen flash?

My System:
ASUS A7M266-D motherboard
Dual AMD 1800+ CPU's
1 Gig RAM
ASUS v8200 GeForce 3/Ti/200 video card
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 20th Feb 2006 14:20 Edited at: 20th Feb 2006 14:34
It looks like DBPro 5.9 is moving the camera, causing the flashing.

If you try this code, and try to back away using the down arrow key, the camera keeps jumping back to 0,0,0




Found the solution in the main forum.

AUTOCAM OFF

I don't think I have used that before, but it works to solve my problem!
Ric
21
Years of Service
User Offline
Joined: 11th Jul 2004
Location: object position x
Posted: 20th Feb 2006 15:44
Yep - autocam is probably the most annoying feature of DBP I've come across! Should be off by default if you ask me.

Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 20th Feb 2006 16:08
definately! I've yet to find a decent use for it... apart from wasting your time.

I really must remember to bring DBP into work one day...

Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 20th Feb 2006 17:06
You keep saying that, but it never happens
I just hope that when/if you finaly do remember to bring it...the security guards aren't going to look through your coat

FunkyStickmen: Battle of the Races (1%)
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 20th Feb 2006 17:28
Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 20th Feb 2006 18:16
The ones that are going to show up all of a sudden when you try to bring DBP in

FunkyStickmen: Battle of the Races (1%)
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 20th Feb 2006 18:39 Edited at: 20th Feb 2006 18:40
Lets hope not!!

WOOT - post 3000!!!

EDIT: I'm gonna try to do some work on Asteroids tonight.

Image All
20
Years of Service
User Offline
Joined: 30th Dec 2005
Location: Home
Posted: 20th Feb 2006 18:53
If you try to install it on another computer, won't the activation key on the CD be compared to the database and TGC will automatically block you from re-registering it? b][/b]O

FunkyStickmen: Battle of the Races (1%)
Nicholas Thompson
21
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 20th Feb 2006 21:15
I think TGC let you install it on as many machines as you like, its more of a "per person" license than a "per machine"... Or maybe a "per actively running install"?

Login to post a reply

Server time is: 2026-07-08 09:08:17
Your offset time is: 2026-07-08 09:08:17