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 Discussion / 2d box problem over 3d renders

Author
Message
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 24th Jan 2004 21:06
Hey everyone

I'm building an 3d RTS game (i know i know all my posts begin like this...) and i'm trying to draw health bars. I made it and it works, but theres one big problem i cant fix. The bars are drawn above the units, but when i move the camera or the unit moves, there are 2 healthbars for 1 unit. The new one is positioned nicely above the unit, but the old one is still on its old position. Very weird huh? And no, im not drawing the bars 2 times... I'M NOT STUPID (yet...)

Plz help me, else i need 2 make 3d bars but those are a little harder to make and im really lazy

Juzt a dude who likez progging - Me loves RTS games
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Jan 2004 00:39
need to see some code.

"eureka" - Archimedes
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 25th Jan 2004 11:57 Edited at: 25th Jan 2004 11:59
Ok Phaelax heres da code


the Selected() array defines if a unit is selected or not. Then it prints the bar above the unit. Health() is actually damage (stupid i know).

I hope you can find a solution for it... thnx in advance

Juzt a dude who likez progging - Me loves RTS games
Phaelax
DBPro Master
22
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Jan 2004 12:41
As far as I can tell, that should work fine. I don't see any reason for it to display two boxes for 1 unit.

"eureka" - Archimedes
Don Malone
22
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 25th Jan 2004 17:25 Edited at: 25th Jan 2004 17:38
You might have to add an extra variable to make sure a box is not redrawn for the same unit or not drawn while a movement command is active for a unit. This could cause other problems but I am also unable to see why two boxes are drawn for one unit unless there is an unknown behavior problem with the Box Object code.

But why would it try to draw the same object twice.

It always occurs during movement of the camera or unit so it has to be assumed that the box code is drawing the box at two differnet locations because of the movement of the screen.

I don't really know what to do; I am just a newb.

------------- EDIT ---------------------------------

Quote: "box object screen x(unit),object screen y(unit),object screen x(unit)+BarLength,object screen y(unit)+2"


I look up the box command and it shows
"BOX Left, Top, Right, Bottom" as the format

And for Object Screen X
"Return Value=OBJECT SCREEN X(Object Number)"

Should
Quote: "box object screen x(unit)"

be written as
Quote: "box (object screen x(unit))"

or does this format not matter?

I am new and that is how it would be done in some of my VB programs.

Wasting CPU Cycles since the 286 was a hot machine.
Don Malone
22
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 25th Jan 2004 17:41
In VB it is about order of math.
Elements in () get figured first before the rest of the equation.

That is why I am asking if the elements of the box command should not be calculated first. I can not think of the order of math in DBC off the top of my head.

Sorry if I am incorrect.

Wasting CPU Cycles since the 286 was a hot machine.
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 26th Jan 2004 10:27
DBoy780, In DB, that shouldn't matter.

You're right though, it only seems to do it when where it has to be pasted is moving.

I think it is to do with the way that DB get's the screen coordinates.

I had the same problems when I used onscreen numbers to identify objects...
I figured out a quick fix, but it's not too good...


Hope I Helped...


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 26th Jan 2004 17:10
@ Jess - you mean that 1 loop prints, the next one doesnt, the next one prints again, etc... Simple, but i think it works. I'm going to test it when i'm back from my guitar lessons

Juzt a dude who likez progging - Me loves RTS games
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 26th Jan 2004 17:59
Yeah, that's what It does, but it doesn't completely solve the problem, your still going to get the problem where it seems as though it is printing twice.

Also, if the FPS drop to about 20, It'll look like it's flashing ( cos for the text, it's FPS are 10 ).

It's a crude fix, but you might just be able to get away with it.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 27th Jan 2004 21:04
Half victory!

Yes, there's only 1 bar printed now!

Nope, the bars aren't positioned at the right place when moving camera

I've had it with those stupid 2d commands! Screw them! I'm gonna make some 3d plane bars. Works better/looks nice

Juzt a dude who likez progging - Me loves RTS games
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 28th Jan 2004 08:11
lol.

Well, at least I showed you a good way for a quick fix.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Don Malone
22
Years of Service
User Offline
Joined: 27th Apr 2003
Location: Birmingham, Alabama
Posted: 28th Jan 2004 13:47
Very interesting. Thanks for the insite JT. I will have to make a note of that.

Wasting CPU Cycles since the 286 was a hot machine.
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 28th Jan 2004 18:58
Those 3d things are much better

Juzt a dude who likez progging - Me loves RTS games
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 29th Jan 2004 11:04
You just use planes that are coloured?

And you just stuck em infront of each unit ( once it was selected )?

@DBoy; Thanks man Just trying to help.

Jess.


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy
Sjakie
21
Years of Service
User Offline
Joined: 17th Dec 2003
Location: Netherlands - Delft
Posted: 31st Jan 2004 21:23
Exactly

Juzt a dude who likez progging - Me loves RTS games
Jess T
Retired Moderator
21
Years of Service
User Offline
Joined: 20th Sep 2003
Location: Over There... Kablam!
Posted: 1st Feb 2004 23:56
lol, nice


Team EOD :: Programmer/Logical Engineer/All-Round Nice Guy

Login to post a reply

Server time is: 2025-05-22 14:06:05
Your offset time is: 2025-05-22 14:06:05