I thought I'd share my progress on the real-time strategy prototype I've been working the past few days. The main things completed thus far are unit grouping with a line formation; an overhead camera that can be moved, rotated, and zoomed; and a few interface things such as dragging to make a group take a formation and "ghost formations."
I'm making this using my Ammo (GitHub repo), so this is an example of how you can use it. There's also quite a fair bit of trigonometry in here (especially the formation calculation), which may be helpful to some. If you think there's a better way to do something, please let me know; I'm quite the novice when it comes to trigonometry.
Controls:
LMB to select a group. You can't click and drag to select at this point.
RMB to move a group. Click and drag to explicitly specify the formation the group should take.
WASD/Arrows to move the camera.
Q and E to rotate the camera.
Scroll to zoom.
GitHub Repository: https://github.com/BlackBulletIV/rts-prototype
Basic RTS Prototype
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Basic RTS Prototype
- Attachments
-
- rts-prototype.love
- This is a bit outdated. The GitHub repository will have the latest version.
- (359.01 KiB) Downloaded 370 times
Last edited by BlackBulletIV on Thu Aug 16, 2012 4:28 am, edited 3 times in total.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Basic RTS Prototype
Oh Hell! Canvas! Can't try it.
I was really really interested in, though.
I was really really interested in, though.
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Basic RTS Prototype
I've updated it to use exported PNG versions of the images that were generated if canvases aren't supported. Hopefully that works.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Basic RTS Prototype
Wut! Awesome! Wut!
Okay, jibjab!
I started working my self on a RTS based game 3 years ago. Originally, I started it on PSP, using Homemister's LuaPlayer as a framework.
The latest public release can be found on PSP-Hacks.
When I discovered Löve, more recently,I rewrote it, but I wasn't that much satisfied of the results and the overall looking. Not because of Löve, but because of my code. I kind of "turned-off" the project, and i'll hopefully be back on it someday.
Features I couldn't implement as well as I wanted to was:
But well, you may now understand for what reason I was highly interested in your work.
I tried it, and I liked it. Group move feature is awesome.
Yet, it doesn't feature any of the things I mentionned previously.
But, anyway.
Have you plans using it in a next project ?
Did you used any papers, reading before implementing this ?
Are you willing to work on some improvements, new features ?
Keep up the awesome work.
Okay, jibjab!
I started working my self on a RTS based game 3 years ago. Originally, I started it on PSP, using Homemister's LuaPlayer as a framework.
The latest public release can be found on PSP-Hacks.
When I discovered Löve, more recently,I rewrote it, but I wasn't that much satisfied of the results and the overall looking. Not because of Löve, but because of my code. I kind of "turned-off" the project, and i'll hopefully be back on it someday.
Features I couldn't implement as well as I wanted to was:
- A clean, nice and responsive pathfinding for a single unit moves.
- Group unit with and coordinated-moves.
- Workout avoiding collisions between units, crossing overs through a fast algorithm
But well, you may now understand for what reason I was highly interested in your work.
I tried it, and I liked it. Group move feature is awesome.
Yet, it doesn't feature any of the things I mentionned previously.
But, anyway.
Have you plans using it in a next project ?
Did you used any papers, reading before implementing this ?
Are you willing to work on some improvements, new features ?
Keep up the awesome work.
Re: Basic RTS Prototype
Amazing engine!
I don't quite understand how the units shift when moving around. If i made something similar to this i would have you select each unit, and move those to where you click. It would work like this:
1.) you select units and click where you want them to go.
2.) each unit moves to where you clicked.
3.) if any units collide during the moving, they go in a random direction until they are not touching.
Your way looks nicer, but with one drawback: you need to move in groups.
If i were to make a RTS game, i would use a combination of the methods, to make it look nice, and allow for moving single units or smaller units. If you feel like taking this further, you could have it so you double click a unit to move it individually, and when it's done moving if it's close to a group, it becomes part of that group, but if it's not close to a group, it starts it's own group.
Anyways, amazing engine, it would be awesome to see it with movement of individual units, but that might be horribly complex, so i'm not complaining.
once again, great job with this.
EDIT:
Was playing around with this. Is this supposed to happen? (attached file)
I don't quite understand how the units shift when moving around. If i made something similar to this i would have you select each unit, and move those to where you click. It would work like this:
1.) you select units and click where you want them to go.
2.) each unit moves to where you clicked.
3.) if any units collide during the moving, they go in a random direction until they are not touching.
Your way looks nicer, but with one drawback: you need to move in groups.
If i were to make a RTS game, i would use a combination of the methods, to make it look nice, and allow for moving single units or smaller units. If you feel like taking this further, you could have it so you double click a unit to move it individually, and when it's done moving if it's close to a group, it becomes part of that group, but if it's not close to a group, it starts it's own group.
Anyways, amazing engine, it would be awesome to see it with movement of individual units, but that might be horribly complex, so i'm not complaining.
once again, great job with this.
EDIT:
Was playing around with this. Is this supposed to happen? (attached file)
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Basic RTS Prototype
@Roland_Yonaba:
Thanks for the feedback.
What exactly do you mean by "Group unit with and coordinated-moves?" Did you mean selecting multiple groups at a time or something?
@Nsmurf:
Thank you for your feedback.
The group concept I'm using comes from the Total War series. You could do the same with individual units, but for my purposes I think having set groups is a better idea. And yeah, at present there is nothing to prevent collision between units. It'll be a bit complicated to tackle that efficiently; I may have to resort to using love.physics for its efficient collision detection.
As for your image attachment, it depends what you did to get there. They just look like formations with a short drag length.
Thanks for the feedback.
What exactly do you mean by "Group unit with and coordinated-moves?" Did you mean selecting multiple groups at a time or something?
This kind of is the project; I've got the idea for a game, but for right now, I'm implementing the basic RTS stuff.Roland_Yonaba wrote:Have you plans using it in a next project ?
Apart from the Lua manual and LOVE's documentation, no.Roland_Yonaba wrote:Did you used any papers, reading before implementing this ?
Definitely. This is by no means finished.Roland_Yonaba wrote:Are you willing to work on some improvements, new features ?
@Nsmurf:
Thank you for your feedback.
The group concept I'm using comes from the Total War series. You could do the same with individual units, but for my purposes I think having set groups is a better idea. And yeah, at present there is nothing to prevent collision between units. It'll be a bit complicated to tackle that efficiently; I may have to resort to using love.physics for its efficient collision detection.
As for your image attachment, it depends what you did to get there. They just look like formations with a short drag length.
Re: Basic RTS Prototype
Doesn't work with luajit due to
lib/strong/strong.lua 67: invalid escape sequence near "[ _'
lib/strong/strong.lua 67: invalid escape sequence near "[ _'
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Basic RTS Prototype
Ya welcome.BlackBulletIV wrote:@Roland_Yonaba:
Thanks for the feedback.
Nah, my bad, I mistyped. Just wanted to say "Coordinated units movements". Collidance avoiding stuff, you know. So that when units moves into groups, they try to prevent to collide each other. Like a flock of birds, sheeps, etc.BlackBulletIV wrote: What exactly do you mean by "Group unit with and coordinated-moves?"
I remember, back in days, when working on my stuff, I did something similar to waht Nsmurf was stating...Loop into the collection of units, and for every unit, make a collision test with all the others, and move in in opposite direction on purpose. It worked, but was really really ugly.
Good memories...
Can this be easily mixed with pathfinding, right now ?
I am keeping an eye on this. Have you pushed it on Github yet ?
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Basic RTS Prototype
Well, open 'lib/strong/strong.lua' in your favorite source code editor.Lap wrote:Doesn't work with luajit due to
lib/strong/strong.lua 67: invalid escape sequence near "[ _'
Scroll to line 66, and replace string.camelize function with this:
Code: Select all
function string:camelize(upper)
self = self:lower():gsub('[ \t_%-](.)', string.upper)
return upper and self:gsub('^%l', string.upper) or self
end
Code: Select all
function string:underscore()
return self:gsub('([A-Z]+)([A-Z][a-z])', '%1_%2'):
gsub('([a-z%d])([A-Z])', '%1_%2'):
gsub('[ \t]', '_'):
lower()
end
- BlackBulletIV
- Inner party member
- Posts: 1261
- Joined: Wed Dec 29, 2010 8:19 pm
- Location: Queensland, Australia
- Contact:
Re: Basic RTS Prototype
Thanks for catching that problem guys. I've updated the library and credited you, Roland. By the way, your website in your signature should use HTTP not HTTPS, since the latter doesn't go anywhere.
As for path finding, or, collision avoidance, that's a tricky thing. The only way I can see it being done in Lua is by checking everything unit with every other unit, which is obviously a very inefficient thing to do when you get larger numbers of units. You might be able to use a quad tree or something, but I've no idea how they work. I might have to resort to love.physics to resolve the collision between units. We'll see what happens.
I've created a new repository which you can find here: https://github.com/BlackBulletIV/rts-prototype
As for path finding, or, collision avoidance, that's a tricky thing. The only way I can see it being done in Lua is by checking everything unit with every other unit, which is obviously a very inefficient thing to do when you get larger numbers of units. You might be able to use a quad tree or something, but I've no idea how they work. I might have to resort to love.physics to resolve the collision between units. We'll see what happens.
I've created a new repository which you can find here: https://github.com/BlackBulletIV/rts-prototype
Who is online
Users browsing this forum: Google [Bot] and 2 guests