bastecklein's Recent Posts

My Colony 2 v0.23.0 introduced the new Flag/Scripting system. This is being implemented primarily to support the in-game tutorial dialogs, but also contains features which will allow it to go well beyond this. This thread gives a basic overview of the system and how mod creators can use it in their own project.

As you might have guessed, the system is comprised of two base components, Flags and Scripts, with each script containing a collection of Actions that the engine can perform. When the player does something to trigger a flag, the engine will look through all of its scripts to determine if one or more of them are triggered by the flag. If it finds any available scripts, it will then run through their actions in sequential order.

Player and Global Flags

There are two types of flags, Player and Global. Player flags apply only to the player who activated them, so that any script they trigger will only impact them. This also means that the flag can be triggered by each player. Global flags apply to the entire game world and can only be triggered once, so that the first player who triggers a global flag will activate it for all. A player flag can only be triggered once per player, and a global flag can only be triggered once per world. The exception to these is if a Clear Flag action is triggered in a script.

A sample use case for a player flag is an in-game tutorial message. Suppose the player builds a refinery and you want to show a message about the refinery once it's built. You wouldn't want that message to show up to everybody, so a player flag here would be appropriate.

A sample use case for a global flag could be a scenario where the first player who builds a specific building gets to unlock a free tech, but only the first person to do so gets it.

Setting Flags

There are currently four main ways to set game flags, although more may be added in the future.

Flags can be set when a player joins the world. There are two places you can set these flags. First is in the World object in the game editor. Any flag specified here will automatically play when the player joins, no matter what their civilization is. You can also set this flag in the Civilization object. Here the flags will be triggered when the player joins the world, if they are using the specified civilization.

Next flags an be set when a new unit is created, and these flags are specified in the Unit object in the game editor. These will also be triggered with any free units the player starts out with at the beginning of the game, so they can also double as a "player joins world" flag.

Moving on, flags can be set when a new structure is built. As you might have guessed, these can be set in the Structure object in the game editor.

Finally, flags can also be set within script actions themselves. Allowing you to chain scripts by having one script call another through flag setting.

Creating Scripts

The scripts section in the game editor is where you create your different scripts and specify their actions. Scripts are made up of three parts, a Reference Name (which is just used to identify the script in the game editor so you don't get them confused), a Trigger Flag (which is the flag used to start the script) and an Actions List.

The Actions List is where all of the... action is. A script can contain how every many actions you deem necessary, and the script will play each action in order, one after the other. There are a handful of action types to choose from, ranging from playing messages to setting/clearing flags to giving things to players, and so on. All of the actions are fairly self explanatory in the game editor.

The Future

I think that the Flags and Scripting feature has a lot of potential for the future of MC2 and its related mods, and I am open to suggestions on how to improve this system going forward. More trigger events and more action types are absolutely on the table, so if you are developing a mod using this system, please let me know here on the forums what you would like to see added.

I was thinking that it might be helpful, along with Flags and Scripts, to also add Variables to the mix, both player and global. So a script could set a name or number to a variable and call on that later on. There could then perhaps be conditional actions, based on those variables. That is just one thought, really the possibilities are endless!

So there it is, that is what is in the scripting system so far. Let me know what you think, what questions you have, and what improvements can be made. This system will only get better and more advanced as time goes on!
1h ago
Thank you for the feedback @Luker124 , I will address your suggestions here!

Luker124 said:When creating a structure, rovers will automatically prioritize building the structure over collecting resources.
Yes, I agree to this. I think it does this in some way in MC1 (don't remember for sure).

Luker124 said:Path finding for rovers will prioritize taking pavement over no pavement to their destination.
Also yes. That is how it is supposed to work anyway, I have just not gotten to it yet :-/

Luker124 said:Optional flashing effects for rovers on their voxels(Could be used to signal authority, or to move colonists out of the way in the future) OPTIONAL
Do you mean like a blinking light? That shouldn't be too difficult. Shouldn't...

Luker124 said:A realistic animation for the lander pad, such as a small space ship landing then departing after colonists are offloaded. Changing the "generation" speed of the building would also be essential to this. This would also open the door for custom building animations!
This is basically planned as well. If you look at the data object in the editor for the Landing Pad for example, you will see it has the Lander set as the "Population Delivery Unit," and the Landing Field lists the Shuttlepod. So this too is in the works!

Luker124 said:Why is water a utility but food is not? I suggest either changing water back into a resource or making food a utility too, for organizational sake.
Here I do not agree with you. The reasoning behind this is that, in a real life city, water is a utility, but food is not. For instance, you don't have a food pipe connected to your house that delivers food on demand for a monthly rate (although come to think of it, that would be pretty sweet).

Luker124 said:Pavement places between two buildings sometimes doesn't build, and even when it does, it sometimes just vanishes into thin air. Would make an amazing party trick, but not a good game mechanic.
This is a bug I did not notice until after publishing this update, but pavements that are 1x1 tile cannot be built and do not show up on the map. I think I know why it is happening, but I will have to verify in the code during the next update.

Luker124 said:Individual selection for drop-off points for resource collecting rovers(Preferably some sort of selection on the map, maybe highlight possible places in green)
Not exactly sure what you mean by this :-/

Luker124 said:Voxels can be made into the -y axis, allowing for holes in the voxel models, and realistic depth.
Maybe. This sort of comes back to the terraforming requests, structures will need to be able to override the world seed while the engine is building the 3d geometry for the ground terrain. It's not insurmountable though, as roads already do this (you can see that pavements are slightly depressed into the terrain)

Luker124 said:Some sort of better construction animation, instead of the building emerging from the ground like the undead.
I thought it would be cool originally to have the buildings go up voxel-by-voxel or row-by-row while being built. In practice it ended up being incredibly RAM expensive as a new 3D model needs to be created by the engine for each step of the build phase. This is a similar problem to having animated buildings, each frame of the animation needs to be its own model, although on an animated building, you can get around that by having the building just being made of multiple models, and one rotates or moves independent of the others. Anyway, I probably will not change this any time soon, but it might come about eventually if I make some sort of performance breakthrough on the Scroll3D engine.

Anyway, that you for all of the suggestions and feedback!
2h ago
Hey @Luker124 there are not predefined trigger flags in the game engine at the moment, they all need to be defined in the data models. I will make a post about the flag/script system at some point today.
3h ago
Just in time for the weekend (if you are using the PWA at least), the My Colony 2 v0.23.0 update is now available, bringing a lot of goodies that I hope think you are going to love. So what's new in this release? Let's take a look!


To begin with, continuing work from the last two releases of My Colony 2, more structure voxel models have been separated from the data files, further reducing initial game load times, particularly on mobile devices. This should especially help on lower memory devices, as some were crashing from the sheer size of the overall MC2 data file during initial load.

Next up, as I mentioned in another thread, all My Colony 2 game statistics are now being automatically logged to the Coloniae service that @Sobeirannovaocc is maintaining. The My Colony 2 implementation of Coloniae is still in development, but you can find it at the following URL to track it's progression. Check it out, see if you can find your own world statistics, and be sure to give Sobe your feedback!

https://dev.coloniae.space/

In addition, all new colonies in MC2 are now being automatically added to the mc2global Universe, as outlined in this thread. This will be the default global universe for all new MC2 games, and if you want to join it with your existing colony, simply click on the thread I just posted for instructions.

Next up, commenters in the various app stores have long been requesting that MC2 contain some sort of hints or tutorials such as those found in the original My Colony. So I have started to add helpful dialogs to the game at various points.


More exciting than the tutorials though, are the manner in which they have been implemented. Some time ago, there was a request for some scripting capabilities to be added to MC2 that creators could use for different types of mods. I started implementing it by adding some flag properties to units, structures, worlds, and civs, but then forgot about it, until @Luker124 recently reminded me that they would be helpful for a mod he is planning. As a result, you will now see a new Scripting section in the Game Editor.


I will make a more detailed post on scripting at some point, but it basically works like this. Certain entities (units, structures mainly, but also civs and worlds) can set either a Player Flag or a Global Flag when they are built/come into the game. A Player Flag pertains to the player who triggered the event, and a Global Flag pertains to the entire server. When a flag is triggered, the engine looks through all of the available scripts, and then will run any script that is triggered by the trigger flag.

The engine remembers which players have used which flag, so they can only be triggered once, unless a script gives a "clear flag" command. You can see the currently available script actions in the screenshot above. A script may contain one or more actions, and can call subsequent scripts by setting flags itself.

I plan to use this new flag/script feature to implement something suggested by @GeneralWadaling some months ago, whereby you could discover interesting terrains which would then unlock things. My thinking is that you could discover alien artifacts/tech that would then unlock certain structures that were not available otherwise through the tech tree.

The possibilities are vast though, so it will be interesting to see what modders come up with. The scripting framework is still in its infancy, so try it out and let me know what additions or improvements you would like to see. I foresee eventually being able to make a wide variety of different types of mods with this feature, not even limited to colony builder games.

Next up we come to a new addition that everybody has been asking for since MC2 was first made public, and I am talking about the return of the Bulldozer!


There is now a new toolbar above the build options sidebar. Currently it only has a bulldozer, but that will probably be expanded at some point. As in MC1, the bulldozer mode will turn your interface red so that you do not forget you are in a destructive mode. Unlike MC1, bulldozing a structure will now actually sell it instead of just destroy, so that it is actually more like a quick-sell option than anything else.

Besides just structures, Roads can now finally be removed too, using the bulldozer. This has been one of the top requests for a long time, and now it is a reality. This actually required a pretty substantial rewrite to how roads work, which I outlined in another thread a few weeks ago. But the work is done and the feature is here now. In the coming updates, I plan on also allowing roads to be built pretty much anywhere, not just within the confines of your own settlement, allowing vast highways to be buily across your world!

Moving on, the engine will now enforce structures that have a Settlement Level requirement (currently, only a handful of structures do). You will see this when viewing structure costs on the sidebar. Settlements are leveled up using Civics, and you can level up your settlement by selecting it from the Statistics window.

Now on to new content, as three new Techs have been added in this update: Low Atmospheric Zoology, Advanced Security and Advanced Robotics! Along with the techs, we have two additional resources added to the mix, Cloth and Robots.

Of course, there are new structures here too. The Fish Hatchery is back from MC1, allowing you to breed fish for food. The Outhouse is here, which I think was something of a gag model that GeneralWadaling sent me, but I turned it into an early game sanitation (medical) facility that you can build early on, before you can afford an infirmary. Next we have the Synthetic Textile Lab for creating cloth, and the Robotics Factory for making robots. There is a decorative United Earth Flag that takes on the color of your settlement, and the Storage Yard is a new upgrade to the Raw Materials Depot, allowing you to store way more raw materials than you previously could. Finally, the new War Factory will allow you to build this updates' new military unit, the Main Battle Tank!


All in all, there is a lot here in this update, and I hope you guys like it! So check it out, as it should be hitting all platforms over the coming days, and if you don't want to wait, fire up the web app now at the following URL. Until then, thanks for playing, and have a good weekend!

https://www.apewebapps.com/my-colony-2/

#mycolony2
20h ago
Do you have an idea for a research requirement? New tech, or one of the current ones?
1d ago
Making progress, @Luker124


Done with the new flag + scripting tools I am implementing
1d ago
Where is your region saved?

Here is the issue, Regions are not a single file, but a collection or files, consisting of your main overall region, and then a file for each individual city. If CloudSync was disabled when the region was created, then all of the individual cities are only saved on the device they were started on. Which is probably why they will not open for you on the Web App.

To get them to sync, you need to have Cloud Sync on, and then open each individual region city on the device where they are saved.

The same goes for the backup. You can backup an entire region from the Load Colony window (the window does not show up on mobile, but does on a large screen device), but it only works if all of the region cities are available on the device you are trying to backup from.


Backup for Regions I am pretty sure is working on the PWA. I will check the Launcher, but I don't see why it would be different there. You select your region from the Load Colony window and click the blue Backup Colony button in the middle.

But again like I said, the entire problem is the fact that Regions are broken up into many files, and if they are not all located on the same device, then it's not going to work.

The entire Region system is something of a mess on MC1 for players who use multiple devices, which I realize, and was the reason why MC2 was designed in a completely different way. Regions were sort of shoehorned in long after the base game mechanics of MC1 were created. There is not exactly a "clean" way to fix it without a major overhaul or ruining a bunch of existing game saves.
2d ago
I started to add something similar and forgot about it, maybe I will go ahead and get the basic framework going for MC2 v0.23.0, which I am currently working on. @Luker124

Basically there was/is going to be a new section in the editor called either "Events" or "Scripts," which are triggered based on flags. You can already see where I started, where placing a unit or structure can set a global or player flag. And then when a flag is set, the engine is going to look through the scripts and see if one is triggered by the flag, and if so, it will perform some sort of action, which could be a dialog, sound effect, give you a unit, unlock a tech, or really anything.

The system was going to be used to create the in-game tutorial, but it could also be used in the way you are describing here.

I will try to get something implemented for the next update, at least a rudimentary start to the system.
2d ago
I figured "go big or go home" @GeneralWadaling
2d ago
It will be mostly oriented to colony building @Luker124 but it is also going to have full combat mechanics baked into the engine, in the event that a modder wanted to make a combat oriented mod, or if I want to use the engine for another game (such as a Colony Wars 2 or some other RTS title). As of now, the combat mechanics are very much in their early stages. You can declare war on another player and go attack their settlement.

I do plan on some point on adding a new world type, opposite of the abandoned world, it will be the inhabited world, where the locals are not very friendly. And you have to push your way in "conquistador" style.

Also with the "Universe" feature, I want to make it possible to load some troops onto a starship and send an attack force to another players planet, which unlike MC1, should be easily possible on MC2 given the built-in real-time multiplayer framework. It would have to be opt-in for the planet though, as I don't want somebody to just start getting attacked if they are just trying to play a casual game.
2d ago
It was originally going to be toxic, there is even a level set in the game data where it becomes toxic (as @itsLiseczeq noted) but I never enabled that "feature" because I figured it would get more complaints vs what it would add to the gameplay.
2d ago
More ways to kill each other in MC2

2d ago
Starting with MC2 v0.23.0, all new colonies will default to the following Universe. This change will not impact existing colonies, so if you want to join the new "global" default Universe, you simply need to put in this setting:

Public Key: mc2global
Private Key:

(Private key is blank, there is no private key)
4d ago
Also, I did some changing to the API code, there is a possibility that you will now be assigned a sector the next time you play online. idk. Both the API and the game code are so big now and it's been so long since I wrote them that it is hard to remember what does what :-/
4d ago
So the same guy had the same issue happen twice? @dfv123 What platform are you playing the game on? Or is there any other information you have on this that might help me find the cause in the code?
4d ago
Starting with My Colony 2 v0.23.0, all My Colony 2 games will automatically include the Coloniae and my-colony.com game stat collection endpoints (if you are not ok with this @Sobeirannovaocc just let me know and I can remove Coloniae).

Also, while this will probably not be ready in time for v0.23.0, I am working on a way to allow the stat collection endpoints to go both ways, so that not only can the game client upload it's stats to the collection server, but can also receive and display some data back from the server. I will make a dedicated post about this when the feature is closer to being ready, but basically the game is going to ping the endpoint to see if it supports the two-way stat feature, and if it does, it will add a new section to the colony statistics window for each supported/connected stat server. Clicking on that section will let you view/browse whatever data is available from the server. But again, more on that at a later time.

Next, v0.23.0 is also going to come with a default Universe setting, so that there is one primary MC2 "global" universe. Players will still be able to remove/leave the main Universe or start/use their own, but this way for new colonies, the game will have a more global/connected feeling to it, such as we have in My Colony 1. This new default universe will only apply to brand new colonies, but I will post a thread here in the forum with the universe information, so that existing colonies can join too if they want.

So anyway, those are a couple of the changes you can expect from the next MC2 update, which will probably go live by the end of this week, so stay tuned!
5d ago
EZ Register does not have a sort order option and only currently supports showing newest transactions first, so it is strange that your register is showing a random order. what platform are you running this on (windows/ios/android/etc?)
5d ago
The My Colony Universe Real Time Strategy (RTS) game Colony Wars has just been updated to v0.8.0, which is live now at it's new web domain and should be hitting Android over the coming days. This is the first real update to Colony Wars in about two years, so the game was long overdue. v0.8.0 contains a lot of updates "under the hood" and some quality of life improvements throughout, so let's take a look what is new!


The biggest change "structurally" to the game is one I mentioned in a thread earlier this week, which is that Colony Wars has been migrated off of the Web App Core framework and is now a stand-alone web app hosted at https://wars.my-colony.com/. If you previously had the Colony Wars progressive web app (PWA) installed to your device from the old Ape Web Apps location, you should uninstall it and reinstall the new one from the new URL.

The next change is the revamped title screen, which you can see in the screenshot above. The old title screen was also a component of Web App Core, so after migrating off of the library, I had to re-write the title from scratch. I sort of tried to copy off of the Red Alert 2 title screen (at least in terms of layout), since many of the game concepts are borrowed from RA2 anyway. Eventually, the background image on the title is going to cross fade between different battle scenes.

You will notice on the title screen that there is a new Quick Match button. This was added in response to Play Store feedback that setting up a new game could sometimes be too complicated on mobile devices. Now if you just want to quickly play a match, hop in the game and click on Quick Match. You will instantly be taken to a random map in Skirmish mode against how ever many AI opponents the map supports.


Improvements have been made to the New Game Lobby. You can now finally assign different teams to AI players, and change the color of the AI opponents as well. You can even assign AI players to be on your own team, if you wish. You might also notice a new map available called Crossroads. This was created by @GeneralWadaling , so if you enjoy the map please let him know!

Since we are on the subject of new maps, the Map Editor has also been improved. Namely, all of the functions on the map editor now work. Before, the abilities to import a map or open a saved map were not functioning, but now everything should be working properly (at least on the web app, Android might still have some bugs, but that will be sorted out in 0.9.0).


There was a lot of feedback on both the Play Store and through my email that the game was too difficult to control with touch screen, so several changes have been made to hopefully improve the situation:
  • Tapping on a unit twice will now select all units of the same kind in a 6 tile radius
  • Units will now automatically attack all in-range defensive turret type structures (pillboxes, SAM sites, etc)
  • When units are selected, you can simply tap on an enemy structure to order an attack, instead of having to click on the "move units" button first
In addition, Colony Wars previously had an issue where you could not cancel an in-progress construction. On the desktop, you could hold/cancel a build with a right-click, but this did not work on mobile devices. Now, a small hold/cancel button has been added to the build item on the construction sidebar, that you can tap on to hold or cancel a building that is under construction.


This also works for units. If you have multiple units queued up, you can click on their number in the sidebar to cancel the build.

Another much-requested feature has been added. You can now see the health bar for a structure by clicking on it (or mouse-hovering it, if your device has a mouse). In addition, there is now an option to sell a building, or to quickly set a rally point for new units. You could previously do the rally point with a keyboard shortcut, but now you have access to the option on touch screen too.


Once in the game, you will notice a couple of additional changes. Firstly, all of the interface voice recordings ("construction complete," "low power," "harvester under attack," etc) have been re-recorded. My wife was kind enough to lend her voice for the recordings, so perhaps the sound will be more "soothing" now that it was before!

The AI's "brain" has been ratcheted up a bit in this release, especially as it relates to attacking your base. Previously, an AI would send some tanks into your base, destroy one building, and then just sit there like an idiot. Now the AI will actually go all-in and continue attacking your base until the job is done (or his attack force is destroyed).

Overall in-game performance should be better as well in this release, as the underlying Scroll2d engine has been updated to the latest iteration, which has about two years worth of improvements baked in over the previous release.

Finally, the multiplayer experience should be greatly improved in this release. As with Scroll2d, there are also two years of improvements brought over from my in-house multiplayer library, many of the code improvements coming thanks to the real-time multiplayer nature of My Colony 2. Multiplayer games now feature better performance, and much better handling of error states, such as player disconnects.

So the main focus of this release was to get Colony Wars migrated to its new home and bring about some of the most requested interface improvements. The next update is going to focus on adding new units and structures to the game. United Earth still needs a few things added before it's considered a complete faction, and if you have any suggestions on new structures and units for United Earth, now is the time.

Once the United Earth faction is done, I will focus on adding LIS to the game. Like in My Colony, LIS will have some similarities to United Earth, but with a few different specialized units and structures.

Once LIS is implemented, it will be time to add Zolarg into the game, and maybe the Alpha Draconians too for good measure, I haven't decided on that yet.

Finally, once all factions are done, the focus will switch to implementing the single player campaign, which will play through the story of the Human civil war, and the LIS's break-away from United Earth. I mentioned in a thread the other day that I want to have RA2 style cheesy cutscenes in the game. I might make them using Death 3D, but I also might get myself a greenscreen and an "Admiral Tots" costume. Haven't decided yet...

All the while adding the above mentioned items, I want to add other improvements as well. More options to the Multiplayer/Skirmish lobby, like setting your starting funds, game speed, AI difficulty, and tech level. The game needs Super Weapons too.

So that is it for this update. Expect more frequent Colony Wars updates, and let me know what you want to see added (as well as what issues you find with this release). Thanks for playing, and be sure to bookmark/install Colony Wars from it's new URL at my-colony.com:

https://wars.my-colony.com/

#colonywars
6d ago
Check your private messages
7d ago
I have changed my mind and will not convert Colony Wars to Scroll3D and will instead continue to develop it as-is. I just don't want to have to re-do all of the code.
8d ago

bastecklein

Developer
Member Since
September 2nd, 2017
Welcome
Ape Apps, LLC is an independent software development company founded in 2010 by Brandon Stecklein. Over the years, Ape Apps has published over 400 apps and games across various platforms. You can get in touch with Brandon on Twitter or by leaving a post on his wall @bastecklein
App of the Day