[WIP] My Basic RTS : Codename NaW

Show off your games, demos and other (playable) creations.
User avatar
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

Post by Roland_Yonaba »

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.
Attachments
NaW.love
NaW (R5)
(895.81 KiB) Downloaded 143 times
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: [WIP] My Basic RTS : Codename NaW

Post by Robin »

Excellent improvements. :)
Help us help you: attach a .love.
User avatar
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

Post by Roland_Yonaba »

Robin wrote:Excellent improvements. :)
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..
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
yay..I have risen to Citizen!
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: [WIP] My Basic RTS : Codename NaW

Post by Robin »

Roland_Yonaba wrote:Does this sounds efficient to you? ( See the prototype given below)
Have you tried running it? ;)
Help us help you: attach a .love.
User avatar
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

Post by Roland_Yonaba »

Robin wrote:Have you tried running it? ;)
Oh yes, I did. here is the update attached below.
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 285 times
User avatar
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

Post by Roland_Yonaba »

Screenies...!

Image

Image
User avatar
SoggyWaffles
Citizen
Posts: 72
Joined: Sun Jan 02, 2011 3:27 am
Location: Wyoming, USA

Re: [WIP] My Basic RTS : Codename NaW

Post by SoggyWaffles »

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
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: [WIP] My Basic RTS : Codename NaW

Post by appleide »

How do you get the guy to move?
User avatar
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

Post by Roland_Yonaba »

Just select the unit (Mouse left button), click anywhere on the map (Mouse left button again)...
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 54 guests