Crop and ClawDev

Dev Log 4 – Crop and Claw

Classic Warping

The prior implementation of warps in Crop and Claw was something closer to RPG Maker. In short, RPG Maker warps, when the player triggers them, will warp the player to a target map (if any), target coordinates, and direction the player should face upon loading. This seems fine, but is actually very obnoxious. You have no visual indication of where the player will appear in the destination map. You have to manually check the coordinates of your target, then set it in the origin warp’s parameters. Even though RPG Maker will have previews to select, this still has issues. The destination has no visual indicator which means if the destination map changes, the warp needs to be updated. If you can’t see the warp, it is easy to forget about, and your player ends up spawning in a wall or in the ocean until you fix it.

Instead, warps were reworked to use two base attributes: target map and destination id. This is closer to how a number of old RPGs worked. Destinations are specialized field entities which can be seen in editor and freely placed. When the map changes, an outdated warp is immediately noticeable and can easily be fixed.

Fun Fact: This old warp id system is actually why Generation 1 Pokemon games has the Glitch City error. Each map in the game has a set amount of warp destinations. A key difference between our method and old RPGs is that these games used a stack to push and pop maps, so exiting a building “popped” you up to the “previous” map. Fuchsia City is a big place with a lot of warps, and consequentially needs a lot of destinations. The Safari Zone uses Destination 4. So leaving the gatehouse pops you back to the previous map in the stack (overworld, Fuchsia City) and places you at the coordinates set for Destination 4 (right outside the Safari Zone building). When performing the Safari Zone glitch, your previous map in this case is not Fuchsia City. If you perform this glitch in another city with a lot of destinations, you will walk out of another building or exit in that route as normal. If the Destination count is too low, the offset will point to a different value in map data and place you often very far out of bounds, outside of the map’s buffer. Understanding what Glitch City is beyond the basics is fun and I’d suggest ZZAZZ’s video (among all the other videos he has) explaining it in depth:

Custom Entity Rendering

Godot has useful composition of objects. You can throw a sprite renderer with animated sprite objects down and set them up nice and visually. The sprite node can be a separate child from the root node, and lets you keep things separate and organized.

Anyways, all that stuff was thrown out.

Just like menus, it was too good for what we’re doing, and made adding new NPC sprite sheets too tedious. Every NPC uses an atlas of 3×4 sprites 16×16 pixels each. Every NPC needed its own internal animated sprite dataset, which involved a lot of duplicated assets with just image references changed. This could be programmatically created, which would dynamically create SpriteFrames assets when an NPC is loaded, but it simply wasn’t necessary for what we’re doing. Additionally, there were some use cases like warps. Before, each warp needed a unique icon to visually show on the map, so we’d need a limited number of warps. This was especially an issue because we use inherited scenes heavily for templates, which either cannot have their children edited, or they can be partially overridden but flood the scene inspector.

I eventually found Godot nodes support custom drawing with the _draw() function. Overriding this allowed me to dynamically draw assets both in engine and in game. I started this with drawing warps dynamically, allowing us to clearly visualize what warp leads to what destination, instead of having to click and manually inspect each. It is simply a 16×16 rectangles with labels drawn on top.

This feature was further expanded on with NPCs, as NPCs now face the direction they’re set to in editor, and instead of manually setting child nodes (and thus cluttering the inspector) we only need to assign one sprite atlas on the root NPC entity for this to automatically apply.

House Interior

Some NES era RPGs had hidden parts of the map that only reveal when entering a given tile. Warps were given the ability to simulate this. Warps with no destination map set will use the current map and call a different routine. If a warp is flagged to be interior, the engine adjusts the map’s mode to account for it, such as changing the render clear color and implying the tileset in VRAM is being swapped. The effect seems realistic to implement on an original NES, implies it works around NPC limitation in RAM, and the use of space showing all buildings implies a consistent world with hints of interesting things in nearby buildings.

Under Lock and Key

Locked entities using a generic key leads to some interesting “remember me” possibilities. The basic locked door or chest uses a generic consumable key item, similar to the first Dragon Quest or Zelda. These locked entities are also able to require a specific item instead, allowing for unique doors and chests to control player progress. Thanks to the custom editor entity drawing as described earlier, we can see the lock types and flags at a glance without having to select them, and draw specific sprites without having to clutter the editor with folded out children nodes.

If you missed it, you can read the general design philosophy we’re experimenting with on this article, which includes notes about keys and inventory limits:

And More…

A surprisingly large number of components got done this week, some of which I wasn’t even intending to put in. These were just some of the more interesting highlights. I’ve also begun setting up a public forum for the company, in part so there’s a communal space for our projects. Personally, I don’t like using stuff like Discord or Reddit and prefer keeping to our own forums and email listings. Plus, the requirements of registration filters out bots and low effort posts in the modern age. Though it also means it’ll have a small community size. This isn’t really ready to go, and probably not too important until Crop and Claw releases.

Hi, I’m pyral

Pyral hates videogames and doing things.

Leave a Reply

Your email address will not be published. Required fields are marked *