Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 ... 636 637 [638] 639 640 ... 796

Author Topic: if self.isCoder(): post() #Programming Thread  (Read 909462 times)

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9555 on: May 20, 2016, 01:44:58 am »

Quote
But even so, using CLOS to emulate algebraic data types is like stapling a few pages together with 10 inch galvanized nails with a sledgehammer. And what benefit do we get? We’d need to do some wizardry to get pattern matching and other benefits. (CL-MONAD is a library which takes this approach, and also defines pattern matching macros, and monads. (Though, monads are really only useful when you have tail recursion, compile-time types, etc., but that’s a story for another post.))
Emphasis by me. A lot of the theory behind functional programming seems completely useless in Lisp.
Fair enough. I guess I'll have to start recommending people grab Haskell instead of Lisp now. :P
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.

Antsan

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9556 on: May 20, 2016, 01:59:10 am »

Point them to Lisp for meta-programming, to Haskell for functional programming and to Poslin for more meta-programming. :P

Damn, I haven't done anything with Poslin for a long time now.
Logged
Taste my Paci-Fist

Mephisto

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9557 on: May 20, 2016, 07:54:03 am »

Meh. Whatever.
« Last Edit: May 22, 2016, 09:55:46 am by Mephisto »
Logged

miauw62

  • Bay Watcher
  • Every time you get ahead / it's just another hit
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9558 on: May 20, 2016, 09:11:46 am »

To be fair, there are reasons not to take the "shortest path" in those situations. Spending as little time as possible in the middle of the road, and ticks, for example.
There's other, similar, cases where taking the "almost shortest" path even on similarly weighted terrain is more common for humans. An example is that many times humans prioritize the shortest immediate path over the shortest overall path; i.e. they enjoy a sense of progress. For example (black is start point, red is goal point):
Spoiler (click to show/hide)
Path 2 is actually the shorter path here by a little bit. However if exposed to this scenario a large number of people, even those more familiar with the area, are more likely to take path 1 instead of path 2. This is because the start of path 1 provides a fairly large amount of immediate progress towards your goal, while on the other hand taking path two actually requires you to move farther away from your goal in the short term in order to be able to perform better over the longer path. There's a reason why the marshmallow test (you can have this marshmallow now, or if you wait 10 minutes I'll give you another marshmallow and you can have two) is hard; humans tend to prioritize immediate progress towards a goal over a setback now for overall improved gains later. And when combined with the fact that once a person has traveled a (potentially not shortest) path once (caching) they are more likely to take that route again even if a slightly faster route still exists, it can result in even those people who regularly travel the area taking suboptimal paths.

Of course, it doesn't really matter which path is the real shortest for most intents and purposes, because both paths are within ~5% of the same length and both would easily suffice for most pathfinding purposes. So if we already know that being "almost good enough" will work, we can get some massive reductions in the amount of space we need to check. Here's two examples from the A* wikipedia page that let you visually see the difference in the cells checked (and thus time taken) between searching for the "shortest" path vs. searching for a "short" path.
Spoiler (click to show/hide)
The disadvantage of this in a game is that it makes your pathfinding less predictable to players, though. To take those last two examples as, well, examples, people would probably remark on the little "bump" in the path, especially if this is a very common route.

I don't necessarily disagree with you, but it's still weighing the advantages and the disadvantages. My complaint can, for example, be solved by letting people assign weights to tiles.
Logged

Quote from: NW_Kohaku
they wouldn't be able to tell the difference between the raving confessions of a mass murdering cannibal from a recipe to bake a pie.
Knowing Belgium, everyone will vote for themselves out of mistrust for anyone else, and some kind of weird direct democracy coalition will need to be formed from 11 million or so individuals.

i2amroy

  • Bay Watcher
  • Cats, ruling the world one dwarf at a time
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9559 on: May 20, 2016, 04:14:22 pm »

The disadvantage of this in a game is that it makes your pathfinding less predictable to players, though. To take those last two examples as, well, examples, people would probably remark on the little "bump" in the path, especially if this is a very common route.

I don't necessarily disagree with you, but it's still weighing the advantages and the disadvantages. My complaint can, for example, be solved by letting people assign weights to tiles.
The good part about heuristics is that you can adjust the strictness as needed by picking different ones! That particular one was 5 ε IIRC, so if it was slightly too lose for you then you could choose a slomewhat stricter heuristic that, at the cost of additional node checking, would return a path slightly closer to the actual route and smooth that bump right out if you really needed it gone. So in the end you have a heuristic that only checks half as many tiles instead of 1/3rd; it means a fortress that can have twice as many dwarves running before FPS death sets in than with a purely admissible heuristic like manhattan distance.

And there's nothing that says you can't choose a heuristic capable of handling "base weights" that could be preset or player-designated as well; heck, the idea of "Weighting" itself is exactly what heuristics do, they weight certain tiles varying amounts based on their distance from the goal or some other predefined function. Adding an additional input of player weights to let them actually control pathfinding a bit more directly is a pittance to factor in in the vast majority of cases.

A good heuristic can provide massive speedups at the cost of nothing but a little bit of development time and a tiny bit of path regulation (which you can tweak to yourself to reach a point where most people aren't going to be able to tell the difference, and if really necessary you could always add a "player weighting" or "waypoint" system to let players assume direct control of pathfinding if they really depend on it). Sure, it's not that big of a deal if you're running your little test dungeon with 8 units in it. But once you expand that unit count out to 100, or 1000, or 10k (which could be reached in C:DDA with Z-levels on, for example) it starts to matter a bit. Or how about going from 2D to 3D with flying units? That takes your amount needed to check up from n2 to n3, and speed will definitely start to matter at that point. So ask yourself the question, which would make the player more excited, having pathfinding that is always the fastest (even when it leads to results that seem counter-intuitive to humans, as mentioned earlier), or having the unit cap be double what it currently is?

(Of course, if you're deadline is tight and you know that you are never really going to be handling more than a few units then by all means feel free to avoid anything more complex than manhattan distance, but pathfinding quickly becomes such a speed critical segment of many programs, and the work/reward ratio is so great for good heuristics, that it's almost always worth it to spend even a little bit of time picking and implementing one.)
Logged
Quote from: PTTG
It would be brutally difficult and probably won't work. In other words, it's absolutely dwarven!
Cataclysm: Dark Days Ahead - A fun zombie survival rougelike that I'm dev-ing for.

highmax28

  • Bay Watcher
  • I think this is what they call a tantrum spiral...
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9560 on: May 20, 2016, 10:41:27 pm »

My teacher kinda bailed out on giving me some sites I can use to learn Java, so instead I'm going to ask here.

Where can I learn Java that goes more into detail about it than Code Academy?
Logged
just shot him with a balistic arrow, i think he will get stuned from that >.>

"Guardian" and Sigfriend Of Necrothreat
Jee wilikers, I think Highmax is near invulnerable, must have been dunked in the river styx like achilles was.
Just make sure he wears a boot.

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9561 on: May 21, 2016, 06:40:37 am »

toying with  the idea of encoding heavy game logic in fragment shaders. witness galaxy colonization fluidly happening on a 2048x2048 map directly in your browser

http://lorenzoboccaccia.github.io/ASpaceOpera/
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9562 on: May 21, 2016, 07:26:20 am »

I don't know if it's my internet or chrome, but it doesn't seem to be working for me.
Logged

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9563 on: May 21, 2016, 07:31:23 am »

map is 8 mb, can't use jpeg or artifact will leak into colony distribution :P

I'll have to switch to a lower resolution + detail texture, but I kinda liked the idea of using the official thing
Logged

Rose

  • Bay Watcher
  • Resident Elf
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9564 on: May 21, 2016, 07:43:01 am »

blue is OP, pls nerf
Logged

LoSboccacc

  • Bay Watcher
  • Σὺν Ἀθηνᾷ καὶ χεῖρα κίνει
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9565 on: May 21, 2016, 07:50:55 am »

tru! it comes out from having sector mass as only value, driving both colonization desirability and development speed, so you get explosive growth at the galaxy center, while earth (yellow), being between two arms, has it's growth stunted
Logged

TheBiggerFish

  • Bay Watcher
  • Somewhere around here.
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9566 on: May 21, 2016, 09:15:06 am »

My teacher kinda bailed out on giving me some sites I can use to learn Java, so instead I'm going to ask here.

Where can I learn Java that goes more into detail about it than Code Academy?
Well, you can always read the javadoc, but that's not going to be very helpful if you're looking for new concepts.
Logged
Sigtext

It has been determined that Trump is an average unladen swallow travelling northbound at his maximum sustainable speed of -3 Obama-cubits per second in the middle of a class 3 hurricane.

Shadowlord

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9567 on: May 21, 2016, 09:19:45 am »

I think I learned it mostly from a book. ~17 years ago. Of course, I don't remember the name of the book and it would be very, very, very out of date anyways.
Logged
<Dakkan> There are human laws, and then there are laws of physics. I don't bike in the city because of the second.
Dwarf Fortress Map Archive

alway

  • Bay Watcher
  • 🏳️‍⚧️
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9568 on: May 21, 2016, 10:37:25 am »

My teacher kinda bailed out on giving me some sites I can use to learn Java, so instead I'm going to ask here.

Where can I learn Java that goes more into detail about it than Code Academy?
Google it. And I'm not even being flippant with this reply.

The web was built by programmers and programmer-kin, so search engines are pretty much better at finding programming information than anything else. Learning to effectively use them to dig up docs, tutorials etc, and ingraining the idea that you can do so is a big part of becoming effective at programming.
Logged

Shadowlord

  • Bay Watcher
    • View Profile
Re: if self.isCoder(): post() #Programming Thread
« Reply #9569 on: May 21, 2016, 10:47:31 am »

Ha ha, unless you're trying to look up anything about Haskell.
Logged
<Dakkan> There are human laws, and then there are laws of physics. I don't bike in the city because of the second.
Dwarf Fortress Map Archive
Pages: 1 ... 636 637 [638] 639 640 ... 796