Abandoned Force - Top View Strategy Game

Next Step is done: RESEARCHING.

Now its possible to research at the research-structure. Clicking on the structure opens a game-typical (generated) menu with all researches (receipes, which are in the global-list).

Three “Receipes” for testing are included and working well. The actually research-type/research/receipe looks like this:

-- RESEARCH TYPES
S.researchType = {
	-- INCREASE ammoMagazine Size
	{
	hash = hash("moreAmmo"),
	name = "Inc. unit magazine", -- Text shown in button
	researchResource = "iron",
	researchCost = 400,
	researchTime = 3, -- Seconds
	researchGroup = "unit",
	exec = function(self) 
		self.unit.ammoMagazine = self.unit.ammoMagazine + 5
		print("increased unit magazine size by 5")
	end
	},
	{
	hash = hash("moreMoveSpeed"),
	name = "Inc unit movespeed",
	researchResource = "gold",
	researchCost = 400,
	researchTime = 5, -- Seconds
	researchGroup = "unit",
	exec = function(self) 
		self.unit.moveSpeed = self.unit.moveSpeed + 50
		print("increased movespeed by 50")
	end
	},
	{
	hash = hash("moveMaxEnergy"),
	name = "Inc unit energy",
	researchResource = "artefact",
	researchCost = 400,
	researchTime = 10, -- Seconds
	researchGroup = "unit",
	exec = function(self) 
		self.unit.energyMax = self.unit.energyMax + 10
		print("increased max energy by 10")
	end
	}		
}

Looks ingame like this (menu):

Structure counting “down” until research is done:

Research is done, all units showing:

Technically after checking if there is enough resources given the GUi sends (using msg.post()) the research to the defined group of the receipe (actually only “unit”) - means to all existing units listed.
Every unit simply starts the function() given in the receipe.

Not sure if this is the best way but works. Not sure if it will be hard if there are maybe hundreds of units ? o.O
Need to do a stresstest :wink:

4 Likes