EnergyMake EnergyUse

EnergyMake EnergyUse

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
PauloMorfeo
Posts: 2004
Joined: 15 Dec 2004, 20:53

EnergyMake EnergyUse

Post by PauloMorfeo »

In oTA, most units produced a little amount of Energy and, when they started to move, spent that same amount of E too, if i remember well.

Mods still carry that legacy (XTA, AA, TLL) in the FBIs. Most have a same amount of EnergyMake and EnergyUse.

However, EnergyUse doesn't seems to be working... In all those mods, units only produce energy, never see them spending energy and i can't make them correctly spend energy...

So, i am not doing anything wrong, or am i? It's the engine's fault?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Engines fault. Can be fixed via the script by setting ACTIVATION to true when moving.
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post by MadRat »

Do units refuse to move when there is no energy?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

No. Which is a major flaw, but meh.
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Post by SpikedHelmet »

Is there a way to fix that via script? Or, simply, add a "NeedEnergy" tag feature added to Spring.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Read my post you crazy fool! :P
SpikedHelmet
MC: Legacy & Spring 1944 Developer
Posts: 1948
Joined: 21 Sep 2004, 08:25

Post by SpikedHelmet »

I mean fix what Argh pointed out, that units stop moving when no energy.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Oh. No not easily.
User avatar
aGorm
Posts: 2928
Joined: 12 Jan 2005, 10:25

Post by aGorm »

Which is realy annoying as somthing I wanna do in my mod will depend on that being the case... :(

aGorm
User avatar
MadRat
Posts: 532
Joined: 24 Oct 2006, 13:45

Post by MadRat »

How hard would it be to just apply maximum brake rate whenever energy runs empty?
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

I'm working on this issue now.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

You cannot know the ressource situation from within the script AFAIK.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Actually, you can, and units do... and as my thread about Spring's economy shows, I've even written a BOS that works... when the economy code actually hits zero :P

Units that use M/E call Activate() Deactivate() in the COB code.

But, here's more from Unit.cpp:

Code: Select all

	if(unitDef->activateWhenBuilt)
	{
		Activate();
	}

Code: Select all

void CUnit::Activate()
{
	//if(unitDef->tidalGenerator>0)
	//	cob->Call(COBFN_SetSpeed, (int)(readmap->tidalStrength*3000.0f*unitDef->tidalGenerator));

	if(activated)
		return;
	activated = true;

	cob->Call(COBFN_Activate);

	if(unitDef->targfac){
		radarhandler->radarErrorSize[allyteam]/=radarhandler->targFacEffect;
	}
	if(hasRadarCapacity)
		radarhandler->MoveUnit(this);

	if(unitDef->sounds.activate.id)
		sound->PlayUnitActivate(unitDef->sounds.activate.id, this, unitDef->sounds.activate.volume);
}

And when I'm done fixing the economy code, it will work a lot more smoothly.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

Since when do units call Activate/Deactivate when out of energy? I've never seen that happen.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Try out a Metal Maker. Run your Energy dry.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Post by FLOZi »

Indeed. I should have thought of that. :cry:
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

It doesn't deactivate. It stops producing metal but if Deactivate() was called it'd close.
Post Reply

Return to “Game Development”