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 / - DBPro Coding Challenges -

Author
Message
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 8th May 2006 07:43
Sorry to double post but I have a question.

You make your objects, and then you want to position them to make... a Robot! How do you know were to position them? Is it guess work? Or are you able to work it out with simple maths?
If anyone can answer this I would be really thankful! You see I always spend about half-an-hour trying to position by objects! I just thought you guys know a different way (After seeing so many wonderful programs coded in literarly minutes!)
Thanks, and sorry if I sound like "Is their a magic way to program my programs to perfection!"


When in Trouble with anything visit here your number one stop for help
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 8th May 2006 09:17
draw it on paper first

if a foot is at 0 from the ground and its 10 units tall, then the leg is positioned at 10. If the leg is 50 units, then position the knee at 60. Just start at one point and start adding.


Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 8th May 2006 09:20
So do you add 10 at every point? (I was just using the robot as an example).

When in Trouble with anything visit here your number one stop for help
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 8th May 2006 11:29
@darth Vader - No Includes, all one source file.
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 8th May 2006 11:59
@BillR - excelent, thank you!

What do people think of the name dbShed?

I'd like the URL to be kind of general as it'd be really nice if the site could be opened up as a tutorial/snippets site. The snippets section here isn't great and there are a lot of tutorials out there but I'm unaware of any great repositry of them.

Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 8th May 2006 12:00
dbshed is great!

When in Trouble with anything visit here your number one stop for help
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 8th May 2006 12:33
Throwing my hat into this challenge. Uses Advanced Terrain and 5.9. If you have problems, make sure your Advanced Terrain is up to date and not duplicated. Still a lot more work to come.


Open MMORPG: It's your game!
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 8th May 2006 12:36
Riidii - it looks like that terrain isn't getting any normals - there is no lighting effects on it or anything! It makes it really hard to tell where mounds start and end...

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 8th May 2006 13:29
Thanks for the feedback Nic. Here's an update.

I think AT turns a lot of the object effects, like normals, off in exchange for speed. So a light map has to be used. I guess the one created by AT in this case wasn't so great. So I made my own lightmap using the heightmap. I think it looks better. Not perfect, just better.


Open MMORPG: It's your game!
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 8th May 2006 13:38
dbshed sounds good. Similar to my website name of dbhut.

Boo!
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 8th May 2006 13:47
I still get no lighting on the terrain... I wonder if its caused by the raw power that my work PC has with its pulsating Intel Onboard Decelera... I mean... "Accelerator".. See screenshot for the terrain I get.

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th May 2006 14:34 Edited at: 8th May 2006 14:38
@RiiDii

Glad to see you've joined the fray. Looks like I'll be busy when judging comes.

I tried your code (both versions) but couldn't get the camera to move forward until I made the following edit to your code:



I haven't got time to look at your lighting code just now (as Nick says, something isn't quite right) but I've found that if I stick close to the lighting effects given in the DBP Adv. Terr. example then I have no problems.

Also, try to get more hills and get rid of straight line boundaries between water and island(s) - this applies to other contestants too.

[Edit: just seen Nick's screenshot of RiiDii's terrain, he's obviously got the camera moving around - was that with RiiDii's code or was it edited? I'm using U6RC10 - has Adv. Terr. been updated since then?]
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 8th May 2006 14:46
That was Riidii's code - I just used the arrows. I might be 5.9....

RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 8th May 2006 19:45
GG: On that particular section of code, it should not even come into play until the camera is at the edge of the island and gets to the water level. So I have no idea how that edit even made a difference, unless for some reason in U6 the camera starts at a Y<6. Maybe the AT starts at a different Y position in U6? UP at the top left of the screen are the X, Y, Z coordinates (then FPS)in that order. Can you post the initial second value please?

@ Nic, the lighting still is not all that great, but it I am sure it is better. If that screenshot is from the top of the island, the lighting is fairly bright. Try walking towards the edge and see if there is a difference. Here is a screenshot of what I get.


Open MMORPG: It's your game!

Attachments

Login to view attachments
RiiDii
19
Years of Service
User Offline
Joined: 20th Jan 2005
Location: Inatincan
Posted: 8th May 2006 20:38 Edited at: 8th May 2006 20:55
Here's some grass. There is a lot more to come, but I wanted to test the look of the grass.





Open MMORPG: It's your game!
Alexb Orsova
18
Years of Service
User Offline
Joined: 6th Dec 2005
Location:
Posted: 8th May 2006 22:28 Edited at: 8th May 2006 23:42
hey guys, what's up? here's my updated code.


>added clouds
>improved atmospheric effects (dawn/dusk)
>added trees
>improved camera controls (+/- keys control height)
>improved waves (now smoother)

suggestions/comments welcome
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th May 2006 23:13 Edited at: 8th May 2006 23:34
@RiiDii

Just been able to test your latest version (v3). The camera starts at (0,1,0) and is facing along one edge of the terrain and I can't move the camera forward unless I rem out the bit I mentioned before.

When I rem it out, another problem arises. At certain points in the terrain, the landscape mysteriously disappears and reappears. For example, at coords (473.24,4.82,568.89) I can only see blue (sky and sea look almost identical), but if I move forward a bit to (473.24,4.82,568.89) I can see landscape and sky immediately in front of me! Makes me wonder if I've moved in/out of a sky box or something. This is consistent across runs.

Are you using 5.9? I vaguely recall there being bugs in the Adv Terr commands for that version, so if you've made adjustments to satisy 5.9 perhaps it won't work in U6. I've had no problems with Adv Terrain in upgrades 5.7, 5.8 and 6.0 (I didn't bother with 5.9).

Oh yes, the grass. Seems ok, but it's structure might be less obvious if you scaled it down a bit.

Edit: here's a screenshot of the appearing/disappearing terrain on the boundary of the problem.

Attachments

Login to view attachments
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 8th May 2006 23:22
@Alexb Orsova

Just tried your code and it won't compile unless I remove the "." in the following line (in function add_bushes). Did you test it?



When corrected it looks fine - but I still can't move around the landscape. Also, the days seem very short and the nights rather long. The cloud images look a bit obviously rectangular - can you do something to get rid of their straight edges?
Alexb Orsova
18
Years of Service
User Offline
Joined: 6th Dec 2005
Location:
Posted: 8th May 2006 23:38 Edited at: 8th May 2006 23:47
@GG

I didn't know about the "." because it compiles fine on my machine.
I'll try to do something about the clouds, but I'm not very good with textures... You can't move around the landscape on purpose, the code looks best from that point of view. If it's absolutely required, I'll change it to allow movement around the entire landscape. Thanks a lot for your suggestions.

[edit]
@GG

I checked the time that it's day and the time that it's night and they're almost the same. Night and day each last for approximately 24 units in the time# variable.
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 9th May 2006 00:10
im not posting anymore of my work 'till the last day of the challenge!

stargate sg-1 the one show that never gets old
BillR
21
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 9th May 2006 05:46
dbshed is ok.
What about dbprovault?
The end is near
19
Years of Service
User Offline
Joined: 19th Jun 2005
Location: USA
Posted: 9th May 2006 06:29
how about:
DBPro.com

stargate sg-1 the one show that never gets old
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 9th May 2006 09:27
dbpro.com is probably a little bit illegal (the whole stealing someone's product name thing, kind of like MikeRowSoft.com )

dbprovault.co.uk is quite good...

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th May 2006 09:32
Quote: " kind of like MikeRowSoft.com "

even though technically his birth certificate would show that he had the name first.


Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 9th May 2006 10:07
I know this is of topic guys, but can somone give me some help with heightmaps! I don't know were to get started!
This will hopefully be used in the challenge (if I have enough time!)
Thanks!


When in Trouble with anything visit here your number one stop for help
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th May 2006 11:41
@Darth Vader

A heightmap is just an image where the colour components are interpreted as heights. The precise interpretation depends on the application. The usual one (what I use and what I think Advanced Terrain uses) just totals the three components to get the height. So white is the colour rgb(255,255,255) and this would be interpreted as height 3x255=765, and full pure yellow, i.e. rgb(255,255,0), would be a height of 510. Generally bright areas are "high" and darker areas are "low". This approach gives you 766 different heights to play with, which is usually enough.

You can create heightmaps very easily - but getting realistic random looking ones is a little bit harder. What I sometimes do is start with a crude black and white picture in MS Paint and then blur the image till I get the map I want. This will be a greyscale image - i.e. only colours such as rgb(123,123,123), rgb(241,241,241) - so only 256 different levels will be possible (this is enough really). I've attached a simple example which shows an initial and final heightmap I created this way.

For this challenge though, you'll need to create the initial image within your program. One way would be start with a blank black 256x256 bitmap, draw a number of white filled boxes on it (away from the edges of the bitmap). These white boxes would be your crude hills. Then use blur bitmap several times (if I get time today I'll post a simple example so everyone knows what I'm talking about - although blur bitmap is OK but rather unwieldy for this particular task).

Next step is to add some random noise to all the colour components of the heightmap (remembering that the values must be in the range 0-255). This will make a very rough looking terrain surface - but you can smooth that a few times using blur bitmapagain. With a bit of experimentation you should be able to get qhite a realistic heightmap.

There are many other ways - but the above should get you started.

Hope this helps.

Attachments

Login to view attachments
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 9th May 2006 12:01
dbpvault is available - do peopel prefer dbpvault or dbshed?

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th May 2006 12:06
Quote: "dbpvault is available - do peopel prefer dbpvault or dbshed?"


I vote dbpvault .
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 9th May 2006 12:35
Thanks GG, I also found a tutorial on the newsletters!
I will hopefully post my enter a little a little later on!


When in Trouble with anything visit here your number one stop for help
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 9th May 2006 12:56
How do you set the height of individual matrix tiles?

When in Trouble with anything visit here your number one stop for help
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 9th May 2006 13:16
Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 9th May 2006 13:34
Okay, can you see anything wrong with this code

Doesn't wrok for me!


When in Trouble with anything visit here your number one stop for help
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 9th May 2006 13:38
yup - chuck an update matrix 1 after the set matrix height.

Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 9th May 2006 14:48
Is it possible to explain the set matrix height command. I don't understand the help file. (Hurry up Lee bring out the new help file ).

When in Trouble with anything visit here your number one stop for help
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th May 2006 14:55
@RiiDii
Just realised what was probably happening when I was running your program - I suspect the camera was not staying above the terrain for some reason. Don't know why you didn't have this problem though.
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 9th May 2006 15:32
@Darth - all it does is set the height of a point on the matrix. If you have a matrix as you did (10,10,2,2) that means you have a grid of tiles 2x2, each tile being 10x10 world units.
A 2x2 grid has 3x3 points...

The *'s are the points you edit. When you set the height of point 1,2 you are effecting the bottom-middle point.

Now, instead of all your tweaks editing the mesh individually, the engine must remember them and when you do update matrix, it applies them all in one go (more efficient that way). So your code should be:


Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 9th May 2006 15:39
How come this code doesn't work


When in Trouble with anything visit here your number one stop for help
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 9th May 2006 15:42
Where is coordinate 0, 3 in a 2x2 grid? Bearing in mind the grid starts at 0,0...


Darth Vader
19
Years of Service
User Offline
Joined: 10th May 2005
Location: Adelaide SA, I am the only DB user here!
Posted: 9th May 2006 15:53
I have lost it
You probably think I am the dumbest noob!

When in Trouble with anything visit here your number one stop for help
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 9th May 2006 15:55
Not at all! The fact you're trying yourself first without saying "SOMEONE TEACH ME L33T MATRIX CODEZ" immediately shows lack of noobness. And as for dumbness - everyone does the whole "out of range thing" all the time

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th May 2006 19:34
DV is just playing with us. He's really got a secret project to kick our butts and steal the challenge!


Alexb Orsova
18
Years of Service
User Offline
Joined: 6th Dec 2005
Location:
Posted: 9th May 2006 23:00 Edited at: 9th May 2006 23:02
My Windows machine stopped working yesterday because of a hardware failure (power source ) so I can't develop my code further until I fix it. Just in case something happens and I don't fix it in time for the deadline, I'm posting the latest code that I have from the linux machine I have in the basement.

Updated Code:


>updated rand_island() function
>two camera modes added
(use 'm' and 's' to toggle, arrowkeys & +/- keys to control)
>updated add_bush() function

just out of curiosity, who else is planning to enter ths challenge?
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th May 2006 23:05
To all those entering the challenge

Please let us know which upgrade version of DBP you are using for your entries - I can then run them under the right conditions when I judge them. I already know that RiiDii is using 5.9, but I don't know about the rest of you - and I have a sneaky suspicion there will be some last minute entries to amaze us and, of course, they will all use some obscure version of DBP that can't be downloaded because of some obscure server problem when the time comes ...

Also, if you use someone else's idea or code as part of your entry, please be courteous and say so.
Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 9th May 2006 23:21
@Alexb Orsova

Thanks for your latest code. I couldn't get the +/- keys to do anything - should I be pressing another key at the same time?
Alexb Orsova
18
Years of Service
User Offline
Joined: 6th Dec 2005
Location:
Posted: 9th May 2006 23:30
@GG

use the +/- keys on the keypad (right side of keyboard )
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 9th May 2006 23:45
not all keyboard have a keypad (eg laptops and some small keyboard for PC's)

Alexb Orsova
18
Years of Service
User Offline
Joined: 6th Dec 2005
Location:
Posted: 9th May 2006 23:52 Edited at: 10th May 2006 00:12
@Nicholas Thompson

Sorry, I completely overlooked that. The program uses the +/- keys on the keypad of a normal keyboard. I'm not sure if it would work with a laptop keyboard.

[EDIT] Wow, it's pretty deserted around here this time of day.
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 10th May 2006 00:30
I'm still thinking about domains - do people like db-site pr dbpro-site ?

Green Gandalf
VIP Member
19
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 10th May 2006 00:46
@Alexb Orsova

Quote: "use the +/- keys on the keypad (right side of keyboard )"


Thanks. But why not have just one camera which moves around the terrain, e.g. use the +/- keys to go forwards/backwards instead of up and down?

@Nicholas Thompson

Are you entering? Your memblock example with waves (Code Snippets thread?) would be useful here (once you've sorted out the u,v data).
Nicholas Thompson
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: Bognor Regis, UK
Posted: 10th May 2006 00:47 Edited at: 10th May 2006 01:47
I am going to enter - if I get time. I'm busy all weekend being tutored in how to become an expert in Drupal (a CMS)..

EDIT:
Here is my fixed wave simulator Cheers for the help with this GG


Login to post a reply

Server time is: 2024-11-24 22:47:39
Your offset time is: 2024-11-24 22:47:39