Jump to content

  • Log In with Google      Sign In   
  • Create Account

phil_t

Member Since 06 Oct 2006
Offline Last Active Apr 30 2016 05:51 AM

Posts I've Made

In Topic: triangle culling in close proximity to other triangles?

28 April 2016 - 08:38 AM

Post a screenshot of what it looks like when it doesn't intersect the ground (and presumably no triangles are erroneously culled).


In Topic: Returning by value is inevitable?

26 April 2016 - 12:41 PM

It's not *just* a problem with multi-threading. It also broken if you call the function a second time and are still using the value from the first one (It's also not re-entrant).


In Topic: List.Sort() lag

23 April 2016 - 12:04 PM

 The problem is, since its a loop, if I don't sort it the planet will load row by row, rather than closest to the player.

 

 

You could also iterate through the planet chunks in an order that corresponds to distance from the player... This might be a more "algorithimically complicated" way to address your issue, but sorting won't be needed. Off the top of my head, I feel that the Bresenham's line algorithm (or a 3d equivalent) might work for this.


In Topic: How to implement a Behavior tree(prefarably in Unity 3D)

22 April 2016 - 09:28 AM

 The thing now is I want to implement my own tree and a heads up on how I can do it will be appreciated.

 

Have you seen the talks/slides on this site? They might help.

 

A behavior tree core implementation is actually fairly simple. I mean, I wrote one a while back based on info I learned from the above reference site - I could dig that code up and give it to you - but looking at Behavior Machine in the Unity asset store, it does everything mine did and much more (and appears to plug nicely into Unity). What's wrong with it exactly? How is it limiting you?

 

The hard part is modelling the world and somehow distilling that into nodes in a BT. And you won't find any implementation that does that, because it will be specific to your game. So maybe you're looking for tutorials that help explain how to do that, or concrete examples of complex AI implemented using behavior trees? Let me know if you find any good info on that!


In Topic: 'External Code' taking up most of my CPU?

14 April 2016 - 10:55 AM

 

Is there an option for VS to show you the actual external code? I think it's a setting somewhere. Maybe this setting also affects the profiler so you can see what External Code means.

 

 

 

In vs2013 at least, it does indeed affect the profiler. (There's also a toggle in the main profiler summary view that lets you switch between "all code" and "just my code"). Running the sample code I posted above results in this (first number is inclusive samples): 

 

 

PerfTest.Program.Main(string[]) PerfTest.exe 177 0 100.00 0.00
    System.Linq.Enumerable.ElementAt(class System.Collections.Generic.IEnumerable`1<!!0>,int32) System.Core.ni.dll 177 10 100.00 5.65
        System.Collections.Generic.Dictionary`2.ValueCollection.Enumerator.MoveNext() mscorlib.ni.dll 141 141 79.66 79.66
        [Unknown] [Unknown] 26 26 14.69 14.69

 

The implementation of ElementAt calls MoveNext n times to locate the item at index (unless the IEnumerable can be cast to IList, which Dictionary can't). So it's a slow way of iterating through a dictionary's values.

 

Not sure what the call to [Unknown] is in ElementAt. Maybe that's the gc kicking in.


PARTNERS