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.

Code Snippets / [DBP] 3D Pong Game - Excellent Physics(Add Spin To The Ball!) , Good AI(Com Can Make Mistakes!) And Very Effective Motion Blur

Author
Message
kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 4th Sep 2007 19:13 Edited at: 1st Dec 2007 14:15
Features:
Add Spin To The Ball!
Com Can Make Mistakes!(well this works fine on my computer)
Very Effective Motion Blur!
and much more!

Note:Requires Sparky 2.0

Note2:Sorry About the speed bug. well this is my first project I made in dbpro and when i tested it it was fine. (mabie because my computer is quite slow(pentium 4 H/T))


And Here It Is (Dark Basic Pro)


Mortus
17
Years of Service
User Offline
Joined: 14th Dec 2006
Location: Illinois
Posted: 5th Sep 2007 05:13
is there something im missing?
i can use this code snippet are there updates or something or is it something else? plus what is DBP x 10?
Mortus
17
Years of Service
User Offline
Joined: 14th Dec 2006
Location: Illinois
Posted: 5th Sep 2007 06:33
cant't*

i suppose that mistake made that make no sense
Mortus
17
Years of Service
User Offline
Joined: 14th Dec 2006
Location: Illinois
Posted: 5th Sep 2007 06:36
it seems to have a problem with "sc_updateobject",

i have absolutely no idea what that means as i don't use underscores in variable types and i dont use things like
"as interger" or "Type","Endtype"

im confused.

someone plz help >.<
spooky
21
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 5th Sep 2007 16:03
Those weird commands are for an external collision Dll by Sparky, which kaedroho should have said is required.

Game also needs some sync commands in there as it runs at a zillion frames a second and so is unplayable in current state.

Boo!
Lucy
17
Years of Service
User Offline
Joined: 19th Apr 2007
Location: Roanoke, VA USA
Posted: 6th Sep 2007 19:02 Edited at: 6th Sep 2007 19:07
Quote: "i dont use things like
"as interger" or "Type","Endtype""


Sorry to disappoint, but that's actually proper code. And Type defines are INCREDIBLY useful. check this out



Then all you need to do is use score.player1 and score.player2

This may sound rather pointless with such a simple example. You might be asking "why not just keep a separate variable for each player?"

The answer is simple. Suppose you have a multiplayer shooter. In this shooter you have maybe 20 variables you need to track, one for each player. Say you have 8 players.



It'll get REALLY messy REALLY fast if you don't use type defined arrays. because then you need to have special cases for each and every single individual possible scenario.

As for declaring "as integer" or "as string" it's good code to do that. It's what they call a Good Idea™. If you don't do it, you're asking for trouble because the compiler needs to know what kind of variable you're using. You can't exactly have 27.8 bullets. How do you have a fraction of a bullet in your inventory?

One of the benefits is making absolutely sure that your variables are being controlled exactly as you want them. I had a friend who tried to make a health bar like so.



He didn't declare the variables as floats resulting in the code using pure integers. What happened next was that the health bar was either 0 or 100%, never anything inbetween. I suggested he declare them as floats and he didn't want to. He said he doesn't like doing "as this" and "as that". Basically told him in no uncertain terms to just freaking do it. And he went and did it. He ended up with:



And suddenly it started freaking working properly.

So before you go and dismiss a common convention of programming used by every single experienced programmer on the freaking planet just because you don't "like" it, think about my friend who couldn't get his health bar to work.

Not using these simple and extremely common (common for a reason) conventions of coding is the programming equivalent to a mechanic spraying Carb Cleaner into you car's engine. It's cheap. It's amateurish. It's not to be done if you want to be taken seriously.

My real question is "Is it that you don't like to use such things or is it that you don't comprehend what's going on and don't like having to learn new tricks?"

Sorry if I sound a little harsh, I tend to come off that way. Everything I've said here is constructive criticism, please take it as such.

Nothing I say is intended to be rude. My autism means that I do not know what is rude and what isn't rude. I apologize if I seem rude. It is not my intention.
kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 6th Sep 2007 19:09 Edited at: 18th Jan 2008 23:03
@Everyone
Sorry ive posted up the old source code and sadly ive lost the new one(I Forgot To Save It!). luckily ive compiled the new one which solves all the problems like speed, no collision dll ,etc.
you can download it here http://www.turbodog.co.uk/games1.htm

Kaitia
16
Years of Service
User Offline
Joined: 8th Sep 2007
Location:
Posted: 15th Sep 2007 13:15
As usually it dont work at my computer( the snipped codes never work) and i have got an question: How did you get the idea to make this game..
I mean... you aren't just going to sit in front of your cpu and type a code of 150 lines are you?

''To program or not to program that is the question''
kaedroho
16
Years of Service
User Offline
Joined: 21st Aug 2007
Location: Oxford,UK
Posted: 16th Sep 2007 15:25
@kaitia
Quote: "How did you get the idea to make this game"

its my first project so i decided to start with somthing simple so i chose pong.

bigmoss44
16
Years of Service
User Offline
Joined: 19th Sep 2007
Location:
Posted: 19th Sep 2007 21:09
i have no clue how to make games on this program, but i want to make a game, what shall i do>
calcyman
16
Years of Service
User Offline
Joined: 31st Aug 2007
Location: The Uncertainty Principle
Posted: 5th Nov 2007 18:13
Sparky's commands don't have sc_ before them.

Your signature has been erased by a hyper-intelligent pan-dimensional being (a mod)
vorconan
17
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 5th Nov 2007 21:28
Quote: "Sparky's commands don't have sc_ before them.
"


They do in V2



Homey the Clown
20
Years of Service
User Offline
Joined: 4th Apr 2004
Location:
Posted: 18th Dec 2007 22:36
@Kaitia
sure he could! why not start off small? sure it is probably one of the most re-occurring first projects there are but you got to start somewhere. I am actually very happy kaedroho is not another "i want to make a final fantasy game!" kinda person.

@Kaedroho
could I make a possible suggestion? Im not sure how familiar you are with programming or how many projects you have done but, I suggest you get in the habit of indenting your code and commenting as well.
like:


instead of:


Not indenting can get VERY confusing. I used to not indent and once I hit 1000+ lines I got lost in my code and went back and indented the whole project. Im now at about 3000+ lines and have never been lost after that! Now Im not sure if you already do this and just put this game together in 30 minutes or what so please dont take it offensively or anything. Seriously though, you seem to be on a good start of being an efficient programmer (I dont see many newbies using subroutines quite like you ).

@bigmoss44
...learn the language. But seriously though, do you have dark basic? If so, going through tutorials and help files would be a great start. Make sure you can walk before you can run...if you know what I mean.

Great job man,
Homey

"I don't think so... Homey don't play that."
-Homey D. Clown
Intel Pentium 4 2.4Ghz processor,512MB Ram,GeForce4 MX 4000

Login to post a reply

Server time is: 2024-05-17 07:27:03
Your offset time is: 2024-05-17 07:27:03