Thank you everyone! What a surprise to be on HN today. Happy to answer questions!
Draggable objects
61–70 of 147 posts
Re: Draggable objects
#62Do graph search algorithms have applications for strategy? https://www.redblobgames.com/pathfinding/a-star/introduction... Consider a game like age of empires. The cost of attacking a village goes up when a wall is built around it. But when canon are invented, the cost goes down. Can we model each map (before and after invention of canon) and use it to plan a strategy? Same for building a port , portal or airport.
I think a lot about some advice I heard from the creator of Brogue. Essentially players have a tough time figuring out how AIs make their decisions and often assign complex motives to them when they don't exist. His example was he coded archers to try to maintain a position in some range band from the player as their primary motivation in a vacuum. The community would assign all sorts of supposed logic to archer behavior because in real-world environments with extra geometry or extra situational AI routines they couldn't see behind the curtain. Additionally, that most game AI exists to create a fun experience for the player, we only make it try to play well in service of that goal.
Re: Draggable objects
#63Thank you everyone! What a surprise to be on HN today. Happy to answer questions!
I've a quick question. How do you restrict the dragging movement to an axis using the built-in DOM events like dragstart/etc. I had a drag & drop feature implemented using the dragstart/dragenter/dragover/drop/etc events. I couldn't find a quick way to restrict the dragging movement to the x-axis. JQuery's drag and drop API used to support it. I'm trying to use the native DOM events/api only. Any information or pointers are greatly appreciated.
Re: Draggable objects
#64Re: Draggable objects
#65One thing missing: accessibility. how ought facilitate drag using keyboard controls?
Re: Draggable objects
#66Thank you everyone! What a surprise to be on HN today. Happy to answer questions!
Re: Draggable objects
#67One of the hardest things I have needed to code from scratch is drag-to-reorder. It seem so natural from a user perspective, but when you get into inconsistently sized items, having to create placeholders between items, detecting edges, going down rabbitholes of box-fitting algorithms... it's a fun challenge :)
Re: Draggable objects
#68Thank you everyone! What a surprise to be on HN today. Happy to answer questions!
Are there shortcomings with the built-in feature compared to your code?
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement...
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement...
https://developer.mozilla.org/en-US/docs/Web/HTML/Global_att...
Re: Draggable objects
#69The page reminded me of Ken Perlins' page: https://cs.nyu.edu/~perlin/ Yes, the Perlin noise guy among many other things.
Re: Draggable objects
#70Thank you everyone! What a surprise to be on HN today. Happy to answer questions!
Big fan of your writing, btw!