Normal M&B Module System for version 1.010

正在查看此主题的用户

Miclee 说:
Miclee 说:
Wooo! Armagan, what's the max amount of troops this thing can hold, now? Is it 1500+?
Anyone know, yet?

What exactly do you mean by max number of troops? In what?  :?:

It's your computer that decides how many troops you can have in a battle at once without lagging..  :???:
 
grailknighthero 说:
There is a max amount of troop_ids(module_troops) allowed in the game.


Oh.. Why? And how many was there in .960? ..  :?:
 
grailknighthero 说:
Just out of curiosity, what use do we have for bitwise functions?  Allows us to mess around with header file hex code more?

I use a lot of custom bitfields in Onin no Ran (example: you can set up quests with multiple intermediate goals, that aren't necessarily linear, without a whole bunch of global tracking variables), and I had to write bin->dec and dec->bin converters, plus code to breakout a bitfield (which was really a decimal number consisting of just 1's and 0's) into an array of 1's and 0's, and code to check the bit I wanted to look at. A huge, complicated suite of scripts. This is going cut all that down to two scripts: one to set/unset bits, and one to check if a bit is set:

插入代码块:
('toggle_bit',
    [
        (store_script_param,':flag',1),
        (store_script_param,':bit_num',2),
        (store_script_param,':operation',3),
        (try_begin),
            (eq,':operation',set_bit),
            (val_or,':flag',':bit_num'),
        (else_try),
            (val_sub,':flag',':bit_num'),
        (try_end),
        (assign,reg0,':flag'),
        ]
    ),
('check_bit',
    [
        (store_script_param,':flag',1),
        (store_script_param,':bit_num',2),
        (store_and,':result',':flag',':bit_num'),
        (try_begin),
            (gt,':result',0),
            (assign,reg0,true),
        (else_try),
            (assign,reg0,false),
        (try_end),
        ]
    ),
 
Porting is pretty easy. Finished the porting in around 1 hour with my mod. Still, I'm pretty good at organizing stuff.

Basically, I made a list:

Ported (Bolded=ported):
Animations
Constants
Dialogs
Factions
Game Menus
Info
Items
Map_Icons
Meshes
Mission templates
Music
Particle Systems
Parties
Party Templates
Presentations
Quests
Scene Props
Scenes
Scripts
Simple Triggers
Skills
Skins
Sounds
Strings
Tableau Materials
Triggers
Troops
Variables



And then went through whichever ones I knew I hadn't changed. Some error's and tons of opened windows later, it worked like a charm. Just remember to copy and paste in chunks, keep a calm head, and always have an organized base to regroup.

I'd thought the system had screwed with me when it changed the town's allegiances, but I had just forgotten to replace the Lord-town scripts  :oops:
 
Fujiwara 说:
I use a lot of custom bitfields in Onin no Ran (example: you can set up quests with multiple intermediate goals, that aren't necessarily linear, without a whole bunch of global tracking variables), and I had to write bin->dec and dec->bin converters, plus code to breakout a bitfield (which was really a decimal number consisting of just 1's and 0's) into an array of 1's and 0's, and code to check the bit I wanted to look at. A huge, complicated suite of scripts. This is going cut all that down to two scripts: one to set/unset bits, and one to check if a bit is set:

Crazy, I never thought people would be using that kind of stuff in M&B.
Thymo 说:
grailknighthero 说:
There is a max amount of troop_ids(module_troops) allowed in the game.


Oh.. Why? And how many was there in .960? ..  :?:
All games have limits.  Armagan did not know in the beginning that M&B would get this far.  The old limit used to be 512.
 
Oh! It would great if all these things were documented.
Btw, current number of troops is above 600
 
grailknighthero 说:
Fujiwara 说:
I use a lot of custom bitfields in Onin no Ran (example: you can set up quests with multiple intermediate goals, that aren't necessarily linear, without a whole bunch of global tracking variables), and I had to write bin->dec and dec->bin converters, plus code to breakout a bitfield (which was really a decimal number consisting of just 1's and 0's) into an array of 1's and 0's, and code to check the bit I wanted to look at. A huge, complicated suite of scripts. This is going cut all that down to two scripts: one to set/unset bits, and one to check if a bit is set:

Crazy, I never thought people would be using that kind of stuff in M&B.
Oh yeah...it started out as something I needed before we had check_quest_concluded, etc. The original implementation was with slots, which was horrible. I had hand roll a store_power script to get the original dec->bin converters to work before we had the store_pow opcode. Now, I only to need to store the flag value in one slot, and the power of it is pretty amazing: you can have up to 28 custom flags for any object for each integer (max integer value I've seen is 400,000,000, which is actually kinda weird, since even a signed 32-bit integer tops out at 2,147,483,647).
 
Fuji,

that's really neat! I never thought of storing boolean values that way...I imagine your new implementation is much faster? No problem using it in nested loops?
 
Thank you so much for all those kind words.

There shouldn't be an upper limit on troops (or anything other than factions) in the new version.
 
You should probably add a compatibility note with 1.011 on the first post.

It might confuse some people otherwise.
 
armagan 说:
Thank you so much for all those kind words.

There shouldn't be an upper limit on troops (or anything other than factions) in the new version.

I have about 20 factions running around so I doubt anyone will run into that limit anyway.

Porting is pretty easy

I copy all of my changes and additions to a module_x_changes (where x is the name of the module file) with clear titles for each script. Come porting time I just go through and copy & paste.
 
后退
顶部 底部