Standby mode and cancel button

I want to create a simple RTS game. I need the unit that I clicked to wait for my commands until I click on the map, for example, where it needs to move. How to make a standby mode? Additionally, I would like to know about the cancel button for the unit.

1 Like

There is RTSUnitSelection extension which would allow you to do that

But how will it work on android?

It is 100% doable and i am currently working on modifying this extension to use same button for selecting adding and controlling units

It needs some variables and it is multi level logic
Not something hard just something you need to sit on think and do it
And that is my problem i have no heart for it

You need to have variable and event to NOT stop units movement after you select different units or click on building or simply deselect units or click on menu
Also you need to make variable and events for when you already have trajectory set and select new units and make so they don’t go to last selected destination

It is just logic again not something hard but something you need to sit upon think and just do it
And my dyslexia and ADHD do not help me in doing so
You can ask on forums for someone to try and make that logic for you for single click
Cause for me it would be like few more weeks before i will be successful in accomplishing making this extension work with just one button

1 Like

I understand you very well. It’s really hard to do this on your own. I will ask for help in order to complete the stuffing of the project faster and take care of the design. I also don’t want to be distracted from it, I want to specifically conclude it definitively.

If you gonna ask for help on it
My suggestion would be asking for state machine
State machine is just name for group/collection of events that works like
IF something is on do not let something else to be turned on or off

For example you do that in fighting games
If you press Z key player animation is set to punch
But in addition when player animation = punch
Disable player movement
So you can’t press Z to punch and still move player left and right

Same story with unit selection
It just require some logic built into it
And that logic is just something i would need to spend hours (i already did and failed) building
Since each time i am able to get one thing to work seems i forgot about another thing and need to implement even more event to allow and restrict other events from happening
Also i did not figure out yet how to make units go to specified position
But new units you gonna select next NOT go to the same exact position specified previously but wait for next specified position
I guess solution would be creating arrays and each time you define destination it is a single time use thing
But maybe that is wrong approach
Maybe creating object when destination is determined (units are selected and you click where they should go) making simple indicator on map for units to go to position of that object would be solution

Again just logic someone need to challenge and build
Nothing hard just complex

1 Like

OK i may be closer than i believed

  • selected units will go where you click (setting destination)
  • selected units will NOT deselect when you click (to set destination)
  • you can deselect units by dragging mouse (click + move mouse)

Still problems to solve

  • not let units to auto follow previous destination set by click IF they were selected after it was set
  • make units not overlap (i was considering 2 solutions 1-constantly separate them 2-let them separate AFTER they stop and 2nd idea seems more reasonable)
  • i am considering adding something like you have in rusted warfare
    https://play.google.com/store/apps/details?id=com.corrodinggames.rtsdemo&hl=pl&gl=US
    Where if you hold touch/click for 1 sec (without dragging) it will start to create from point where you touch/click a circle which will grow from that point from center
    Which is another method of selecting units
    So maybe solution would be to ditch drag selecting units and switch to hold touch/click for 1 sec to create circle to select units
    But again that is more logic to implement
  • Other solution would be like in android game Project-RTS
    You have rectangle icon in left side of screen
    If you click on it you enter ONE TIME drag mode selection
    So normally you are either on camera drag with left mouse button/touch and unit selection if you click on ONE unit
    But to select multiple units you need to click that icon to enter creating rectangle area with mouse/touch drag
    But that locks you in setting destination mode for units
    You would need to click that rectangle icon again and make drag selection on empty space to deselect units
    OR maybe make deselect units button next to that rectangle button

Many things to consider and many things to adjust when implementing
My goal would be to leave option for users to choose which type of control they want
So i would need to build logic for each of these controls

Do not let what i wrote above stop you for asking for help with with standby mode and cancel button
I am not promising you i will make anything
I am only telling you i am working on it and i am more than sure i will hit wall i won’t jump over on my own
So i will also need to ask for help here to solve some issues
And idk how long it will take
Maybe i got it working 2morrow
Maybe it will take me 1 week to solve all issues for 1 method of managing units
Maybe even longer

I really appreciate your perseverance and hard work. We need to join forces in order to create an interesting and thoughtful prototype for RTS games. The more people interested in the problem, the more options and opportunities we will have.

Yesterday I played a game like honest war Honest War
I really liked the system of movement of troops and the interaction of buildings in it. But even more I liked, albeit not the most convenient, but the frame for selecting all troops by touching two fingers and stretching the selection grid.

However, I did not notice the “cancel” button there, perhaps there will still be a choice of instructions for units.

I also played in Dreverepsina. There is found a very interesting alternative using a flag. https://play.google.com/store/apps/details?id=yio.tro.psina

I checked both
Honest War really could use that cancel button
But overall units control is pretty fine with me
Cool idea to select all battle units with 1 button
But i think it could use another button for select all battle units you see currently on screen
That would be cool solution (100% doable in gdevelop)

Dreverepsina is something i would NOT want to see in RTS
It is cool idea on paper
But in heat of battle if i need to look for that flag i miss click trying to grab it
That would be deal breaker for me

This is FAR FAR FAR from perfect and my brain already looks like
happy jelly
Just without smile

But i am getting closer
All buttons work well buggy but i claim they work

I did figure that if i give X and Y position of cursor to object variable (in this case each unit will have X and Y variable of destination)
This is how i will be able to allow 2 units go to different destination
Yet i used group for that and it don’t work
Since making event for each unit type would be stupid and last resort
I try to solve some of the bugs 2morrow but i hope you see we are getting closer to making our dream RTS which would be mobile friendly

Also i need to declare here i am going for single touch here
Reason for that is some users can have potato phones with well no multi touch support so lets not exclude them

BTW this is still just mouse stuff but once i get mouse working just fine it will be piece of cake to do it for touch
But you can try if it even work on mobile since i did not test it

1 Like

I apologize for being away for so long. I spent the creation of an isometric map, modeling and drawing. I’m on the forum only from my phone, so maybe you can try.

In fact, using a mouse (albeit on a phone) is a bit convenient, although there will be a problem in its size. I think you can do something like choosing an interface. Either a clean finger or a mouse to the taste of the player. You have done a great job, which I look at with admiration!

  • Before you read my wall of text just be aware i do not have yet solution for you (i know how to do it but it won’t give you anything since everything needs to be made to assure it is working with everything else)
    But i am starting figuring it right now
    And wall of text i made below will explain why

BTW check this out
2023-08-17_15_36_EPkXqi8aUK_GDevelop

Do not think i forgot about you
In fact i need to thank you and as i told you i have ADHD it is hard for me to get ideas and find solutions
And my biggest problem is when i am doing it for myself
Somehow i have easy time finding them when i am solving someone else problems
And the fact i remember you are waiting for this solution pushed me toward finding solutions to problems i faced
So Thank You
And trust me you may think you did nothing but in fact you helped me more than i gonna help you

Anyway
I was on a journey learning how to modify extensions for it to make sense
And getting everything to work
I made best learning mistake i could which is break something before you can learn how to do it properly
I mixed selection and movement events inside extension and in scene event sheet which was VERY VERY bad idea
After i got kinda most of it to work i realized further i go more problems it will create
So i scratched all that and went with
DO NOT modify events in extension just add your own functions in extension and then use that to control crap in scene events sheet

When you made this post i am replying right now to i was making another wall of text post looking for help here to solve
If i click on object it will get selected and deselect all other selected objects
(Like it should happen in RTS game)
But problem was since i was NOT checking if cursor is on object then it meant when i click on background it also deselected all objects
So selection made no sense
If i check for if cursor is on object then it would work just fine when clicking on background
But also add any clicked object to selection NOT deselecting objects on which cursor was not
Solution was (wasted 2 hours on that) not to check for if cursor is on object
But to create boolean variable that checks if cursor is on object or not
And check True/False state of that variable instead
And believe or not it magically works perfectly fine

On that same moment i found 5 other problems which i just solved
And look how it went

I found a way for using expression to change RGB color of something
Which i could use in conjunction with sliders so i can add 3 sliders for player to control color of selection box/circle outline and fill area
All buttons work perfectly fine where to enter selection box state you need to press right most button on the bottom
Circle selection is triggered by holding LMB NOT on objects or buttons for 0,5 sec
I can create slider or whatever for player to adjust that time so everyone before circle is starting to be drawn
I also could simply create a button (same as one i have for box selection) with on off state for circle selection
Lshit to add units to selection Lctrl to remove them from selection
Not holding Lshift or Lctr will just create new selection
I hope i do not need to explain how just clicking on units selection works

Things i fixed

  • Selection by clicking do not deselect selected objects if clicked NOT on object
  • Lshit is additive key Lctrl is subtractive key to add add and remove objects from selection both works
  • Above works with ALL selection methods
  • When selection box/circle is created and mouse cursor changed position camera dragging is disabled so you do not drag camera by accident while creating selection
  • When creating selection box you can’t enter circle creation method and vice-versa < - this also took me 3 hours to figure out
  • When cursor is on object or buton you can’t create selection by circle however you can create selection by box when on object but still not on button
  • Thx to above and that 3 hour wasted i also fixed when you already made selection by box/circle (meaning they already exist/are drawn) and you move mouse cursor over unit it do not bug/cancel selection or do whatever other weird crap i experienced
  • While still creating/drawing selection box/circle you can move your mouse cursor change it’s position and units will get selected or deselected depending on if they are inside or not of selection
  • Above works with additive and subtractive keys
  • IDK if i gonna even try to fix it or even should i but holding subtractive key to remove units from selection while doing box/circle selection deselects objects if they are inside selection
    But not select them back if you move selection away from them
    Technically i could solve this but i think this is actually working as it should
  • Dragging camera do not allow you to enter selection of any kind
    Unless you hold cursor for 0,5sec in one spot then it will start creating a circle and then you can’t drag camera until selection is over
  • (1st problem i encountered) selecting one unit was selecting all of them now it works as you would expect it
  • Various problems with buttons logic i won’t event try to name all of them but there was A LOT
    But one i mention is box selection buton not flipping back to off state after box selection ended
    Well now works as intended

I bet i missed a lot more cause i do not remember all problems but i wasted DAYS figuring stuff for RTS unit selection
And since i am done with selection and button logic
Now i am moving to well moving units logic
So next step is what you are waiting for so be patient

My god i feel sorry if you did read that whole wall of text

1 Like

I have read absolutely every line and letter of this text. I am very glad that we are helping each other at this time. Creating the core mechanics for RTS is practically the heart and brain of the game. And it is you who help me create this difficult “organism’s life system” practically from scratch. I am sure that in the end we will get a wonderful component that will be included in common products and projects. This is not just a matter of decision - this is a piece of work that deserves to be commended, as it is (perhaps) the only one of its kind. I believe in you and I will definitely wait.

1 Like

I tried the circle system. Now you can blow bubbles, I would say :slight_smile:

Very cool, you are on the right track!

1 Like

Just to let you know
Today i am trying to implement that sliders for color change for both shape selection methods
Since that is connect A to A connect B to B my brain wont suffer
But 2morrow i am going full on movement system

AND i was vary right to scratch my 1st attempt at modifying extension + events
Since turns out I was selecting all units even so selection marker (that thing that appear on unit when it is selected) was indicating i only selected ones in selection area

And so all units were moving when i give move order when not ALL of them were selected
So like i said building anything on that will create more problems the further i go

That’s why in link to preview in my previous post you can see that when units are pre and selected they change color
i use Tint action for that and that is best indicator did i set up everything right in events and extension

So we are indeed on good track everything is just freaking working
Only building the rest is the issue now

BUT i need to warn you
As further i go i noticed more and more variables i need to create to restrict when something is allowed or not
And i did not even get into having enemy units on scene

Even simple UI or buildings restriction for when what is allowed or not takes TONS of variables before it works perfectly and i still don’t have enemy buildings
Not to mention UI that display something different when you click on your building and enemy building
I know you are not making RTS like me but turn based
But trust me
We gonna swim in variables

BUT it is doable just takes time
So thumbs up and let’s hope for the best

1 Like

I am smiling like a little baby right now
I said to myself
Well fak that color of shape selection and UI
Let’s see how that movement orders would work
Took me 15 mins to figure it out

2023-08-19_18_04_QBY31oT544_GDevelop

And imagine i had everything i needed already prepared (well almost)

I noticed there is a bug or more likely lack of one variable to check if you started selection then finished it
I would make that boolean variable and so it would prevent scenario when
You have one unit selected
You hold LShift to add to selection another unit NOT BY CLICKING on it
But by creating selection box or circle
Then if you release LMB that one selected unit will go to current cursor location
While added to selection units won’t move
So i need that additional variable for checking if selection process ended + LMB was released
Also another bug (lack of variable) when dragging camera and releasing LMB it will also give move order to selected units
But both gonna be fixed in seconds when i add variables

Now check this out
For whatever reason:

1 - ANY cursor is not on object group will not work
Because of the logic of INVERTING cursor is on something makes it go like
Cursor is not on ALL of that objects at the same time but 1st it needs to be on all of that objects then move away from them for it to work
(do not ask i also think it’s weird)

2 - To get it to work you need to use NOT condition which inverts logic and not the condition
BUT for whatever reason if i have UNITS group in there it does not work
And it ignores all 3 cursor is not on something conditions you see there

3 - I didn’t know about above before creating it but if i remove units condition it magically would work
But still if release mouse button on units
For example i have one unit selected i hold LShift to add another unit by clicking
In moment i release LMB on another unit that 1st selected unit will go to that position cursor was at that moment

4 - Solution Just like i solved selecting units by clicking (do not check if cursor is on object make boolean variable that checks if cursor is on object and then check true or false state of that variable) i used same trick here
And bam works
Also i noticed i do not need in actions first set cursor X and Y to variable then set Unit DEStination to that variable but i can directly change X and Y Des variable of units when LMB released
In last event i change SELECTED units ACTION CanMove boolean variable to true on LMB released


In 1st event (2nd and 3rd events are just for testing)
I move units toward their DesX and DesY variables with force if CanMove variable of Unit is TRUE
And surprisingly this is how they move

And how button works is on screenshot below
Yet what you were asking for is in read area

Now we gonna need to face enemy AI a truly worthy opponent
Damn i go fix whatever i can and add that coloring sliders for selection methods

1 Like

Muhahha
And what do we have here?

Try to find any way where you should not be able to give move order but you can

And vice-versa where you should be able to give move order but you can’t
Again LShift to add units LCtrl to remove units from selection

I did fix:

  • You have at least one unit selected and you hold LCtrl or Shift to make new selection by box or circle then when you finish selection originally selected units will go to cursor position
    Now they don’t
    You need to click somewhere after releasing lmb for them to move there
  • While unit is selected clicking on other units make unit go to that unit
    Now it won’t
  • Releasing lmb after camera dragging while any unit was selected would make that unit go there
    Now you need to click somewhere AFTER camera was dragged for selected unit to move there
  • I added 0,2 sec delay before detecting camera drag
    This way if you have unit selected and you click somewhere but your mouse or finger slipped you (and camera drag state should be enabled) you have that extra time/area to make mistake and it will register as giving move order
  • You won’t be able to give move order while making any type of selection

Dam i again forgot few things but these are the ones that just came to my head
Have fun

I fixed and i forget what
Ow there was too long delay between when you ended selection and was able to give move order
Also now units stops when they reach destination
Also now they will scatter when they reach destination point and they collide with each other
Yet this is really WIP looking very buggy but at least good start
Also enjoy the music

2023-08-20_04_23_idWCmQhbnk_GDevelop

1 Like

I have tried it on both android and pc. On PC it’s awesome. On android too, but again, you need to think about the movement of the camera, touch and more.