Hi Robin,
That was nice suggestions. I've taken all of them into account.
Fixing the rectangle selection box problem was a little confusing, at first, but i did overcome the issue.
Thanks again. I'm actually looking for ways to speed up pathfinding/units move before adding them finally to the engine.
[WIP] My Basic RTS : Codename NaW
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: [WIP] My Basic RTS : Codename NaW
Thanks to you...I have been able to implement a Unit manager class. It actually deals with the basics (single unit moves using pathfinding). And it seems to be working fine. But I still have to improve the code. My idea was to make the unit manager class run in two main loop.. An update function wich moves any ordered unit when he is asked to, and a drawing loop. Inside the drawing loop, when any unit is asked to move, the unit's ID and hi starting and final destinations are saved into a queue. Now, in the update loop, one single path is calculated using A-star algorithm per cycle, to prevent from any drastic framerate drop..Robin wrote:Excellent improvements.
Does this sounds efficient to you? ( See the prototype given below)
I'll be posting the new updated '.love' version tomorrow, I guess.
Code: Select all
function unit:updateAll(delta_time)
local path
if #queue > 0 then
path = calculatepathWithAstar(queue[1].startingNode,queue[1].finalNode)
if path then myUnits[queue[1].id].path = path end
end
table.remove(queue,1)
end
for each unit in myUnitsCollection do
updateEachUnit
-- rest of the code
end
end
function unit:drawAll()
for each unit in myUnitsCollection do
if unit.selected and orderedMove then
table.insert(queue,{id = unit.id, startingNode = unit.startingNode, finalNode = unit.finalNode})
end
end
end
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: [WIP] My Basic RTS : Codename NaW
Have you tried running it?Roland_Yonaba wrote:Does this sounds efficient to you? ( See the prototype given below)
Help us help you: attach a .love.
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: [WIP] My Basic RTS : Codename NaW
Oh yes, I did. here is the update attached below.Robin wrote:Have you tried running it?
Actually I made it run with one unit. It still needs some improvements, through.
I'm also planning to handle single units and group based units moves differently. I haven't decided yet how to deal with it, but I'll find a way.
- Attachments
-
- NaW.love
- NaW (R6) : Unit Manager Class Added
- (895.17 KiB) Downloaded 321 times
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
- SoggyWaffles
- Citizen
- Posts: 72
- Joined: Sun Jan 02, 2011 3:27 am
- Location: Wyoming, USA
Re: [WIP] My Basic RTS : Codename NaW
One thing i noticed is that as you move your guys around and keep clicking/selecting resources and keeping them in your selected list, so next thing I know i have this guy and LOTS of trees and rocks selected. This has the potential of becoming confusing later on. But, I don't know your plans, so it very well might not.
"Beneath the clouds lives the Earth-Mother from whom is derived the Water of Life, who at her bosom feeds plants, animals and men." ~Larousse
Re: [WIP] My Basic RTS : Codename NaW
How do you get the guy to move?
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: [WIP] My Basic RTS : Codename NaW
Just select the unit (Mouse left button), click anywhere on the map (Mouse left button again)...
Who is online
Users browsing this forum: No registered users and 5 guests