GameMaker Tutorial - RTS Unit Mechanics
Вставка
- Опубліковано 8 жов 2024
- Get Element Earth ▶ tinyurl.com/hga...
Try Element Earth Demo ▶ tinyurl.com/hod...
Support This Channel ▶ tinyurl.com/jet...
Follow me on Facebook ▶ tinyurl.com/opj...
Follow me on Instagram ▶ / jp_damstra
Follow me on Twitter ▶ / slasherxgames
Follow me on Google+ ▶ plus.google.co...
▼ More ▼
General Game Maker Playlist ▶ tinyurl.com/omg...
Game Maker Networking ▶ tinyurl.com/oau...
I'll show you the fundamental dynamics of RTS unit selection and movement. This tutorial features many concepts you're already using in your favourite RTS game like shift+click multiple selection, left click unit selection, right click unit movement and click and drag selection rectangle.
▼ Useful Links and Resources ▼
GameMaker Studio Project ▶ tinyurl.com/jjw...
Sprite Resources ▶ tinyurl.com/jma...
Smooth Rotations ▶ tinyurl.com/pve...
Happy Coding :D
hi, this is very usefull tutorial for me, nice job
Is there a way to add a command queue with shift + right click? If you click a lot of places, the unit will first move to location 1, then when location 1 is reached it will go to location 2 from the queue and so on. It would be nice if this worked with all sorts of commands. Like, "first build a house here, then move to this location, then repair this building..." A lot of rts games uses this system.
Great tutorial, thanks a lot!
So much help, and with a clean code.
... but I have a problem in my project because I made just one kind of unit, and they all got the same speed. So the following issue appeared:
when I selected some units and sent them to the same point (like you did in the race), they all gathered in that spot. So whenever I try to click at any of them, it selects the whole bunch of units, and i could never separate them because they would move all together.
How do I fix this?
Holy crap, quite innovative. I liek it 👌👍
Now the really interesting part, however, is: how do you get your units to move around obstacles and find their way by themselves? That's something I've been racking my brain about a lot.
But it's probably too complicated for such a simple tutorial.
docs.yoyogames.com/source/dadiospice/002_reference/paths/index.html
docs.yoyogames.com/source/dadiospice/002_reference/movement%20and%20collisions/motion%20planning/index.html
Grog
Thanks, but I know the Game Maker documentation. And it's not at all easy and straightforward to use those functions to achieve what I described above. That's why I would need tutorials for that. Anyway, I'm not even working on a RTS game, it was just something I was curious about.
Faygris Thanks for your input. I'll look into demonstrating more concepts for the RTS game type and this feature will be high on that list :D
Faygris grid = mp_grid_create(0, 0, room_width / 32, room_height / 32, 32, 32);
path = path_add();
mp_grid_add_instances(grid, wall, false);
path_start(path, 4, 0, true);
That's all it is to get a grid pathfinding system :)
SlasherXGAMES ™
Cool, because I am working on my own rts game, but some things (like the units moving around obstacles) are complicated.
I watched some Tutorials but they used simple circles moving without animation and so on.
But I am working on a rts game, that has moving animations and so on and that makes it very very difficult for me :(
It would be great if you would make some helpful Tutorials for that.
A follow up to include 'control groups' after having the units selected would be nice.
im still a beginner in game maker and i want to learn how to make an rts. Where can i get more tutorials especially on coding?
Hi! first of all, thank you for your tutorials, helps a lot!
Here's the thing: I'm learning GM for a few months and my goal is to (try to) make an isometric RPG quit like Baldur's Gate. At least some basic game like it. I've to learn a lot more until I can pretend to do such a game...
I've followed your present tutorial to be able to move my character(s) with mouse click (not keys or arrows!), select them and all like you explain here. I just wanted to know if you have some helpful links, codes or tutorials to advise me to learn how to have my character facing the direction he is moving. I'm not talking about simple rotation like here, but with 4 different sprites (Up, Down, Left, Right, the basics), and after hours of searching I still can't figure it out. I'm trying to obtain a result such as the moves of a character in iso-RPG like Baldur's Gate and alike. The goal for me is just to be able to move & act with mouse interaction.
I've followed your tutorial step by step, so I thought maybe you could tell me how, according to the process you've explained here.
Just a difference, maybe that's nothing, but unlike you, I have my room and objects running with physics. I begin to understand the difference, but am stuck with this multiple facing sprites thing.
If you can help me, I'll be greatfull! Until then, I continue looking for an answer.
Thanks again for your time and dedication to help us all with your tutorials!
You forgot something Important, you forgot to program the collision between the units, they doesn't suppose to stuck to each other on the same point and they will be stuck forever
Imperial Games Yeah, unit collision detection is the next step. This tutorial focused more on the selection and movement mechanics.
OH Thanks, we really need the next part
Thank you SlasherGames
Is there anyway I can make it so the units don't spawn randomly?
SonicBricks You could make an object for each type of unit and assign it a specific sprite instead. Move all "common code" into a parent and have each child object inherit from it to minimize duplication of everything else: ua-cam.com/video/kccIh5Sny14/v-deo.html
If i was making a game with selectable units like this, but there is a character, would i put this code into the player object? or still create a new one?
mind blown
is there a way to make it were it rotates first then moves
or a way to have more precise points because sometimes my guys come in at a weird angle and start shaking back and forth
help.
ERROR in
action number 1
of Other Event: User Defined 0
for object draw_select:
Error in code at line 3:
x1 = min(select_x1, select_x2);
^
at position 11: Unknown variable select_x1
Is there a way to do this
without any coding??
lol
Need to fix the bottom half of the description :P
Cody Turner Haha, thanks man! I uploaded this in the small hours after a night out XD
В этом нет смысла без системы поиска путей!!! Это гораздо сложнее реализовать!
Parle plus lentement je suis français. Je ne comprend pas ce que tu dis