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 / Learning to build a 3D world.. beginner's questions

Author
Message
Schnide
23
Years of Service
User Offline
Joined: 18th Oct 2002
Location: The DarkBASIC Side of the Moon
Posted: 11th Jul 2011 15:31
Hi all

Despite registering a long time ago, I had a brief flirtation with DBPro and then it went far to the back of my mind.

Well, I'm back and wanting to put a prototype together of an idea I have. It involves.. building a 3D city. Yes, yes! I can hear the growns in advance. I know this gets asked relatively frequently, and the answer tends to come back that there are different ways depending on your needs.

As this is a prototype, I don't intend on making a huge world but I do want it big enough to be vaguely convincing - so there'll be basic people walking around, I'd want it so that a few of the buildings have inner workings so you can look inside them, a few cars and basic night/day sequences. Everything else, the imagination can fill in.

I do have previous DarkBASIC Pro experience but it is basic. The most I've really done is generated a terrain and moved a 3D character along it.

So would you all be kind enough to suggest an idea of the basic principles and methods involved? At the moment, the only two methods I know are:

- Creating all the buildings with "make object box," piece by piece
- Using FPSCreator (which I don't currently have), building it in that and dropping it into DBPro

As I say, this is to build a prototype for the purposes of showing to other people to fully develop. I know this may look like a "I wANt to BUILD a GTA6 game!!! Luv from N00B" type request but I really want to see this come to life.

With thanks in advance,

schnide
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 11th Jul 2011 19:29 Edited at: 11th Jul 2011 19:33
Always a difficult one this, making an editor is always the best (if not most desireable) option. I recently messed about with semi random city generation ideas, to test out the new Dark Imposters addon. Here is a snippet how I made a quick cityscape.


That uses a 64x64 pixel bitmap to place objects down according to the colour it encounters. So if it sees red, it will place down a random building at the appropriate place on the 3D map, any other colour it ignores and moves on. You could add in different colours for different buildings if you don't want random generation of course. I use bitmap 1 for the map image so the point command gets the colour off that screen, not the 3d screen it is updating.
You could make boxes rather than loading objects in as well and set a random scale to them, which was the first thing I did before changing it to the above code, so I could use more detailed objects.
That's a quick way to get a test scene up and running anyway. You can get a feel for how many objects you can get away with on screen and such quite quickly. Simply by adding a few more red lines or dots to the image, or increasing it to 128x128 etc.

http://s6.bitefight.org/c.php?uid=103081
29 games
20
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 11th Jul 2011 21:53
Hi Schnide, you might find my game "20 parallel line" on the 20 line challenge board helpful.

http://forum.thegamecreators.com/?m=forum_view&t=178125&b=11

This creates a small city using data statements and it's been written in a way that allows the map to be easily extended.

The code itself is still compressed into 2 lines, so you'll have to expand it. Leave a nice comment on my thread and I might expand it and comment it for you
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 12th Jul 2011 04:29 Edited at: 12th Jul 2011 04:30
And I also did this that you can have a look at - (All free for any use) http://csnorwood.com/dark-gdk/wlsge/

Warning! May contain Nuts!
Schnide
23
Years of Service
User Offline
Joined: 18th Oct 2002
Location: The DarkBASIC Side of the Moon
Posted: 13th Jul 2011 02:21
Thanks for these, guys..

I've read in a few places that the DB forums have a bad reputation for hounding newbies, I already didn't think it was true but you've all just confirmed it to be absolute bulls**t

DVader Thanks for this! However in trying your code, I received the following error:

Could not determine parameter type of 'FIND FREE OBJECT (1,1000000)' at line 6

Is this because I'm missing Dark Imposters? Either way, your solution sounded very interesting. I think I'd need to see it working to appreciate it fully but I think I get the gist.

29 games - great code! Despite how 'simple' it is, I found myself playing at least four or five games when I should have been seeing if I could apply it to what I wanted. I think I might have to comment on a certain thread, won't I?

WLGfx - Again, thank you for this. It looks like I'm even less advanced than I thought I was.. So am I correct in understanding that, using your method, I would create the scene in WL-SGE and then use the code here (http://csnorwood.com/WLSGE/WL-SGE.htm) to explore it in DB Pro?

Thank you very much, fellow forumites.
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Jul 2011 02:53
Quote: "I've read in a few places that the DB forums have a bad reputation for hounding newbies"

Actually, I think that it's kinda true - but it's only true for the newcomers that don't even try.

Quote: "Could not determine parameter type of 'FIND FREE OBJECT (1,1000000)' at line 6"

That's one of mine. Follow the link in my signature, and download and install my plug-ins (they're totally free).

WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 13th Jul 2011 03:28
@Schnide - http://csnorwood.com/dark-basic-pro/wl-sge-dbpro/ is the updated loading code.

Yes, just build your scene then use the DBPro code to load it straight into DBPro. It will automatically set up your collision data using Sparkys DLL...

Warning! May contain Nuts!
Schnide
23
Years of Service
User Offline
Joined: 18th Oct 2002
Location: The DarkBASIC Side of the Moon
Posted: 13th Jul 2011 18:55
@IanM

Thanks for the plug-in link, it'll go on my PC tonight!

@WLGfx

Woah.. now, most of that code I don't understand. I think what intimidates me is creating a very in-depth and ideal world in the editor, but then loading it back into DB Pro and it being treated as one entire object and not being sure how to reference it should I need to rather than say, have things happen with specific buildings. Or is that the point? Do I build one single, static world in your editor that never really needs to be referenced as individual objects and then load in wholly separate objects for things that'll move like doors etc.? And once your intial code is loaded once, I can leave it outside of the main routines?

Hopefully I didn't just waste those lightbulbs.. I feel like I'm getting closer at least.
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 13th Jul 2011 23:04 Edited at: 13th Jul 2011 23:07
No, all the objects are separate in the scene you build in the editor and can be accessed individually and used as a normal object would be using the function objID=WLSG_GET_OBJECT(mem as integer,num as integer). 'num' is the objects reference as shown in the list in the editor.

This makes it easier to animate certain parts of the scene or do any number of things with objects. Doors, platforms can be moved around from within your own code.

The code can just be added as a separate file in your dbp project.

I'm going to be updating the WLSGE for DBPro so that it doesn't use memblocks and uses global arrays instead. It should make things a little easier for the programmer to use that way.

EDIT: You will also note that the editor can add zones. These show up as ghosted red boxes which can be used in your game as spawning areas, check points, etc.

Warning! May contain Nuts!
Schnide
23
Years of Service
User Offline
Joined: 18th Oct 2002
Location: The DarkBASIC Side of the Moon
Posted: 14th Jul 2011 11:33
@WLGfx

..and waypoints?

I'm going to give your editor a try. I hope I can come back to you if I have any more questions?

Thanks to everyone for all their help. DBPro is such a good tool, and something I think should be available in schools.
DVader
22
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 14th Jul 2011 22:00
Sorry, yeah that is one of IanM's matrix utils commands. I forgot to mention that. The editor WLGfx has posted is probably the best way to go by the looks, but the bit of code I posted is ok for a quick test. If you don't have the matrix utils plugin you could just change the find free object, to objectcount and move the inc objectcount to the top.

http://s6.bitefight.org/c.php?uid=103081
WLGfx
18
Years of Service
User Offline
Joined: 1st Nov 2007
Location: NW United Kingdom
Posted: 15th Jul 2011 00:25
Hey, good luck Schnide. It'd be good to see what you come up with...

All the DBP code works 100% at the moment but I will be updating it so that it doesn't use memblocks and my email address is usually checking at least once every 2 days...

Warning! May contain Nuts!
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 15th Jul 2011 05:24 Edited at: 15th Jul 2011 05:25
Also:
http://forum.thegamecreators.com/?m=forum_view&t=176286&b=6
[edit]
and of course, you can use all the models from there.


Why does blue text appear every time you are near?
Schnide
23
Years of Service
User Offline
Joined: 18th Oct 2002
Location: The DarkBASIC Side of the Moon
Posted: 15th Jul 2011 12:37
Ooooh

I think I'm going to get deeper into all of this than I originally imagined. I have a feeling that I'll have more questions before I have anything to show, and am going to go through this to refresh my memory in a lot of things too:

http://www.madladdesigns.co.uk/extras/DBProGuide.pdf

I don't want to do this half-a*sed. I will be back to this forum.

Thanks to all of you, I feel welcomed.

Login to post a reply

Server time is: 2026-07-10 17:19:55
Your offset time is: 2026-07-10 17:19:55