Jump to content

  • Log In with Google      Sign In   
  • Create Account

Postie

Member Since 28 Nov 2010
Offline Last Active Jul 04 2016 09:29 PM

Posts I've Made

In Topic: towards a faster A*

17 April 2016 - 07:25 PM

I second Alvaro's suggestion re: the Heap. I remember reading about A* and not know how a heap worked it seemed pretty scary, but once I had a crack at implementing it and it started to made sense, my A* implementation became several orders of magnitude faster. 


In Topic: A*, A Star: impassable nodes can just go on the closed list?

09 April 2016 - 04:23 PM

Unless you have an infinite map, you have to do some kind of test to make sure you don't go outside the map bounds when looking for neighbours at the edges of the map. If you treat impassable terrain the same way, it will never be processed. 

 

Also, remember, high cost is not the same as impassable. If the numbers align, that node may be considered a viable route.


In Topic: Suggestions for software for 2D animation

09 February 2016 - 06:44 PM

Looks interesting. Thanks for the suggestion.


In Topic: Unique ID per type

20 January 2016 - 11:40 PM

SeanMiddleditch is 100% correct. If you want to be able to load saved game states (eg: save games), you need to define the Id's in such a way that they can never change. The only way to do this is to assign them yourself.
 
Generating a hash from the name of the type seems like a good idea, but what if you ever decide to change the name of your class? For example if you decide that "LightComponent" should be "LightingComponent"?

 

Another thing you will need to consider is hash collisions. They are rare, but they can happen. Check out the hash collision tests done in the following stackexchange post: http://programmers.stackexchange.com/questions/49550/which-hashing-algorithm-is-best-for-uniqueness-and-speed
 
They found 7 collisions in the english dictionary using the DJB2 algorithm you're considering:
 

DJB2 collisions

  • hetairas collides with mentioner
  • heliotropes collides with neurospora
  • depravement collides with serafins
  • stylist collides with subgenera
  • joyful collides with synaphea
  • redescribed collides with urites
  • dram collides with vivency

In Topic: Drawing on Timer tick

11 January 2016 - 04:31 PM

Have a look at Dispatcher.Invoke(). It's designed precisely for this purpose.

 

http://stackoverflow.com/questions/1644079/how-can-i-use-the-dispatcher-invoke-in-wpf-change-controls-from-non-main-thread


PARTNERS