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.

Newcomers DBPro Corner / Newbie taking first steps asks politely for advice :)

Author
Message
Chesh
21
Years of Service
User Offline
Joined: 11th Sep 2003
Location:
Posted: 11th Sep 2003 18:48
Hi all,

I'm taking my very first steps in programming and I'm looking for advice as to how to begin. I'm using DarkBASIC (not pro) and I've followed the 3D tutorials up until creating a 3D matrix and basic third person/camera commands. Around this point I was starting to get stuck and wasn't really getting my hands dirty and experimenting enough.

So I went back to the 2D tutorial that shows how to cut out a sprite from a bitmap and animate it. From this code I had a go at making a basic pacman clone as an exercise.

I've uploaded my code to this site, along with the bitmap sprite bank. You can also find the file zipped, source + bitmap (14k) here:

http://roquefort.dyndns.org/~kev/pacman2.zip

If anyone would be kind enough to take a look and let me know how I can improve my code (the frame rate in particular), where I'm going wrong/making newcomer mistakes/bad form etc it would be very much appreciated.

Thanks!

.xX Chesh Xx.
LiVe
21
Years of Service
User Offline
Joined: 5th May 2003
Location:
Posted: 11th Sep 2003 21:35
where did you find the 3D tutorials?
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 11th Sep 2003 21:45
at first glance the code looks ok, but a sync rate of 30 is rather low, it should be able to run faster than that, set the sync rate to 0 then keep a "lowscore" of the lowest fps then use that to set your sync rate eg:

speed=1000

at the start of the code

current=screen fps()
if current<speed then speed=current

before the sync, and then somewhere in the main loop

if inkey$()="r"
gosub hide_sprites
cls
print "lowest frame rate was ";speed
do
sync
loop
endif

the play the game for a while and then press r to see what the slowest speed of the code was in the main loop, then set your code to run at that, or if it is too fast then set it to run at a lower rate, cheers.

Mentor.
Large Mouse
21
Years of Service
User Offline
Joined: 3rd Sep 2003
Location:
Posted: 11th Sep 2003 22:11 Edited at: 11th Sep 2003 22:12
what i do is:

tmr=timer()
wait 1

do
tsl#=timer()-tmr
tmr=timer()
tsl#=tsl#/1000
sync
loop

then i multiply the movement stuff by tsl#
it goes by the speed of the last loop, so there'll be errors when a large number of calculations are added or subtracted, but it's highly unlikely you'll notice them unless it's a very large number.
LiVe
21
Years of Service
User Offline
Joined: 5th May 2003
Location:
Posted: 11th Sep 2003 23:41
could someone please tell me where I can find the 3D tutorials? as well as any other DarkBASIC Pro tutorials?
Mentor
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 12th Sep 2003 00:09 Edited at: 12th Sep 2003 00:09
http://darkbasicpro.thegamecreators.com/?f=tutorials

there is a link on the sites front page for pro, dunno about classic [just added it into this post] cheers.

Mentor

Login to post a reply

Server time is: 2024-11-25 06:37:33
Your offset time is: 2024-11-25 06:37:33