Lua Unit Defs vs tdfs

Lua Unit Defs vs tdfs

Classic game design, maintained to please you...

Moderator: Content Developer

User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Lua Unit Defs vs tdfs

Post by TradeMark »

Regret wrote:Devise a more readable unitname pattern. (f.e. ARMGEO becomes ARM_GeoPowerplant, armflash -> ARM_Flash)
i hate you. :regret: they did that in XTA, and it fucking sucks ass. its much faster to write "armacv" than "arm_adv_construction_vehicle" you obv never used Modinfo: http://modinfo.adune.nl/index.php?MOD=xtapev955 hahhahaha "core_cloakable_fusion_power_plant" :roll: have fun testing your maps when you need to re-learn every unit name and the writing of them will take 10 times longer, advantages: none. normal players doesnt need to know those unitnames, if the lobby clients sucks so hard they forces players to remember unitnames to disable units, then thats shitty lobby clients problem. typical CA thinking: if it looks good, it must be good idea. oh fuck.
Regret wrote:Convert all unit .fbi files to organized .lua files. (autoconvert -> manual cleanup)
why the fuck? what advantages this gives? just because CA did it, it doesnt mean its good idea. converting mod files into scripts just makes it harder to read the mod by other programs than Spring.exe itself: i cant add CA to Modinfo page for that reason. (nobody has bothered to make complete lua widget to read the mod files and save as TXT).
Last edited by TradeMark on 25 Feb 2010, 00:18, edited 1 time in total.
Saktoth
Zero-K Developer
Posts: 2665
Joined: 28 Nov 2006, 13:22

Re: Balanced Annihilation Reloaded

Post by Saktoth »

Regret wrote:So after some thinking about the feasibility of this project:

There are currently 367 units used in BA. From some looking around I think there are at most 50 units already remodeled / completed. So around 317 units would need to be remodeled / textured / scripted.

For each unit there is a wreck, except for air (42 units) and some miscellaneous units like mines etc. That's around 315 wrecks.

>_>

I think it would be good to cut BA into smaller parts that would be remade, starting with Arm T1 Vehicles (without amphi units).
This depends on quality and consistency, regret.

You could replace all the models, if you borrow judiciously from the OTA remodelling projects that use 3do's, other third party 3do models, and replace all the textures with origional ones (There are plenty of packs that do this, including CA's).

Arm veh is not the best to start with, since core veh has all the models.
TradeMark wrote:typical CA thinking: if it looks good, it must be good idea. oh fuck.
Groan, what are you talking about, CA hasnt changed its unitnames, other than a few misguided efforts by Car. So, typical XTA thinking..?
TradeMark wrote:why the fuck? what advantages this gives? just because CA did it, it doesnt mean its good idea. converting mod files into scripts just makes it harder to read the mod by other programs than Spring.exe itself: i cant add CA to Modinfo page for that reason. (nobody has bothered to make complete lua widget to read the mod files and save as TXT).
Lua looks like this:
acceleration = 0,
activateWhenBuilt = true,
bmcode = [[0]],
buildCostEnergy = 2600,
builder = false,
buildPic = [[ARMANNI.png]],

fbi's look like this:
acceleration = 0;
activateWhenBuilt = 1;
bmcode = 0;
buildCostEnergy = 2600;
builder = 0;
buildPic = ARMANNI.png;

???

You're under no obligation to fix modit but its just a minor difference in formatting.
Regret
Posts: 2086
Joined: 18 Aug 2007, 19:04

Re: Balanced Annihilation Reloaded

Post by Regret »

TradeMark wrote:advantages: none.
I find it much easier to start typing out whole/partial unit name and pressing tab than typing out/tabbing through semi-random 6-8 letter combinations.
TradeMark wrote:what advantages this gives?
Lua scripts offer more flexibility and can contain weapon defs of units in unit files. And I'm expecting support for .fbi files to be dropped as Spring develops.
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Balanced Annihilation Reloaded

Post by TradeMark »

Saktoth wrote:You're under no obligation to fix modit but its just a minor difference in formatting.
lua can have for loops, multipliers, anything, ive seen CA lua files enough and decided i would need to write lua interpreter on PHP to be able to read the files perfectly.

CA devs uses .lua files because they are too lazy to write a program that does the same for FBI files to change multiple values at once etc.

IMO there should be just one program you read the mod, and modify the mod values, not creating messed up lua codes inside the lua files to do complex calculations to all specific values like unit corpses metal costs etc.
Regret wrote: than typing out/tabbing through semi-random 6-8 letter combinations.
they are not random when you learn the logic, some of them are bad i agree, those could be fixed though. mostly they are very logical names.
Regret wrote:Lua scripts offer more flexibility and can contain weapon defs of units in unit files
modit can show weapon defs along units... whats the point doing that in one file anyways, since you can have same weapon for multiple units? just make the damn program like Modit that does all that shit for you.

Its pointless to create scripted files just because you were too lazy to make Modit at the first place... its soo easy to just click unit and change values, and you see corpses weapons unitpics etc all the same time (CAN LUA DO THIS? LOL!)

I find it disgusting to use lua as an IDE.
Google_Frog
Moderator
Posts: 2464
Joined: 12 Oct 2007, 09:24

Re: Balanced Annihilation Reloaded

Post by Google_Frog »

Lua can have loops but unit defs do not have loops, each unit is an array. Copy the lua unitdef interpreting code from CAEdit or Spring if you really want to read them for modit.

Lua has the advantages of sticking all the unit info in spot(wreck, weapons), CAEdit for mass unit edits and, as Regret said, a future in compatibility.
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Balanced Annihilation Reloaded

Post by TradeMark »

Google_Frog wrote:Lua can have loops but unit defs do not have loops, each unit is an array. Copy the lua unitdef interpreting code from CAEdit or Spring if you really want to read them for modit.
when i last time watched CA lua files, they had some global lua file that readed some other lua file data and reformatted it with fancy multipliers etc. thats when i stopped trying to do the lua reader.

i dont just need unit files, thats only 1 thing out of 20 i have in Modit.

Code: Select all

local armorDefs = {
  
  SUBS = {
    "armsub",
    "corsub",
    "armsubk",
    "corshark",
    "tawf009",
    "corssub",
    "armacsub",
    "coracsub",
    "armrecl",
    "correcl",
  },
...
}



 -- add anything that can fly to the PLANES category
for name, ud in pairs(DEFS.unitDefs) do
  if (tobool(ud.canfly)) then
    table.insert(armorDefs.PLANES, name)
  end
end

 -- put any unit that doesn't go in any other category in ELSE
for name, ud in pairs(DEFS.unitDefs) do
  local found
  for categoryName, categoryTable in pairs(armorDefs) do
    for _, usedName in pairs(categoryTable) do
      if (usedName == name) then
        found = true
      end
    end
  end
  if (not found) then
    table.insert(armorDefs.ELSE, name)
  end
end
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

-- convert to named maps  (does anyone know what 99 is for?  :)

for categoryName, categoryTable in pairs(armorDefs) do
  local t = {}
  for _, unitName in pairs(categoryTable) do
    t[unitName] = 99
  end
  armorDefs[categoryName] = t
end

Code: Select all

local moveDefs = {

	KBOT1 = {
		footprintx = 1,
		footprintz = 1,
		maxwaterdepth = 15,
		maxslope = 36,
		crushstrength = 5,
	},
...

}


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

-- convert from map format to the expected array format

local array = {}
local i = 1
for k,v in pairs(moveDefs) do
	array[i] = v
	v.name = k
	i = i + 1
end

Code: Select all

local function ProcessUnitDef(udName, ud)

  local wds = ud.weapondefs
  if (not istable(wds)) then
    return
  end

  -- add this unitDef's weaponDefs
  for wdName, wd in pairs(wds) do
    if (isstring(wdName) and istable(wd)) then
      local fullName = udName .. '_' .. wdName
      WeaponDefs[fullName] = wd
      wd.filename = ud.filename
    end
  end

  -- convert the weapon names
  local weapons = ud.weapons
  if (istable(weapons)) then
    for i = 1, 16 do
      local w = weapons[i]
      if (istable(w)) then
        if (isstring(w.def)) then
          local ldef = string.lower(w.def)
          local fullName = udName .. '_' .. ldef
          local wd = WeaponDefs[fullName]
          if (istable(wd)) then
            w.name = fullName
          end
        end
        w.def = nil
      end
    end
  end
  
  -- convert the death explosions
  if (isstring(ud.explodeas)) then
    local fullName = udName .. '_' .. ud.explodeas
    if (WeaponDefs[fullName]) then
      ud.explodeas = fullName
    end
  end
  if (isstring(ud.selfdestructas)) then
    local fullName = udName .. '_' .. ud.selfdestructas
    if (WeaponDefs[fullName]) then
      ud.selfdestructas = fullName
    end
  end
  
end

Code: Select all

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
--
-- Fix the canAttack tag
--

do
  local processed = {}

  local RawCanAttack
  local FacCanAttack
  local CanAttack

  RawCanAttack = function(ud)
    if (ud.weapons) then
      for i, weapon in pairs(ud.weapons) do
        local wd = WeaponDefs[weapon.name:lower()]
        if ((not wd.isshield) and 
            (not wd.interceptor)) then
          return true
        end
      end
    end
    if (ud.kamikaze) then
      return not ud.yardmap
    end
    return false
  end

  FacCanAttack = function(ud)
    for _, name in pairs(ud.buildoptions) do
      if (CanAttack(UnitDefs[name:lower()])) then
        return true
      end
    end
    return false
  end

  CanAttack = function(ud)
    if (processed[ud] ~= nil) then
      return processed[ud]
    end
    local canAttack = false
    if (RawCanAttack(ud)) then
      canAttack = true
    elseif (ud.tedclass == 'PLANT') then
      if (FacCanAttack(ud)) then
        canAttack = true
      end
    end
    processed[ud] = canAttack
    return canAttack
  end

  -- loop through the unit defs
  for name, ud in pairs(UnitDefs) do
    ud.canattack = CanAttack(ud)
  end
end

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

Code: Select all

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Calculate mincloakdistance based on unit footprint size
--

local sqrt = math.sqrt

for name, ud in pairs(UnitDefs) do
  if (not ud.mincloakdistance) then
    local fx = ud.footprintx and tonumber(ud.footprintx) or 1
    local fz = ud.footprintz and tonumber(ud.footprintz) or 1
    local radius = 8 * sqrt((fx * fx) + (fz * fz))
    ud.mincloakdistance = (radius + 48)
  end
end

Code: Select all

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Special Air
--

if (modOptions and tobool(modOptions.specialair)) then
  local replacements = VFS.Include("LuaRules/Configs/specialair.lua")
  if (replacements[modOptions.specialair]) then
    replacements = replacements[modOptions.specialair]
    for name, ud in pairs(UnitDefs) do
      if (ud.buildoptions) then
        for buildKey, buildOption in pairs(ud.buildoptions) do
          if (replacements[buildOption]) then
            ud.buildoptions[buildKey] = replacements[buildOption];
          end
        end
      end
    end
  end
end
>_> "Fix the canAttack tag" nuff said.

I would do parser for those specific formats, but who the fuck says everyone will do it exactly like CA? Thats my fucking point here, we need 1 format that everyone uses, no lua shit that creates its own format because they think lua = IDE.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Balanced Annihilation Reloaded

Post by CarRepairer »

TradeMark wrote:
Regret wrote:Convert all unit .fbi files to organized .lua files. (autoconvert -> manual cleanup)
why the fuck? what advantages this gives? just because CA did it, it doesnt mean its good idea. converting mod files into scripts just makes it harder to read the mod by other programs than Spring.exe itself: i cant add CA to Modinfo page for that reason. (nobody has bothered to make complete lua widget to read the mod files and save as TXT).
TradeMark wrote:
Saktoth wrote:You're under no obligation to fix modit but its just a minor difference in formatting.
lua can have for loops, multipliers, anything, ive seen CA lua files enough and decided i would need to write lua interpreter on PHP to be able to read the files perfectly.

CA devs uses .lua files because they are too lazy to write a program that does the same for FBI files to change multiple values at once etc.

IMO there should be just one program you read the mod, and modify the mod values, not creating messed up lua codes inside the lua files to do complex calculations to all specific values like unit corpses metal costs etc.
Regret wrote:Lua scripts offer more flexibility and can contain weapon defs of units in unit files
modit can show weapon defs along units... whats the point doing that in one file anyways, since you can have same weapon for multiple units? just make the damn program like Modit that does all that shit for you.

Its pointless to create scripted files just because you were too lazy to make Modit at the first place... its soo easy to just click unit and change values, and you see corpses weapons unitpics etc all the same time (CAN LUA DO THIS? LOL!)

I find it disgusting to use lua as an IDE.
Devs want to use lua in their mod
- It saves them time
- It would take you time to rewrite modinfo.

You want them to use FBI format
- Takes them more time
- Saves you the work of rewriting modinfo.

Conclusion: they are lazy for doing less work, but you are smart for doing less work.

Modinfo is purely for developers anyway, it's not for players at all. A nice looking page can be generated from lua unit files for players as seen here http://trac.caspring.org/wiki/UnitGuide
User avatar
JohannesH
Posts: 1793
Joined: 07 Apr 2009, 12:43

Re: Balanced Annihilation Reloaded

Post by JohannesH »

CarRepairer wrote:Modinfo is purely for developers anyway, it's not for players at all. A nice looking page can be generated from lua unit files for players as seen here http://trac.caspring.org/wiki/UnitGuide
No
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Balanced Annihilation Reloaded

Post by CarRepairer »

JohannesH wrote:
CarRepairer wrote:Modinfo is purely for developers anyway, it's not for players at all. A nice looking page can be generated from lua unit files for players as seen here http://trac.caspring.org/wiki/UnitGuide
No
Vague. No to what?

No, Modinfo is for players? I disagree, it's hundreds of tiny numbers and statistics and ugly internal names like armrl.

No, you feel my page is not very nice looking? It could be made prettier but that's not the point.
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Balanced Annihilation Reloaded

Post by TradeMark »

CarRepairer wrote:and ugly internal names like armrl.
last time i checked it shows unit names and unit descriptions too, you dont have to stare those internal names to confuse yourself.
CarRepairer wrote:No, you feel my page is not very nice looking? It could be made prettier but that's not the point.
your page sucks compared to modinfo IMO. you put every unit on one single page and expect anyone to read those descriptions of the units which are probably outdated after 3000 changes made to CA.

If you want to make unit guide, make a starting tutorial for CA, in game. nobody has time to read all that text you wrote there.
you feel my page is not very nice looking
nice looking != good in use. again typical CA thinking >_>

Also one thing your page fails at is that you use different images for the units than what they look like in game, (or do they really look that cartoonish?)

Edit2: "Cost 1,200 " wth, does CA have only 1 resource these days?
Last edited by TradeMark on 23 Feb 2010, 19:12, edited 2 times in total.
User avatar
JohannesH
Posts: 1793
Joined: 07 Apr 2009, 12:43

Re: Balanced Annihilation Reloaded

Post by JohannesH »

Modinfo has alot of important stats that CA page doesnt have. AoE/edgeeffectiveness, turn/accel/decelarationrates, sightdistances, resource drains of different units, special damages etc... Those are just as useful as stuff displayed on CA guide. Even if most of the time looking at stats wont make you play better.

Ok some of those arent needed in CA, but you get the point

Also its really hard to find the unit youre looking for on CA page.
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Balanced Annihilation Reloaded

Post by Pxtl »

@ TradeMark

He said the CA unitguide was autogenerated from CA. So no, the info isn't out of date. I've found the CA unit guide very helpful, personally. It would be nice if you could drill down for more info, but otherwise the CA unit guide has the appropriate amount of material for a game. If you need more info than that, then it's likely the unit is too complicated.

The fact that the main source for unit info in BA is Modinfo is a bug in BA, not a feature.
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Balanced Annihilation Reloaded

Post by TradeMark »

Pxtl wrote:He said the CA unitguide was autogenerated from CA. So no, the info isn't out of date.
he autogenerates the descriptions of units? lol no
User avatar
Pxtl
Posts: 6112
Joined: 23 Oct 2004, 01:43

Re: Balanced Annihilation Reloaded

Post by Pxtl »

The units roles stay the same, and have been teh same for quite some time. So the descriptions are static, yes. And quite accurate. Only thing inaccurate is the model pictures, as those often change.

Edit2: "Cost 1,200 " wth, does CA have only 1 resource these days?

No, but the E, M, and BT for all units are the same. So you only need 1 cost attribute.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Balanced Annihilation Reloaded

Post by CarRepairer »

TradeMark wrote:
CarRepairer wrote:and ugly internal names like armrl.
last time i checked it shows unit names and unit descriptions too, you dont have to stare those internal names to confuse yourself.
Why show internal names at all (of units, weapons, etc)? Because it's a page for modders, not for players. Websites about Starcraft don't show underlying code.
TradeMark wrote:your page sucks compared to modinfo IMO. you put every unit on one single page and expect anyone to read those descriptions of the units which are probably outdated after 3000 changes made to CA.
It's autogenerated from the mod.
TradeMark wrote:If you want to make unit guide, make a starting tutorial for CA, in game. nobody has time to read all that text you wrote there.
lol, people have no time for my unit guide but they have time to read your modinfo which is 400x larger? Logic?
TradeMark wrote:Also one thing your page fails at is that you use different images for the units than what they look like in game, (or do they really look that cartoonish?)
Those are the buildpics, which are shown in the game using tooltips for immediate association.
TradeMark wrote:Edit2: "Cost 1,200 " wth, does CA have only 1 resource these days?
It has two resources but only one is relevant for building.
JohannesH wrote:Also its really hard to find the unit youre looking for on CA page.
There's a table of contents on the top right for clicking by factory. Or press ctrl+F and type gator.
TradeMark wrote:
Pxtl wrote:He said the CA unitguide was autogenerated from CA. So no, the info isn't out of date.
he autogenerates the descriptions of units? lol no
Yes. Those descriptions are inside the unit file in the mod. They also can be seen in the game by space-clicking on the unit or buildpic.

You see there is a lot of stuff you don't know before poking fun at CA and lua this entire thread. I am just setting the record straight.
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Balanced Annihilation Reloaded

Post by TradeMark »

if you feel you are just a player, i made a page for such users too:
http://modinfo.adune.nl/?act=buildtree&MOD=ba71

Point each unit with mouse for a second to see tiny information about them.

--

unit internal names are visible because they are very essential part of the game: cheats needs them.

"You see there is a lot of stuff you don't know before poking fun at Modinfo/Spring and this entire thread. I am just setting the record straight."
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Balanced Annihilation Reloaded

Post by CarRepairer »

I was completely polite and said nothing bad about modinfo, it's a great page. I just said it's an info tool for modders and not players, since you are using it as an argument to bash the use of lua in Spring mod development. Using lua is far superior for modding and if modinfo is your only argument as to why someone shouldn't use lua, that modder doesn't need modinfo anyway.

You can't tell me cheat codes are an argument either because cheatcodes in any game are a feature used for development. If players desire cheat codes, that's fine but they are going beyond the realm of what's intended for a regular player. Also, it's wise to name units more logically. Missile Tower = armrl makes no sense. And still it's possible to give all the internal names that match human names, despite your arguments earlier against XTA (good for them for taking the initiative, I've been trying to convince CA to do that).
User avatar
JohannesH
Posts: 1793
Joined: 07 Apr 2009, 12:43

Re: Balanced Annihilation Reloaded

Post by JohannesH »

CarRepairer wrote:Also, it's wise to name units more logically. Missile Tower = armrl makes no sense.
Its just that all the thousands of people who have armrl binded have to open their uikeys.txts and change... And theres no real benefit in changing it to something that "makes sense".
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Balanced Annihilation Reloaded

Post by CarRepairer »

JohannesH wrote:
CarRepairer wrote:Also, it's wise to name units more logically. Missile Tower = armrl makes no sense.
Its just that all the thousands of people who have armrl binded have to open their uikeys.txts and change... And theres no real benefit in changing it to something that "makes sense".
This was a point made responding to his statement that the "essential part of the game" of cheatcodes is why players would need modinfo and I'm saying that it's flawed to have these strange internal names in the first place. But I don't disagree with you that changing the names now would hurt players.
User avatar
TradeMark
Posts: 4867
Joined: 17 Feb 2006, 15:58

Re: Balanced Annihilation Reloaded

Post by TradeMark »

yeah that too... change the internal names and fuck up all scripts :d
Post Reply

Return to “Balanced Annihilation”