Author Topic: Modular Mainhall.tbl  (Read 29312 times)

0 Members and 1 Guest are viewing this topic.

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
From working on my mainhalls, I've obviously been doing a lot with the mainhall.tbl. Currently I have 4 working mainhalls with several more on the way. Ideally, I'd be able to release them as a simple drag and drop VP file.. one for each mainhall. The problem is that the mainhall.tbl isn't modular so that makes it much harder to people to add new mainhalls to any given mod. I'm pretty sure I've had passing discussions about this with various coders, but it's been so long that I can't remember who or what was said. So, I wanted to type out my thoughts on how this might work and see what is or isn't possible from the coders... and hopefully find someone who is willing to try and make it happen (probably after .14 is out).

So, the mainhall table is index based starting with 0 and going up to X (There is a limit to the number of mainhalls that can be loaded and I don't know it off the top of my head). My guess is that is going to be the first hurdle. How do you have FSO organize the indexes without breaking retail while still using modular tables? A solution I thought of was using an optional +Index flag (Required in TBMs but not in TBLs?). Basically, the TBL would parse first and those mainhalls be indexed like normal. Then TBMs are parsed and the mainhalls added to the index number specified. You could use this to override mainhalls in the TBL if necessary. If an index is skipped, the engine should pop up a warning. Then also, an '+Index: -1' (or no +Index?) simply adds the new mainhall from the TBM into the next available Index.

The other hurdle is the mainhall limit. I don't think the limit needs to be removed or extended.. I'm pretty sure that it's high enough that no mod should ever go over it. But the question is, what should FSO do if it encounters enough TBMs that pushes the limit? I'd say throw up a Warning and drop the last mainhall until it's back under the index.

EDIT: Looks like the limit is 10. So perhaps bumping that to something like 20 or 25?

Mainhalls are referenced in campaign files by index number so it seems that the challenge is to get FSO to load mainhalls from a tbm and order them into the same index structure.

The way the mainhall.tbl works.. it seems like the work involved should be similar to ships and weapons tables where it's mostly about adding new entries to the end of the list and the rest of the flags are only important for each individual entry. Except that the mainhalls probably affect a much smaller portion of the engine.

Am I forgetting something? What are some thoughts here? Are there issues I don't know about? Or is there a better way of doing this?

EDIT: Here is an example mainhall.tbl for those not familiar with what it looks like.
« Last Edit: October 31, 2011, 01:50:01 pm by mjn.mixael »
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline Droid803

  • Trusted poster of legit stuff
  • 213
  • /人 ◕ ‿‿ ◕ 人\ Do you want to be a Magical Girl?
    • Skype
    • Steam
+Index would work well - you'd be able to control which to overwrite when changing existing entires in the base table as well as append on afterwards with it. :yes:

Like with the sections in $Beaminfo.
(´・ω・`)
=============================================================

 

Offline CommanderDJ

  • Software engineer
  • 210
    • Minecraft
IIRC, the function that parses tables and modular tables is the same for the ones currently in the code, so I don't think that you can treat tbls and tbms differently (that said, there's nothing stopping whoever writes the code for this to create a new function just for modular mainhall tables). It should be doable with just one function, and the index thing sounds like a good idea.

If nobody else has looked at this by the time my exams are over, I might have a gander at it.
[16:57] <CommanderDJ> What prompted the decision to split WiH into acts?
[16:58] <battuta> it was long, we wanted to release something
[16:58] <battuta> it felt good to have a target to hit
[17:00] <RangerKarl> not sure if talking about strike mission, or jerking off
[17:00] <CommanderDJ> WUT
[17:00] <CommanderDJ> hahahahaha
[17:00] <battuta> hahahaha
[17:00] <RangerKarl> same thing really, if you think about it

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Point. There probably doesn't need to be a new function to parse TBLs and TBMs differently if the +Index flag is optional anyway, right?

The TBL would parse and those mainhalls would get dropped in indexes 0-X if they don't have +Index. (Thinking of retail here.) That preserves retail compatibility. Then the TBMs and get dropped in indexes (X+1)-Y.

Then if ANY entry (in a TBM or TBL) has +index, it gets dropped into that specific index replacing whatever is there.

Then just create some warnings to warn the modder when they skipped an index because of +Index (IE: They have 4 mainhalls total, but one of their +Indexes is set to 8) and when they have more mainhalls than the limit will allow.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Suppose you then end up with five TBMs specifying indexes 0, 1, 2, 2, and 7?  And then suppose the campaign file makes reference to index 5?

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
I'd say if an index specified skips over numbers, it should display a warning? Or perhaps autobump it to the highest available index that doesn't skip?

EX: You have five TBMs specifying indexes 0, 1, 2, 3, and 7.. The game gets to 7 and pops up a warning, then switches 7 to 4.

As for the duplicate 2s.. I'd think it'd be as simple as the latest 2 overwrites the previous 2.

As for the mainhall calling for 5 when 5 doesn't exist.. it should do what FSO currently does.. drop a warning and use index 0.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline CommanderDJ

  • Software engineer
  • 210
    • Minecraft
I think both should happen. Tell the modder they've screwed up but compensate for it so the game doesn't **** bricks. Defensive programming.

With the duplicate 2s, you've got two options (worth considering, that is): either replace the old 2 with the new like you said... or bump the duplicate to index 3 and go on from there (obviously dropping warnings in both cases). Main problem I see with the latter is that the game wouldn't know to compensate for the upped index, right? It would still search for the mainhall with index 2 but would find the old one. At least that's my understanding, I haven't looked at that part of the code in detail.
[16:57] <CommanderDJ> What prompted the decision to split WiH into acts?
[16:58] <battuta> it was long, we wanted to release something
[16:58] <battuta> it felt good to have a target to hit
[17:00] <RangerKarl> not sure if talking about strike mission, or jerking off
[17:00] <CommanderDJ> WUT
[17:00] <CommanderDJ> hahahahaha
[17:00] <battuta> hahahaha
[17:00] <RangerKarl> same thing really, if you think about it

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
I suggest going with the replace method. That way if we get into a situation where we have a tbm in one mod. Then we have another mod that is using the first as a dependancy that also has a tbm. The latter can replace mainhalls in the former using replacement +index numbers.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline CommanderDJ

  • Software engineer
  • 210
    • Minecraft
Makes sense to me.  :yes:
[16:57] <CommanderDJ> What prompted the decision to split WiH into acts?
[16:58] <battuta> it was long, we wanted to release something
[16:58] <battuta> it felt good to have a target to hit
[17:00] <RangerKarl> not sure if talking about strike mission, or jerking off
[17:00] <CommanderDJ> WUT
[17:00] <CommanderDJ> hahahahaha
[17:00] <battuta> hahahaha
[17:00] <RangerKarl> same thing really, if you think about it

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
I think it would be better if we added the ability to specify main hall names.  That would be clearer and wouldn't depend on the order the tbms were loaded.

 

Offline CaptJosh

  • 210
Makes sense to me, Goober. The retail behavior remains in place, but an additional feature is there for modders. A clean and simple solution. That just leaves the question of how easy it is to code this simple solution. After all, simple and easy are two different things.
CaptJosh

There are only 10 kinds of people in the world;
those who understand binary and those who don't.

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
See, but wouldn't referencing mainhalls by name would require a change in how campaign files work.. and likely pilot files too?
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline CommanderDJ

  • Software engineer
  • 210
    • Minecraft
And don't forget the campaign editor in FRED. And if you change that, according to some you'd also have to change any documentation such as the FRED walkthrough that reference it.
[16:57] <CommanderDJ> What prompted the decision to split WiH into acts?
[16:58] <battuta> it was long, we wanted to release something
[16:58] <battuta> it felt good to have a target to hit
[17:00] <RangerKarl> not sure if talking about strike mission, or jerking off
[17:00] <CommanderDJ> WUT
[17:00] <CommanderDJ> hahahahaha
[17:00] <battuta> hahahaha
[17:00] <RangerKarl> same thing really, if you think about it

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
Which is why I think going with indexes will be more than enough.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.

 

Offline CaptJosh

  • 210
And this sort of thing is why I distinguish between simple and easy.
CaptJosh

There are only 10 kinds of people in the world;
those who understand binary and those who don't.

 

Offline CommanderDJ

  • Software engineer
  • 210
    • Minecraft
Yeah. I've spoken with The_E, who believes that making the number of mainhalls dynamic is necessary before further work, and I'd agree, as the current implementation wastes a fair bit of memory. However, once this is done it will mean that using index numbers to identify mainhalls will no longer be a reliable method, and that using another identifier such as a name per Goober's suggestion is a much more elegant solution. It will require more work and I likely won't be able to do it on my own (though I'm certainly willing to help where I can), but personally I'm for it as it ultimately leads to better and cleaner code in the long run.
[16:57] <CommanderDJ> What prompted the decision to split WiH into acts?
[16:58] <battuta> it was long, we wanted to release something
[16:58] <battuta> it felt good to have a target to hit
[17:00] <RangerKarl> not sure if talking about strike mission, or jerking off
[17:00] <CommanderDJ> WUT
[17:00] <CommanderDJ> hahahahaha
[17:00] <battuta> hahahaha
[17:00] <RangerKarl> same thing really, if you think about it

 

Offline CaptJosh

  • 210
The issue with that is the index numbers of 0 through 9 have to remain usable for retail compatibility. So something has to be done to retain that, but perhaps that code can be cleaned up to use less memory.
CaptJosh

There are only 10 kinds of people in the world;
those who understand binary and those who don't.

  

Offline The E

  • He's Ebeneezer Goode
  • Moderator
  • 213
  • Nothing personal, just tech support.
    • Steam
    • Twitter
Not as large an issue as you may think. As of now, mainhalls are only identified by their index, there's no "Name" field available. As such, if no name is defined, the index can be used as that namehall's "name".
If I'm just aching this can't go on
I came from chasing dreams to feel alone
There must be changes, miss to feel strong
I really need lifе to touch me
--Evergrey, Where August Mourns

 

Offline CaptJosh

  • 210
True, but the index itself is not defined in the table. This all needs more thinking about, because it all has to be, as you mentioned on IRC, The_E, backward compatible and transparent to all involved.
CaptJosh

There are only 10 kinds of people in the world;
those who understand binary and those who don't.

 

Offline mjn.mixael

  • Cutscene Master
  • 212
  • Chopped liver
    • Steam
    • Twitter
But the game could continue to parse the index like it always has and then set that index number as the name.
Cutscene Upgrade Project - Mainhall Remakes - Between the Ashes
Youtube Channel - P3D Model Box
Between the Ashes is looking for committed testers, PM me for details.
Freespace Upgrade Project See what's happening.