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 / start programming

Author
Message
RisTar
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location:
Posted: 30th Mar 2003 15:36
well ive done tons of demos and write some stuff , but now i want to start programming a game , and i even dont know how to start , or how to build my engine , plz tell me how shuld i start working cause i really dont know !
Hamish McHaggis
23
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 30th Mar 2003 15:47
Start with something simple, like pong (everyone seems to do that one) or space invaders. First think about how you are going to do it, what you are going to check for or do... eg...

PONG

[start the main loop]
[draw the paddles]
[draw the ball]
[move the paddles]
[move the ball]
[detect to see if the ball has hit paddles]
...
...
etc

Think about things logically, so if you need something to do something at a point, think what conditions it will be under when it does those things. Dont think in terms of 'when the ball hits the paddles do this', think of it like 'when the ball is in this area do this' things that can have values and not just things that happen.

If you are stuck just go through the code, thinking what actually happens at each command and you will realise what you are doing wrong.

Hope I helped

Why the hell'd you ask me for crying out loud!?!
RisTar
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location:
Posted: 30th Mar 2003 20:15
but im not talking about pong ! im talking about n adventure ! what shuld be in my main loop ?

Attreid
23
Years of Service
User Offline
Joined: 27th Nov 2002
Location:
Posted: 30th Mar 2003 20:56
in your main loop ? some gosubs
use gosubs, so it's easier to understand your code
if you have dark basic pro, you can even have a dba for ever kind of gosubs (environnement, ennemis, weapons, camera, ....)
but try to have a code very tidy, it is the most important

Bu$herie
How many civilians is he going to kill ? I know that Bush will sit at God's left, next to Saddam.
Hamish McHaggis
23
Years of Service
User Offline
Joined: 13th Dec 2002
Location: Modgnik Detinu
Posted: 30th Mar 2003 21:44
Oh, If you've already done stuff like pong then thats ok, but if not then definately start there, I helps a lot.

For something like a FPS, you want to have gosubs in your main, loop for for...

- Player Position and Movement 1
- AI and Enemy Movement 5
- Scenery Movement (maybe) 4
- Collision Detection 2
- Weapon Control 3
- and so on...

Do them in the order I have numbered them with and expand on that. Before your loop you want to set up the scenery and load any media you need, don't do that in the main loop.

Why the hell'd you ask me for crying out loud!?!
BoB Vila
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United States
Posted: 31st Mar 2003 02:17
The key to starting a game and finishing it is careful planning.

First start with a basic outline of the story or concept behind the game. Then Identify the main characters in the game. Decide how the game will both start and end.

Then you want to create some sketches of Environment and Models.

At this point you should create a Flowchart of the gameplay. Such as movement,controls, abilities, weapons, interaction with enemies/friendlies.

Then you can start to write down in plain english (or whatever your native language is) what you want the program to do. An Intermediary between real Code and your raw outline.


That's about as Generic as you can get without knowing what type of game it is, ie RTS, FPS, RPG, ..3D/2d... what have you..

Bobvila.com made me take off my avatar! (dunno how they found out)
BoB Vila
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: United States
Posted: 4th Apr 2003 18:39
Well, they sent me an email saying it was an Illegal use of image. Since I was housing it on my Server at work they sent all these emails to my employers about it. Rather then make a big deal about it I just appologized and removed it. If I had it on one of those cheezy free website accounts, it would have been different.

Bobvila.com made me take off my avatar! (dunno how they found out)
bitJericho
23
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 17th Apr 2003 15:26
oh my god lol @ bob vila...that's some crazy stuff hehe..

but..

DONT USE GOSUBS
DONT USE GOTOS

unless u need them for event trapping in this case and this case only

FOR i = 2 to 4545
if i = 3 then goto exitloop
NEXT

exitloop:

this is the only time u use subs and gotos.. because they are messy icky icky, they create spaghetti code..nobody likes a gosub...

use functions instead...they will make your code very intelligable

The 3D Modeler's Group : http://groups.yahoo.com/group/3dModeler/
The Unofficial DB Newsgroup : http://groups.yahoo.com/group/DBMag/
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 17th Apr 2003 20:40 Edited at: 17th Apr 2003 20:42
I believe a top down flow is best, you can create a well structured program out of your ideas...for example...

<SEE SOURCE TAB on post below>


You are simply subdividing the tasks at each level, until you have manageable chunks or functions.

Good Luck!

Thanks in advance.
All the Best,
StevieVee
BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 17th Apr 2003 20:42
SEE SOURCE TAB

Thanks in advance.
All the Best,
StevieVee
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 19th Apr 2003 05:15 Edited at: 19th Apr 2003 10:04
Jerico2day - Wow!, You can't say don't use gosubs without giving a VERY, VERY good reason.

I do agree with you on goto's - DON"T USE THEM!, except for a very rare exit condition, maybe, they make for sloppy code.

If your program has more than a couple hundred lines of code, then I would expect any programmer to use gosub's and functions to compartmentalize the logic of the program.

Gosub's on the other hand tend to make for very readable, logical, and neat code. They should generally be used by everyone.

Now saying that, everyone has their own programming style, and yours may be to use one straight section of code with no gosubs.

If anyone has more than one or two goto's in their program, then they should consider programming another way.

In the programming world goto's are considered - BAD.
While gosub's are considered GOOD, even expected in your code.

Gosub's have very little overhead and lead to much more readable, and maintainable code by yourself or others.

I don't mean to criticize you Jerico2day , but RisTar should know what proper coding style would be expected of him in the programming community.

StevieVee, your top down flow is a good idea, putting ideas and logic down on paper first. It gets him thinking in a logical, segmented, seperate routine, function, gosub way.

Listen to what Hamish McHaggis and Bob Vila said above, do all the planning ahead of time, and get it all down on paper, then start coding.

Hope this helps RisTar, and good luck with your game!

Harry
23
Years of Service
User Offline
Joined: 20th Feb 2003
Location:
Posted: 25th Apr 2003 21:30
I dont know if this will work on DBP can you tell me please

Harry
23
Years of Service
User Offline
Joined: 20th Feb 2003
Location:
Posted: 27th Apr 2003 16:58
I Said plze
I had the 30 day trial but ran out of time

BatVink
Moderator
23
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 27th Apr 2003 18:38 Edited at: 27th Apr 2003 18:38
Make object blh (50,50,100),1

No.

"blh" would have to be a valid integer (that is, the number of an object that doesn't yet exist)

"(50,50,100)" would have to be an array and have a name ( "arr(50,50,100)" ), and the value for the index would have to be the number of an existing mesh.

"1" would have to be a valid integer of an existing image number.

Thanks in advance.
All the Best,
StevieVee
Harry
23
Years of Service
User Offline
Joined: 20th Feb 2003
Location:
Posted: 27th Apr 2003 20:50
Thanks Stevievee
you are great!

bitJericho
23
Years of Service
User Offline
Joined: 9th Oct 2002
Location: United States
Posted: 25th May 2003 10:46
no actually... you can do anything with a function that you can do with a gosub... and functions will always be better for the fact that they can return..and take in values, keep local values, but still access global arrays... im against both gosub and goto^_^ I can't stop the world from using them though hehe... it's up to you i guess

The 3D Modeler's Group : http://groups.yahoo.com/group/3dModeler/
The Unofficial DB Newsgroup : http://groups.yahoo.com/group/DBMag/
Critters
23
Years of Service
User Offline
Joined: 11th Apr 2003
Location: United Kingdom
Posted: 1st Jun 2003 20:02
is it just me, or is this the code snippets section?

Inkybro
23
Years of Service
User Offline
Joined: 31st Dec 2002
Location: Where I live :)
Posted: 20th Jun 2003 19:24
Yeah, I was wondering that exact same thing :o

It's better to be pissed off than pissed on, eh?

Current DBPro Savings Report: $1.40 Saved
haXor
23
Years of Service
User Offline
Joined: 12th May 2003
Location: United States
Posted: 21st Jun 2003 06:43
lol me too. but u cant always turn a gosub into a function, can u? like i cant think how u would do it for some stuff.

Sup Kids

Login to post a reply

Server time is: 2026-07-06 03:58:21
Your offset time is: 2026-07-06 03:58:21