Thanks, I think Iām going to learn something new today. Do you actually recommend using these coroutines in Java? If so, Iād like to know under what conditions their use is going to benefit me.
Lazily building and iterating complex and possibly infinite data structures, like a tree, which usually functional programming languages are good for. :point:
Worked on a simple sci-fi name generator (in other words: string concatenator). It generates different styles of names for members of different galactic races, e.g.:
[quote]Hyalite the Cubic
Hydroxylapatite the Opaque
Rock the Minor
Magnesiostaurolite the Powdered
Arsenic the Quartz
Nevada the Soft
Sulphur the Opaque
Jasper the Fracturous
Prase the Blue
Spinel the Apatite
[/quote]
and so on, for 7 different races.
Continued crawling towards the goal of getting a hunter to stick an arrow in a deer. To make things fair, I upgraded deer today with PanicBehavior, so they will run off in semi-random direction if they spy a human, bear or wolf approaching. Also, I let deer run a bit faster.
PanicBehavior is a standard behavior of all creatures actually. Aside from panicking at the sight of specific types of creatures, it will also have to monitor health and have a panic response when the creature takes a serious injury.
So far the galaxy is very sparse and boring, but I intend to do something like Dwarf Fortress (only a bit less ambitious) in generating a galactic history in which a game will take place.
I actually gave this a shot one week ago, and found that it often behaved bizarrely when used with multiple threads (i.e. suspending in one thread and resuming in another). I havenāt found the time to investigate the cause, but offbynullās library was a well-behaved replacement, aside from a bug in the instrumentation task. Canāt vouch for the quality of the generated bytecode without spending more time with the library, though.
Ditto the alternative I posted. IIRC with matthiasmās library, I encountered nonsensical changes in state even when I demonstrably had no attempts at concurrent access to the same continuation. Do you have a lot of familiarity with the continuations library? I might want to revisit the code and shoot you a PM if Iām still scratching my head after.
Began upgrading my engineās map format to allow for some more features like dynamic loading and unloading of chunks on the fly - it was possible before, but my original implementation had a file for every individual chunk so folders would get very cluttered with potentially thousands of files⦠that and I wasnāt storing tiles that were solid.
The solution is to store regions of many chunks in one file. Just got to figure out whatās best in terms of memory usage and minimizing IO.
Itās a funny feeling being able to call certain parts of my engine ālegacyā.
Just because a piece of code is not concurrently accessed, does not mean you donāt have to take measures to ensure the code is thread safe. Youāll see that with proper locking/fencing (ensuring happens-before behavior) all these ānonsensicalā changes in state disappear.
Give me some credit. Itās not like I just slapped a synchronized block on there without thinking about it. I slapped a phaser on there without thinking about it.
The nature of the aforementioned nonsense appears to have been that the number of unarrived parties was sometimes incorrect: 0 instead of 16 (the number of registered parties). In other words, there was a bit of code that relied on the assumption that the phaser had already advanced to the next phase, when in fact the phaser would sometimes be found in the process of transitioning instead. All this seemingly because I failed to take note that the documentation for onAdvance() says āupon impending phase advanceā and not āafter phase advance,ā which evidently becomes a pretty important distinction once you start using the phaserās non-blocking methods. Really shouldāve waited until I was back at my computer before running my mouth.
tl;dr: Matthiasās library works like a dream, and 3 AM is not the correct time to be dicking around with concurrency, which is a lesson that no sensible person needs, but one that I repeatedly fail to learn. Carry on. :clue:
I use MatthiasMās continuation-library in a many threads applications all the time. It works fine. As expected. In fact my only question is, does the code weaving need updating with new versions of the JVM? Same with Rivenās Structs for java?
As to what i did today. My internet and local network(wifi) has been just too flaky. I finally went all wired network yesterday with a gigabit 8 port switch and a Power line network from upstairs. It is working perfectly despite the fact that i have the power line network stuff plugged into power strips at both ends. Apparently a big no no. But i get my full 20Mbit internet download speed no probs. Was struggling to get 1.5Mbit before so i assume i was getting a lot of interference.
As for code⦠i am seeing greener grass on the Scala side of the fence
Today I āenjoyedā programming a protocol for RS485. It seems that getting Windows to talk to RS485 should be the simplest thing in the world - how hard could it possibly be? - but nothing at all works as expected. The APIs are the usual rubbish as well (buggy, poorly documented, not even nicely formatted source code) because Oracle in their wisdom dropped the javax.comm APIs a long time ago and never picked them up again. It just makes my blood boil.