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 / Grid system for my Map Editor kill FPS

Author
Message
Arbrakan
13
Years of Service
User Offline
Joined: 10th Oct 2010
Location: Geneva
Posted: 6th Aug 2011 20:06
Hi guys, I working on a map editor, and i have made a grid system, but he kill my FPS.. (70fps to 16-7fps...)

Maybe it is not the good way to code this ?

Here is my grid function:



Thanks a lot for read this, and for your help !

And by the way, how can i make a 3d "2d" grid sytseme for my map editor, i dont want to use Matrix, i want to make my own grid, but I don't now how I must do this in a 3d view.

(Sorry for my bad english, and thx google translate ^^)
chafari
Valued Member
18
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 6th Aug 2011 20:55
Hi there. I use this code in one of my Editors .I hope it can help.




Cheers.

I'm not a grumpy grandpa
Arbrakan
13
Years of Service
User Offline
Joined: 10th Oct 2010
Location: Geneva
Posted: 6th Aug 2011 21:12
Thanks a lot !, I gonna check this.
Neuro Fuzzy
16
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 7th Aug 2011 00:18
the line function is very very slow!

try locking and unlocking the pixels before/after editing?


Why does blue text appear every time you are near?
Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 7th Aug 2011 01:14
Another way is using stretched out triangles as lines (as limbs), you'd also have control over the color/alpha of each line as well.
Arbrakan
13
Years of Service
User Offline
Joined: 10th Oct 2010
Location: Geneva
Posted: 7th Aug 2011 15:16
Hi guys, and thanks for yours reply.

I dont see how I must use "LOCK PIXELS", can you explain it for me ?
Must i trensforme my 2d render into a bitmap to use with Pixel Lock ?

(If it can help someone who's read this post: antialias lvl, dont work with Lock Pixels)

Quote: "This command will lock the current bitmap for faster reading and writing of visual data. "


And for the limb, i am new in this "Land", but, i gonna check it. Need to learn more about Limb.

Thanks
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 7th Aug 2011 19:46 Edited at: 7th Aug 2011 20:01
I have only recently done a 2d map editor and had this same problem. I got round it by making the grid at the start of the program using lines, then copying the image. Then in the editor I simply pasted that image down as the screen refresh and then put my sprites on top. For more speed you could make a bitmap of the grid instead and use screen copy.


That code makes a grid and copies the image. You can then use that for your grid backdrop instead of redrawing it every loop using lines. startx and starty are really unneeded as they have a value of 0. I put them in to make it easier to read.

http://s6.bitefight.org/c.php?uid=103081
Neuro Fuzzy
16
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 7th Aug 2011 23:00
http://forum.thegamecreators.com/?m=forum_view&t=32482&b=4


Why does blue text appear every time you are near?
Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 7th Aug 2011 23:53 Edited at: 7th Aug 2011 23:55
This is what triangle can produce and what I use in my editor, though larger and with other effects:

Attachments

Login to view attachments
Arbrakan
13
Years of Service
User Offline
Joined: 10th Oct 2010
Location: Geneva
Posted: 7th Aug 2011 23:55 Edited at: 8th Aug 2011 00:45
Thanks all, it work fine now

Thanks Neuro Fuzzy for the doc, helpfull ! i have learned some things news.
(But i hate your avatar )

I know how to do that with a object, but it is the same way with a image ?

Thanks and, good night (/ good morning)

Sasuke Very nice render ! do you use antialias ? or you get a so nice render with your technique ? how you came to that ?, tomorrow i gonna learn limb !
Sasuke
18
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 8th Aug 2011 00:40 Edited at: 8th Aug 2011 02:27
Here's a small example (wrote quick) of how to make that (non limb though):

Arbrakan
13
Years of Service
User Offline
Joined: 10th Oct 2010
Location: Geneva
Posted: 9th Aug 2011 19:58 Edited at: 9th Aug 2011 19:59
Thanks to all for all the help !

I am still working on it, I thinks, i gonna post a screenshot soon.

And maybe make a WIP topic of my project.

Login to post a reply

Server time is: 2024-05-02 22:23:12
Your offset time is: 2024-05-02 22:23:12