Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4] 5 6 ... 21

Author Topic: Will we ever get to a point where forts don't die FPS deaths?  (Read 65507 times)

madk

  • Bay Watcher
    • View Profile
    • pineapplemachine
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #45 on: June 17, 2010, 06:45:21 pm »

Manhattan is going to be the fastest, I suppose, but it isn't anything near accurate.


Anyway, someone recommended a while back to categorize items into general sections and check the items within the closer sections first. If this isn't done already, it certainly should be.


EDIT: That algorithm I described doesn't produce a circle, it produces a diamond. I'm fiddling with it a little to see if I can make something fair circular using only primitive math functions.

EDIT: Combining the algorithm and Manhattan distance would yield an octogon. Maybe that'll be useful to someone.
« Last Edit: June 17, 2010, 06:54:02 pm by madk »
Logged

Rafal99

  • Bay Watcher
    • View Profile
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #46 on: June 17, 2010, 06:58:41 pm »

@madk: Programming related stuff.

Spoiler (click to show/hide)
« Last Edit: June 17, 2010, 07:00:57 pm by Rafal99 »
Logged
The spinning Tantrum Spiral strikes The Fortress in the meeting hall!
It explodes in gore!
The Fortress has been struck down.

gtmattz

  • Bay Watcher
  • [PREFSTRING:BEARD]
    • View Profile
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #47 on: June 17, 2010, 07:56:27 pm »

4 things I do to save FPS:
  • Embark on 3x3 or smaller areas. The new features really don't need any larger.
  • Set up smart burrows to restrict accessibility and thus reduce pathfinding load.
  • Use ramps instead of stairs whenever possible.
  • Avoid large amounts of flowing liquids if possible.

The others are self explanatory but why does ramps instead of stairs help fps?

You know, I really have no idea, all I know is that when I start using a lot of stairs, especially shafts of stairs, that my FPS starts tanking.  I am assuming it is some kind of path-finding issue, but really haven't the slightest idea why it makes a difference, I just know that it does. sorry  :-[
Logged
Quote from: Hyndis
Just try it! Its not like you die IRL if Urist McMiner falls into magma.

madk

  • Bay Watcher
    • View Profile
    • pineapplemachine
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #48 on: June 17, 2010, 07:58:45 pm »

The equation I described yields a diamond:

Code: [Select]
     X     
    XXX   
   XXXXX   
  XXXXXXX 
   XXXXX   
    XXX   
     X     

Manhattan distance is a rectangle.

Code: [Select]
  XXXXXXX 
  XXXXXXX 
  XXXXXXX 
  XXXXXXX 
  XXXXXXX 
  XXXXXXX 
  XXXXXXX 

If you combine them, you can get an octagon, which is pretty darn close to a circle, and requires staggeringly less computation than using sqrt.

Code: [Select]
           
    XXX   
   XXXXX   
   XXXXX   
   XXXXX   
    XXX   
           

- Using a minimum Manhattan distance of 2 and making sure my algorithm shifts left once and considers only the XY plane with a minimum distance of 8. Shifting multiple times increases the "distance" on said axis at any given truly linear distance. For example, shifting the Y dimension twice would cause the diamond to remain the same width be be only half as tall.


It's not manhattan distance because it's being multiplied.


I'm doing just a bit of research on time comparisons, though. I'll get back in a second.

Rafal99

  • Bay Watcher
    • View Profile
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #49 on: June 17, 2010, 08:10:00 pm »

Well I never remember which is named Manhattan, square or diamond.

Anyway xdist+ydist+zdist gives diamond.
maximum(xdist, ydist, zfist) gives square.
xdist = abs(target_x - source_x), same for others.

Euclidean distance doesn't require sqrt as I said before, so it will probably be faster than calculating both above distances at the same time. And more accurate.
« Last Edit: June 17, 2010, 09:39:35 pm by Rafal99 »
Logged
The spinning Tantrum Spiral strikes The Fortress in the meeting hall!
It explodes in gore!
The Fortress has been struck down.

madk

  • Bay Watcher
    • View Profile
    • pineapplemachine
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #50 on: June 17, 2010, 08:20:34 pm »

Ah, wait, I made a mistake. Manhattan is indeed a diamond. I don't know how I got the idea that it was a square. My apologies.

zwei

  • Bay Watcher
  • [ECHO][MENDING]
    • View Profile
    • Fate of Heroes
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #51 on: June 18, 2010, 01:46:36 am »

Hint: you do not need to have accurate distance, you just need "yardstick" and as such, you can easily just use:

(x1-x2)^2+(y1-y2)^2+(z1-z2)^2

Yes, all distances you are going to compare will be power of two of real distance, but that is not something you have to care about really much if you are looking for closest object without doing pathing.

It can cause probles with displaying rock that is 2 tiles away as 4 tiles away, but you can sqrt it for display purproses (which is done in menus that pause game and as such will cause not slowdown because it is like 10 roots, costing nothing when most lag is user input anyway.)

fanatic

  • Bay Watcher
    • View Profile
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #52 on: June 18, 2010, 03:26:55 am »

(x1-x2)^2+(y1-y2)^2+(z1-z2)^2

I may be wrong, but multiplication is very bad performance-wise, compared to sums bitshifts or Abs, it may be O(log n) or something (my computer science classes are far away...) on the number of bits. but hey the others are just one operation. you cant beat that :P
« Last Edit: June 18, 2010, 03:33:49 am by fanatic »
Logged
fanatic cancels play DF : gone berzerk at framerate.                                                  x1000
------------------------
Pour magma first - ask questions later!

Jake

  • Bay Watcher
  • Remember Boatmurdered!
    • View Profile
    • My Web Fiction
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #53 on: June 18, 2010, 03:42:20 am »

Something that's worth bearing in mind here is that the game is currently less than one third feature-complete. At this point Toady One's approach seems to be to put most of his effort into getting the content to fit his vision of the game DF is intended to become, only changing code he's already written when absolutely necessary. Systematic streamlining and optimisation will probably take place after we hit v1.0.
This may be frustrating for us in the short term, but it will ultimately bring us the finished product a lot faster.

That being said, there are not a hell of a lot of game forums where a gripe about performance issues would turn into an earnest discussion about a practical suggestion to help the developer solve some of them. Good on the lot of you!
Logged
Never used Dwarf Therapist, mods or tilesets in all the years I've been playing.
I think Toady's confusing interface better simulates the experience of a bunch of disorganised drunken dwarves running a fort.

Black Powder Firearms - Superior firepower, realistic manufacturing and rocket launchers!

zwei

  • Bay Watcher
  • [ECHO][MENDING]
    • View Profile
    • Fate of Heroes
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #54 on: June 18, 2010, 04:01:45 am »

(x1-x2)^2+(y1-y2)^2+(z1-z2)^2

I may be wrong, but multiplication is very bad performance-wise, compared to sums bitshifts or Abs, it may be O(log n) or something (my computer science classes are far away...) on the number of bits. but hey the others are just one operation. you cant beat that :P

Yes, it has roughly ~10 as much latency as basic instructions, still lightning fast compared to division (and obtaiing square root):
http://www.intel.com/Assets/PDF/manual/248966.pdf

If you want it rough, you can indeed do abs(x1-x2)+abs(y1-y2)+abs(z1-z2) and be done with it (no need to shift here).

fanatic

  • Bay Watcher
    • View Profile
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #55 on: June 18, 2010, 04:27:16 am »

http://www.intel.com/Assets/PDF/manual/248966.pdf
I think i found what could be my next "Donation" :) .  Print out bind and send. Potentially could benefit much more than what it would cost.
Logged
fanatic cancels play DF : gone berzerk at framerate.                                                  x1000
------------------------
Pour magma first - ask questions later!

frightlever

  • Bay Watcher
    • View Profile
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #56 on: June 18, 2010, 04:46:54 am »

Systematic streamlining and optimisation will probably take place after we hit v1.0.

By which time we WILL all have quantum computers. :P
Logged

Rafal99

  • Bay Watcher
    • View Profile
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #57 on: June 18, 2010, 06:24:02 am »

Systematic streamlining and optimisation will probably take place after we hit v1.0.

By which time we WILL all have quantum computers. :P

By that time DF will have so much features that it will run with 5 fps on quantum computers...
We need some serious optimization earlier imho, fortunately pathfinding rewrite is part of the siege improvements so it should come in the more or less nearby future.
Logged
The spinning Tantrum Spiral strikes The Fortress in the meeting hall!
It explodes in gore!
The Fortress has been struck down.

zwei

  • Bay Watcher
  • [ECHO][MENDING]
    • View Profile
    • Fate of Heroes
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #58 on: June 18, 2010, 06:33:37 am »

Systematic streamlining and optimisation will probably take place after we hit v1.0.

By which time we WILL all have quantum computers. :P

A bit overshot, but it is certainly gpood point: feature creep continues to decrease fps, but new hardware offsets that.

Hammurabi

  • Bay Watcher
    • View Profile
Re: Will we ever get to a point where forts don't die FPS deaths?
« Reply #59 on: June 18, 2010, 07:33:40 am »

Something that's worth bearing in mind here is that the game is currently less than one third feature-complete. At this point Toady One's approach seems to be to put most of his effort into getting the content to fit his vision of the game DF is intended to become, only changing code he's already written when absolutely necessary. Systematic streamlining and optimisation will probably take place after we hit v1.0.
This may be frustrating for us in the short term, but it will ultimately bring us the finished product a lot faster.

%   Release Date
21   8/9/2006
22   10/2/2006
23   1/18/2007
27   10/29/2007
28   7/16/2008
31   4/1/2010

Based on a linear trendline, the v1 is projected to be here sometime around 2034.  I think it is amazing what Toady has done.  Lets just be realistic on how long this ambitious design will take to complete.  Putting off optimizations for another 24 years just isn't going to work.
Logged
Back in 1971, Nolan Bushnell of Atari said, "All the best games are easy to learn, and difficult to master," a design philosophy now treated as instinctual by nearly every designer in the industry.
Pages: 1 2 3 [4] 5 6 ... 21