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 Discussion / It's a Snake

Author
Message
Damokles
21
Years of Service
User Offline
Joined: 28th May 2003
Location: Belgium
Posted: 14th Apr 2004 18:36
As you can see, the following code can be compared to Snake. In fact it works pretty good.
In fact it's part of a larger program, but I got the code smaller to be able to see the error with less difficulty. My problem is the slow down, when I have more than 10 spheres following each other.



These are things that are in the game and shall not be changed :
The last touched sphere shall be the new leader and have the direction of the one who touched him.
The way they are following each other is good

These are the things I'd like to get better :
The speed.
The spheres not going into each other

I would be gratefull, id somebody could help me with it. Thanks

- Mind the gap -
Tim Ballisto
21
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Right behind you.
Posted: 15th Apr 2004 05:06 Edited at: 15th Apr 2004 05:07
your problem is the collision system, which can be very slow. instead, you should check for the distance between the loose spheres and thwe leading sphere. if it is less than 50, then they are touching. this works best with spheres.


Programs for programmers.
Damokles
21
Years of Service
User Offline
Joined: 28th May 2003
Location: Belgium
Posted: 15th Apr 2004 09:31
Well, yes, thanks.
But in the real game, there are no spheres but several objects : I turned it into spheres, to show the code. (but the objects won't be larger than the spheres.

- Mind the gap -
JohnFP
21
Years of Service
User Offline
Joined: 5th Feb 2004
Location: Maryland
Posted: 15th Apr 2004 16:45
Without actully decypering your code it seems that it is not in the collision because after you have collided the slowness persists. That is, the "join in" is skipped because the spheres are just moving and the first if statement in "join in" is not true. That leads me to believe that the slowness is within the "move people". I played with sync rate(40 and 50) and put sinc in "move people" instead of main routine and found it to work much better when moving straight but when you would turn it would slow down and spheres would bunch up. Then when you went straight again, the bunching would spread out and the speed would get back up to normal. This was with about 10 spheres. So it may be find a better place for sync, use sync rate and redo your code for turning to be more effecient.

John
Axelman
21
Years of Service
User Offline
Joined: 18th Oct 2003
Location: Parallel Universe
Posted: 2nd Aug 2004 18:42
lol, your making a congo line!!
Thanks for this code tho damokles, its helped me with a Snake-Game.

This Space for rent
BatVink
Moderator
22
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 5th Aug 2004 16:59
Quote: "I can have another look.. this post is a MONTH OLD!"


I don't think it is...looks like the dates have screwed up. Threads expire after one month, and this was responded 2, allegedly, after a 3 or 4 month gap.

BatVink
http://biglaugh.co.uk/catalog AMD 3000+ Barton, 512Mb Ram, 120 Gig Drive space, GeForce 5200 FX 128 Mb, Asus A7N8X Mobo.
Terms & Conditions apply
hyrichter
21
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 6th Aug 2004 04:48
Actually, those dates ARE accurate. I remember this thread from back a few months ago. For some reason, when the forums moved to the new server, the 30-day post lock went away.

Pricey
22
Years of Service
User Offline
Joined: 22nd Feb 2003
Location:
Posted: 11th Aug 2004 03:05
@ Axelman YOU EVIL CODE STEALER

Damokles
21
Years of Service
User Offline
Joined: 28th May 2003
Location: Belgium
Posted: 11th Aug 2004 04:15
Axelman, yes it was to make a congo line.


pricey, That was just the base of the game ... nothing much. And if I get some code on the forum, I don't care if somebody uses it. I 'm glad it helped him.


And the dates are accurate, my file was created the 14 April 2004, so I suppose the forum doesn't lie.

- Mind the gap -

Login to post a reply

Server time is: 2025-05-25 13:52:25
Your offset time is: 2025-05-25 13:52:25