I also have a weird desire to make Simon, which is not really a standalone game by any means, but could be put in the same "game" as this and maybe some other stuff. I don't know where that chain of thoughts will go. Warioware?
You know that'd be pretty cool to have a game filled with mini games, you'd even be able to use all the other small games you've made for it.
For some reason the first thing I thought of was Space Quest III and the arcade game you could play in it. Astro Chicken was its name, I think.
We'll see if my work-computer turns into a Wario-Ware thing. I love a good old fashioned "game in a game". Hell, I think that's why I played the Yakuza series at all.
So, uhhh....
Dwarf Fortress Fan-game RTS?
After using AI to generate that image of dwarves fighting a cyclops, and coming off a recent discussion with a friend on the dwindling RTS supply, I think this is the project for me:
A dwarf-fortress themed RTS. The mechanics and what's special? Right now, genuinely nothing, because I gotta learn the new engine, baby and also have never made an RTS.
Let's get started with the basics:
![](https://imgpile.com/images/hcY6Cx.png)
We'll need 3 types of objects: A command center, a worker and a resource node. I played Starcraft a lot as a kid (it was the only game I had for quite some time), so a lot of my references and influence will come from there, despite the game being more similar to Warcraft, I expect.
So, the command center serves the following functions:
a place to generate new units
the place where units drop off collected supplies.
The workers:
collect resources from a resource node
carry it back to the command center
continue to work without direction
While resource nodes:
stand there and look pretty.
So, let's get to coding.
Quite simply, the resource node does nothing but keep track of how many resources it has, here-on referred to as 'metals'
![](https://imgpile.com/images/hcYveL.png)
In the editor, the metals node is a simple object. A sprite with a collision box and an area around it with its own collision box. I also add it to the group "resource".
Groups are not a new feature, but are something I only really just started using. They're similar to "classes" in computer science terms, but in practice are just a way to identify and group nodes. If you have a bunch of objects all over a mario-like game, for example, you can have a group of "hazards" and a group of "platforms" and have the player always walk on top of platforms and die if they touch a hazard. It's pretty straight forward.
The command center itself has no code, really - I didn't even make it a separate scene, and just baked it into the "world" scene. It is very similar in structure to the resource spot. It has one extra element called a Marker2D, which is just the new name for Position2D - a position on the map where I can spawn new units from.
The workers are called Migrants right now, and are pretty straight forward State-machines.
![](https://imgpile.com/images/hcYQMP.png)
They can Idle, where they just stand there, they can move - which allows them to walk in a straight line toward their target, and they can collect which would be them mining for metals or dropping off at the command center.
You'll notice this new guy "await" - it's the new version of yield in Godot 4, and seems pretty smooth. Here it's just waiting 1 second.
All the direction information happens when the pawn gets close to a building. It's all here:
![](https://imgpile.com/images/hcYgA1.png)
I check what group the nearest object is in, which should always be whatever the pawn runs into while walking, but could become an issue if there are buildings in the way.
Cargo is dropped off if it's a command center, and you head back to the resource. If it's a resource, cargo is collected and the value of the resource spot is dropped - then they target the command center.
I use a placeholder called "last_target" so they can remember where they last collected resources and use home as a permanent storage place for the command center. After dropping things off, they head back to where they came from, to collect more. If the resource is depleted when they get there - they just idle.
With all that done, basically all that is necessary is player input, and that's where things got tough. This all changed quite a bit from last version, and I also heavily relied on Tilemaps for my last few games, which are also completely different.
![](https://imgpile.com/images/hcYE8j.png)
You can see I was getting pretty desperate by the time I figured it out...
So here's what's happening... When you click on the map, we need to figure out what you clicked on.
We check to see if it's the command center by grabbing the command center sprite and getting the rectangle that it fills. get_rect() returns something that looks like this: P: Vector2(-16,-16), S:Vector2(256,256) P is for position, and is a local variable - so since the sprite is anchored to the parent at the top-left corner, P = 0,0. S is for size, if the sprite is 256x256, then you'd get what I have in the example there. Here's the issue - Rect Objects can change to a different format: Rect(x,y,height,width) which is the same, but the values are separated. Different operations in the code can convert the rectangles to either format depending on the operation - which, my brother in Christ, is something I did not know and spent about 40 minutes confounded by.
So, here's my easy solution: reset the P to the global_position of the sprite's top-left corner. There's a couple issues, though. That size value is unmodified. Inside the editor, you can scale up or down these sprites, but the Rect that is returned by get_rect does not take that into account, and modifying the Rectangle changes it to the second format, which makes assigning it to the correct global position just a bit more inconvenient. It's a pain in the ass and I don't want to deal with it at all - and I shouldn't because There's Got To Be A Better Way!
I'll figure one out, but this is functional and enough work for today. But wait! - if this is such a pain in the ass, how will you handle selecting units?
Heh, here's the trick kid...
I won't.
![](https://imgpile.com/images/hcYFIW.png)
We add a button to spawn new migrants if you have 200 resources.
![](https://imgpile.com/images/hcYWBN.png)
Press the button and get a new migrant - they're already fed the information they need: home is where the heart is, and go find a random resource node.
![](https://imgpile.com/images/hcY0cc.png)
Heh. It's too easy.
Also it looks like shit.
![](https://imgpile.com/images/hcYp6o.png)
-=-=-=-=-=-=-=-=-=-=-=-=-
ENJOY!Click is the only control.
There's a Zultan Approved Windows 32-bit version too.
FAKEEDIT: After uploading I remembered that Godot 4's HTML exports are still fucked, so instead, there's also a linux export there, if you want to play.