My Metal Maker Widget v2.62 (for .75b1)

My Metal Maker Widget v2.62 (for .75b1)

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

My Metal Maker Widget v2.62 (for .75b1)

Post by TheFatController »

Efficiency Based Metal Maker Control
------------------------------------------

Automatically takes command of your metal makers even after '.take'. This widget keeps your energy hovering at a specified level by turning your metal makers on and off, using the most efficient ones first (eg. moho metal makers).

Written to be non-mod specific it will take command of any units that make metal, drain energy and can be turned on or off, with no hard coded energy values. Tested with CA, BA and XTA with good results.

Features
----------

/luaui energyhover 0.5 - Sets the desired energy percent for the widget to aim for (default 50%).
/luaui forcestall - Turns on all your metal makers regardless of other energy use until you estall then resumes normal operation.

Coming Soon! - GUI control for the above operations

Change Log
--------------

2.62 - Fixed bug in 6.1 that was sending too many commands too often (bad for netcode)
2.61 - Fixed a huge bug where only your commanders energy use was taken into account (that'll teach me to talk so fast!)
2.60 - Okay so I rushed 2.5 and it had a lot of bugs, 2.6 actually comes with lots more improvements after a hard evenings work, back to the high standard of my metal maker widget. Enjoy!
2.50 - Fully compatable with new spring .75, plus other improvements along the way from Jk
2.40 - Compatibility with SVN spring alphas and stuff
2.32 - Fixed the fact that 2.31 didn't run at all ¬_¬ gg for not testing code before uploading
2.31 - Ironed out some bugs with both the energy tweaks and efficiency, should be fine now!
2.30 - Lots of code tweaks for FPS improvements thanks to [LCC]Jk!
2.30 - Several tweaks to energy handling code
2.20 - Update timer no longer changes based on your FPS, meaning more reliable MM control
2.20 - Improved energy handling when energy is far above hover percent + other tweaks.
2.12 - No longer uses isMetalMaker to detect metal makers (didn't work for CA).
2.11 - Improved energy handling.
2.10 - Almost entirely rewritten to use lua tables properly, no more forced pointer system or fishy sort function. Now almost 100 lines of code shorter and probably better CPU usage.
2.10 - Added command /luaui energyhover to set the percent of energy bar to aim for.
2.10 - Added command /luaui forcestall to force on all metal makers temporarily.


Image

Install Guide: http://pw3n.net/my_metal_maker_widget_installation.html

Please report any bugs to me via the lobby or forum

-TheFatController
Last edited by TheFatController on 17 Jul 2007, 02:45, edited 16 times in total.
mongus
Posts: 1463
Joined: 15 Apr 2005, 18:52

Post by mongus »

testing.
mongus
Posts: 1463
Joined: 15 Apr 2005, 18:52

Post by mongus »

Code: Select all

error = 1, Call_UpdateLayout, LuaUI\Widgets\unit_metal_maker.lua:96: table index is nil 
1000 times.

mod xta v8.1

Also, the metal makers seem not to be using any energy.

but still generating metal.

Is this possible?

e: i was cheating and using .nocost thats why the error i assume.

a second test without it.. works... for some seconds, then it breaks.

Seems to "engage" when there is any energy use going on, like when commander is building something.

but after that it stops working and you start bleeding energy.

the test i made using 2 solars and 5 makers. xta 8.1

e2: i got it now. it was the metal limit, when you are full of metal, it turns off automatically nice.


However.. it does not take into account the moho metal extractors.

In xta the 2 metal makers aviable have the same efficiency, ((metal produced) / energy). The benefit of the moho ones is you need les space to fit them, and are like 20x the small ones.


Also in xta, the moho metal extractors, use up a fair ammount of energy (-300) to extract the metal, so its a major concern to optimize energy usage between moho metal extractors and the makers (which is what your widget does).

In short, if you can add the moho metal makers to this group, would be great for xta players.


The widget is working flawless so far, after my fist dumb tests, kudos.
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Post by TheFatController »

mongus wrote:

Code: Select all

error = 1, Call_UpdateLayout, LuaUI\Widgets\unit_metal_maker.lua:96: table index is nil 
1000 times.

mod xta v8.1

Also, the metal makers seem not to be using any energy.

but still generating metal.

Is this possible?

e: i was cheating and using .nocost thats why the error i assume.
I just tried a .nocost game and it didn't break, although .nocost seems to strip the energy cost from metalmakers and probably does other funny things to the mod, if i cant recreate it or it requires lots of extra code nocost wont be supported (who'd make metalmakers with nocost on anyway :p)
mongus wrote:However.. it does not take into account the moho metal extractors.

In xta the 2 metal makers aviable have the same efficiency, ((metal produced) / energy). The benefit of the moho ones is you need les space to fit them, and are like 20x the small ones.


Also in xta, the moho metal extractors, use up a fair ammount of energy (-300) to extract the metal, so its a major concern to optimize energy usage between moho metal extractors and the makers (which is what your widget does).

In short, if you can add the moho metal makers to this group, would be great for xta players.


I talked with []AF about this too and will probably implement it soon.
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Post by TheFatController »

Now fixed all performance / bug related issues bought to my attention or noticed by myself, anyone who downloaded plain version 2 should get 2.03..

http://spring.unknown-files.net/file/23 ... get_v2.03/

Change Log:

2.01 - Turns off widget if you're a spec (thanks MelTraX).
2.01b - Doesn't need turning on at the start of every game.
2.02 - Improved (fixed) handling of energy received from allies.
2.03 - Fixed some bugs with turning on the widget midgame, no longer crashes especially if you're midway through building a metalmaker
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Post by TheFatController »

2.04 should handle the bug reported in this post.

Let me know if it still ever ignores shared energy, I haven't been able to test this as much as usual cause noone's hosting good games tonight :p
User avatar
Acidd_UK
Posts: 963
Joined: 23 Apr 2006, 02:15

Post by Acidd_UK »

User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Post by TheFatController »

Bump for new version, please post any bugs or comments in this thread
User avatar
Dihi
Posts: 24
Joined: 13 Feb 2007, 23:01

Post by Dihi »

Giving it a try - will let you know of any problems. The last metal maker UI proved invaluable and any performance gain in the LUA is much appreciated. Keep it up :)
User avatar
ginekolog
Posts: 837
Joined: 27 Feb 2006, 13:49

Post by ginekolog »

i tried it and works good, better than orginal one. Much more steady flow and not much jumpings of E level.
User avatar
KDR_11k
Game Developer
Posts: 8293
Joined: 25 Jun 2006, 08:44

Post by KDR_11k »

I have one request: Can you make it display how much M you'd produce and how much E you'd use if all MMs were online? That way we can see when we have an E bottleneck or have surplus capacity we aren't using. In Gundam you have a constant resource usage for each factory which means you'll use the surplus to determine when to put another factory online and when half your MMs are offline you see a much lower number than you should and won't put as many factories online as you could.
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Post by TheFatController »

Updated post with 2.2, suggested upgrade for everyone (provided it works okay!).

As for the UI requests, I have been meaning to make a UI widget for it but at the moment I can't really be bothered as I wouldn't personally use it and opengl drawing stuff is a pain in the ass :P
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Post by TheFatController »

Bump for new version, suggested upgrade for everyone!


Comments please
YHCIR
Posts: 190
Joined: 12 Aug 2006, 23:06

Re: My Metal Maker Widget v2.62 (for .75b1)

Post by YHCIR »

Fantastic widget! I no longer have to reclaim my t1 makers as soon as I hit t2. I dunno how I missed this one.

A GUI would be awesome, a nice little slider to change the E target. Would also be good if you could have a toggle button so that when you have too much metal, you could swap between overproducing metal (to share M with allies) and overproducing E (sharing E with allies).
Maybe a second slider notch too, so that you can have a separate E target for such a situation. e.g. aim for 50% E normally, then when you get full of metal, aim for 90% E.
YHCIR
Posts: 190
Joined: 12 Aug 2006, 23:06

Re: My Metal Maker Widget v2.62 (for .75b1)

Post by YHCIR »

Does this take into account when you build energy storage?
I just played a game where I couldn't get the energyhover above about 1/3 E, it would drop down to 0.1 if I set it, but I couldn't set it up as high as 50%+, kept E stalling, with my MM on.
YHCIR
Posts: 190
Joined: 12 Aug 2006, 23:06

Re: My Metal Maker Widget v2.62 (for .75b1)

Post by YHCIR »

Just looked at the source and although both the version included in ba 6.81 and the latest version on here and on SD are 2.70.
the update time is slower in the version included in BA.
mmw_update = 1.25 (BA)
mmw_update = 1.0 (stand alone)

I guess using a faster update time may help the problems I am having? Gonna try it later.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: My Metal Maker Widget v2.62 (for .75b1)

Post by Gota »

No sliders please?
I have to say i haven't tested it yet but ill still ask this:
Do the converters turn on as soon as your energy goes beyond a certain percentage?
If that percentage is constant than can you please change it so that the percentage itself goes lower the more storage you have...
so if you have 10k E,converters will turn on after your bar filled up to 20%(as an example) but if you have 100k E storage,your converters would start working after your E bar is only 5% full.
It is not that big of a calibration,but I still think it's important for improved accuracy.
Would be ideal if this variable,which determines how much this percentage drops with E store increase would be easy to change as well.

--edited--
never mind
The point was to avoid a situation where your converters stop working at a storage percentage that leaves a lot of energy not converted(more than you need)...
Problem is that i don't really know at what rate the percentage of storage at which the converters start working should change,as you get more storage.
I Suppose this widget can be tailored to a mod by making it calculate the needed energy in storage to allow certain turrets to shoot constantly(like berthas) and also calculate in,a certain percentage of energy weapons you posses so they are able to shoot at the same time(in a situation where your berthas need to keep shooting but you also need to operate units using energy weapons or you need them to have e in storage so they can shoot immidetly as a target appears).
Last edited by Gota on 05 Feb 2009, 16:13, edited 1 time in total.
YHCIR
Posts: 190
Joined: 12 Aug 2006, 23:06

Re: My Metal Maker Widget v2.62 (for .75b1)

Post by YHCIR »

Gota wrote:No sliders please?
I have to say i haven't tested it yet but ill still ask this:
Do the converters turn on as soon as your energy goes beyond a certain percentage?
If that percentage is constant than can you please change it so that the percentage itself goes lower the more storage you have...
so if you have 10k E,converters will turn on after your bar filled up to 20%(as an example) but if you have 100k E storage,your converters would start working after your E bar is only 5% full.
It is not that big of a calibration,but I still think it's important for improved accuracy.
Would be ideal if this variable,which determines how much this percentage drops with E store increase would be easy to change as well.
From what I understand, it keeps your energy within the set percentage +/- 5%.
You set the percentage manually (/luaui energyhover 0.6) or use 1-99

I don't think it needs auto calibration, it just needs a slider to make it easier to change the target energy.

I just tested it again and it seems to work better, but I can't be 100% sure 'till I've played a few games.

What is the fastest update time I can set without breaking something?
User avatar
TheFatController
Balanced Annihilation Developer
Posts: 1177
Joined: 10 Dec 2006, 18:46

Re: My Metal Maker Widget v2.62 (for .75b1)

Post by TheFatController »

It's really only designed to function at 50% (energyhover is a bonus) however i'll look into the issue you described - haven't changed the code in this widget in months it was one of my first so i'm sure I can find improvements anyway.

The update at 1.0 is possibly too fast hence the increase in BA - I wouldn't advise setting it any faster than 1 second due to command spam possibly affecting the game.
User avatar
Gota
Posts: 7151
Joined: 11 Jan 2008, 16:55

Re: My Metal Maker Widget v2.62 (for .75b1)

Post by Gota »

Well imagine 50% of 100k...do you really need 50k in stock?
But i guess that its mostly negligible..
If you have 100k E storage it,in most cases,means you have an excellent eco and those 50-20k that are in stock but not used only translate to roughly 800 metal total,which at an advanced point in the game is really nothing..
Post Reply

Return to “Lua Scripts”