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 / dot or sprite for unit dots on an minimap?

Author
Message
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 16th Aug 2006 23:08
iam confused if anyone can help me out waths the fastest way using the dot command or sprite?
wich one off them are the fastest way with dbp?
iam currently using dot with the lock pixel and unlock pixel command.
thanks and hope anyone can help me out on this .

iam currently rewriting my old mini map that used an secondary camera from above .
Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 16th Aug 2006 23:32
Use sprites, they are much faster than the dot command. Dot is very slow... don't use it.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 16th Aug 2006 23:44
yes but if i turn off the dot command so do i only get an 8 fps increase ?
that means that i dont havy anything displaying the units in the mini map.
when i use it o only get an 8 fps drop really weird ?
iam really confused ???????
have to check this out some more tomorrow.
but thanks for the input because iam an crappy coder .
Daemon
18
Years of Service
User Offline
Joined: 16th Dec 2005
Location: Everywhere
Posted: 17th Aug 2006 00:03
You might have better luck with the box command, making a really small box. Box doesn't require you to lock and unlock pixels for it to work quickly. If you are drawing a large amount of dots at a time then locking the pixels and using dot is worth it. For something like 10 dots at a time however, box can work better.

This is my demonstration:


IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 17th Aug 2006 01:03
@Cliff,
Don't worry too much - it's not that you are a crappy coder, it's just that you don't have experience yet. If in doubt, experiment. That's how most of us learnt DBPro, even if we had experience in other languages.

Follow Daemons advice here - dot is wickedly fast if you lock pixels once and draw them all together. It's sometimes worth storing all of your dot positions/colours into an array just so you can draw them all together before syncing.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 17th Aug 2006 19:51
thanks to you both it works great as i never could have imagened it .
i tryed out to make an array to store the positions in and then draw all dots or boxes in separate loop inside the main loop.
but the one that worked best whas to yust simply write these 3 lines in an already existing loop for the units.

Sx=(object position x(obj)*128)/terrainX#
Sy=(object position z(obj)*128)/terrainX#
box SCR_W#-128+sx,128-sy,SCR_W#-128+sx+1,128-sy+1

i inclded an small screenie..
thanks alot

i havent used dbp for about six months now so abit hard to get to it again.

Attachments

Login to view attachments
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 17th Aug 2006 19:54
i yust have to speed up the pathfinding also , i belive that the one iam using did you ian do ?
map and search ?
its great but abit rough for an rts.

i even have great fps with 21 units on screen at the same time now drooped like hell before.

Attachments

Login to view attachments
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 18th Aug 2006 15:50
I'm glad you're finding the code useful.

Instead of trying to make the pathfinding faster (it's already the fastest DBPro code available for A*), try calling it less often. No-one will notice if you delay a search for an entity for a frame or two when things are getting hectic, so try putting an upper limit on the number of searches that are allowed per frame.

If you download the zip from the codebase, you'll find a project in there called test_WayPoint that uses this technique. Just adjust the constants at the top of the code to change bot numbers, max searches per frame etc.

Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 18th Aug 2006 17:38
thats sounds usefull .
going to check it out right away.
cheers
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 20th Aug 2006 11:49
hi ian i did experiment a bit wath you told me about not searching the path at every cycle and i got about an 20 to 30 fps increace.
as before when 21 units did move at the same time so did the fps sometimes drop to 23 - 33 fps.
now are i only experimenting and set it to only search a path every 4 cycle for each unit with the units internal counter thru an array.
and so far it never drooped belowe 58 - 88 fps.
but its a bit screwy now when it reaches its final destination.
some units circle around before they stop.
but are going to do an distance check function to fix it now.
cheers

will youst have to see how much coding there will be done next week as i where in an car crash yesterday.
and my car is junk.
but iam lucky as i only got crappy pain on my body from the seat belt and airbag.
some stupid ass driver turned out in front of me when i was driving in aproximately 90 - 70 kmh ..
i will post an picture off my car on the forum as soon as i can get to to workshop that they towed my car to.
NeilF
18
Years of Service
User Offline
Joined: 2nd Aug 2006
Location:
Posted: 20th Aug 2006 12:18
Daemon - Thanks for the example... Box x,y,x,y doesn't actually draw anything though. Seems you have to do Box x,y,x+1,y+1 ?!

Surely this draws a dot 2 pixels by 2 pixels though?
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 20th Aug 2006 16:29
you get it more precise with an - value on the 2 first instead of an + value on the 2 last.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 20th Aug 2006 22:51
ok ian i tweaked it some more now each unit now gets it counter calculated depending on the current fps to get an smooth counter.
and it dose hardly drop anything anymore
yust have to tweak the adjustements with some distance calculations and stuff to now that i added.
was forced to as some of the pathfinding got strange at the final spoot they circled around alot
the screenie shows the current fps with 21 units walking and using the map and search at the same time .
lovely aint it

Attachments

Login to view attachments
NeilF
18
Years of Service
User Offline
Joined: 2nd Aug 2006
Location:
Posted: 21st Aug 2006 14:06
Cliff Mellangard 3DEGS - Noob question... How do you do the circles around the selected units? Not after specifics, just as a pointer into the direction I should look in.

Surely they're not sprites as you'd have to bend/size them according to your camera view etc.
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 21st Aug 2006 15:56
simple xrotate an simple plain object.
then inside your loop position that object at your units position.
like this ............

objx#=object position x(unit)
objy#=object position y(unit)
objz#=object position z(unit)

position object circle,objx#,objy#+3,objz#

objy#+3 ...by lowering or higher this nr 3 position the circle where you want it height weis aginst your unit.
and dont forget to texture and set ghosting on if you want that
i hope it helps
NeilF
18
Years of Service
User Offline
Joined: 2nd Aug 2006
Location:
Posted: 21st Aug 2006 16:08
Thanks... At the moment EVERYTHING helps!

[size=1]Asus P4PE | P4@3.22(533) | 2G PC3200 | ATI800Pro/XT@570/570 | Audigy2 | MatrixOrbital MX422 | XP Pro | 120Gb Maxtor Plus9IDE | 200Gb Barracuda.9Sata[/size]
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 22nd Aug 2006 15:23
@Cliff, I'm happy you got it to work for you.

Login to post a reply

Server time is: 2024-11-27 09:58:17
Your offset time is: 2024-11-27 09:58:17