I've released my online multiplayer mod for Nuclear Throne just a bit over two weeks ago. That was interesting. I had since received a plenty of feedback, bug reports, and feature requests. Today I've released what can be considered a major public update, and this is a small average-sized post about interesting things in it.
Author Archives: Vadym
Introducing: Nuclear Throne Together
Perhaps you've already heard that I've been recently developing a mod for the current version of Nuclear Throne. And not "just" a mod, but quite an impressing one:
-
Adds Steam-based online multiplayer support to the game.
That means invitations, public game list, and no port forwarding. -
Replays
Easily record and review your runs to learn from mistakes.
Or even attempt to correct them by dropping into the game at any point of a replay. -
Better coop
Nuclear Throne never was a coop-centric game, and thus coop mode didn't receive enough attention, remaining ridden with various small bugs. This mod changes that, fixing pretty much every known issue, and giving coop some much-needed polish. -
Bugfixes
While fixing coop-related bugs is an obvious choice given the scope of the mod, I didn't stick to just that, and also fixed a handful of other issues with the game. Bugged "crown vaults"? Fixed. Game hanging in certain areas? Fixed. Occasional crashes during an intro to an important boss fight? Also fixed. The full list is long (200+ items) and available in the "readme" document.
So it works, it's nice, and you can download it right now.
Or continue reading on process and potential questions.
Continue readingHaxe: C-style enum macros
I've recently stumbled upon this little macro by Justo Delgado. It takes an "enum abstract" and sets the values of it's constant-fields incrementally. This brings up an interesting point.
See, in C, you can leave out the values and have them assigned automatically (0, 1, 2, ...), set the values manually, or mix the two, having the values continue "upwards" from the last specified value. So, for example, if I have this,
enum class Op { Add = 0x90, Sub, Mul = 0xA0, Div, Mod, };
Op::Div will be equal to 0xA1, which is convenient, and allows grouping enum constants together (in this case storing operator priority in the upper 4 bits).
Haxe doesn't have that "out of box", unfortunately - either you make an actual enum and have the values assigned automatically, or make an @:enum abstract and assign the values manually.
But, of course, that can be fixed with a macro.
Continue readingHaxe: Shorthand expression matching
This is a small post about a small, useful macro for Haxe.
As you may (or may not) know, Haxe has fancy enums (which are actually algebraic data types). That's nice. And you can do all sorts of fancy value matching on them, which is also nice.
What is less nice, however, is that the only conventional way to extract enum arguments is to "match" it, and thus in some situations you can only do code like this,
var r = switch (expr) { case one(k): k; default: -1; };
adding a couple lines of code in place of what feels like it could have been a single operator.
So I wrote a tiny macro which adds just that:
var r = ematch(expr, some(k), k, -1);Continue reading
GameMaker: Using external version control
Over time, I have witnessed a particular scenario a few too many times:
- A person demonstrates complete unwillingness to learn how to use version control, be that due to "lack of need" or delightful claims of their existing approaches (which most often turn out to be manual backups) being sufficient or even superior.
- A person loses days, weeks, or even months of work due to human error and/or hardware failure(s).
- Noticeably bitter about the situation, a person attempts to continue defending their position.
Having spent far too much time arguing with people and explaining how to use version control, I have decided to make a blog post that would cover a few things on the matter:
- Explain the advantages of version control over "simpler" backups.
- Explain (step-by-step) the basics of using a common combination for version control being BitBucket (service) + Git (software) + SourceTree (GUI client).
While this tutorial is oriented on GameMaker: Studio users, it can also be easily applied for other tools.
Continue readingRectangle-circle intersection test
This is a blog post about handling circle-rectangle collisions. For some reason, these seem to be generally regarded as something complicated, even though they aren't.
Continue readingUnderstanding isometric grids
A GIF of the interactive demo seen later in this post.
Questions about the algorithms related to isometric grids are not uncommon. In fact, they are a little more common than you could expect them to be, given the relative simplicity of things.
So I have decided to write a little blog post on the two things important here:
- Converting local isometric grid' coordinates to global screen-space coordinates
- Converting global/screen-space coordinates to isometric grid' local coordinates
Changing scroll speed in Firefox using CSS
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam fringilla, turpis eget vestibulum vulputate, enim orci tempor enim, vel consectetur ipsum orci sit amet enim. Aliquam nec viverra justo. Pellentesque viverra cursus quam eget maximus. Nullam iaculis mauris leo, et pharetra nisi ultricies in. Mauris varius hendrerit nulla, quis aliquet sapien. Pellentesque eu ultrices nibh. Nunc mollis porta tincidunt. Praesent risus nibh, vestibulum eu gravida et, dignissim eu velit. Mauris quis iaculis mauris.
Nulla facilisi. Suspendisse malesuada tortor sed augue tempor sodales vitae vitae felis. Suspendisse urna nunc, luctus sit amet libero et, vestibulum pellentesque sem. Vivamus mollis felis id nisi ultricies, vitae lacinia est egestas. Pellentesque quis quam non dolor ultricies pulvinar. Nunc sodales diam tristique pharetra vehicula. Fusce consequat eu turpis vitae consequat. Ut aliquet sem felis, vel venenatis mi commodo a. Donec volutpat egestas enim, at vestibulum ligula vestibulum eget. Nunc facilisis ex felis, et fermentum arcu pellentesque sed. In molestie eros nec metus molestie iaculis. Cras eu sem consectetur ex consequat blandit at auctor lacus. In finibus dolor vitae leo dignissim, non egestas dolor consectetur. Vestibulum sit amet sem sit amet nulla dignissim rhoncus sed nec est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam fringilla, turpis eget vestibulum vulputate, enim orci tempor enim, vel consectetur ipsum orci sit amet enim. Aliquam nec viverra justo. Pellentesque viverra cursus quam eget maximus. Nullam iaculis mauris leo, et pharetra nisi ultricies in. Mauris varius hendrerit nulla, quis aliquet sapien. Pellentesque eu ultrices nibh. Nunc mollis porta tincidunt. Praesent risus nibh, vestibulum eu gravida et, dignissim eu velit. Mauris quis iaculis mauris.
Nulla facilisi. Suspendisse malesuada tortor sed augue tempor sodales vitae vitae felis. Suspendisse urna nunc, luctus sit amet libero et, vestibulum pellentesque sem. Vivamus mollis felis id nisi ultricies, vitae lacinia est egestas. Pellentesque quis quam non dolor ultricies pulvinar. Nunc sodales diam tristique pharetra vehicula. Fusce consequat eu turpis vitae consequat. Ut aliquet sem felis, vel venenatis mi commodo a. Donec volutpat egestas enim, at vestibulum ligula vestibulum eget. Nunc facilisis ex felis, et fermentum arcu pellentesque sed. In molestie eros nec metus molestie iaculis. Cras eu sem consectetur ex consequat blandit at auctor lacus. In finibus dolor vitae leo dignissim, non egestas dolor consectetur. Vestibulum sit amet sem sit amet nulla dignissim rhoncus sed nec est. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.
(live demo - compare scrolling speeds in Firefox)
For quite a while now, a thing that bugged me in Firefox was the inconsistent scrolling speeds across the pages. On some it would seem just fine, while on others you could have a list that scrolls at a ridiculously slow pace. My searches on the subject were inconclusive - while, of course, you can regulate the scroll speed via scripting, that definitely wasn't the case on all these pages.
The culprit, as it turns out, was pretty simple - while most of the browsers scroll the elements for an amount of (screen) pixels per key press or mouse wheel change, Firefox scrolls the elements based on the their font size. Which, on one hand, makes sense, but there's a catch - it's based only on the scrolling element's font size. Content' font sizes are ignored.
So that is why you get odd scrolling speeds - people most often set up styles for the actual content (paragraphs\labels\etc.) and not the scroller\container element.
Luckily, this also means that scrolling speeds can be adjusted easily - you change the container font-size to (100*X)%, and then add a rule to change it's child element sizes to (100/X)%:
Continue readingC#: Get current keyboard layout\input language
On some occasions, you may want to get a "global" input language - that is, the keyboard layout used by the current foreground window\application\whatever. Basically, simulating the behaviour of the language panel on Windows.
The common use cases are on-screen keyboards, fullscreen applications, and widgets.
While I wasn't able to find a premade function that get this particular thing during my searches, it turned out not to be too hard to assemble:
Continue readingTop-down bouncing loot effects
In action
A little while ago, I was asked about what would be a good approach to creating an effect for a top-down game where coins would fly out of a smashed object. Not recalling any tutorials on the matter, I've made an example of this exact thing, and this is a post detailing everything related to such an effect.
Continue reading