New SOC Unlockables system in SRB2 2.1

Status
Not open for further replies.

JTE

Member
For SRB2 2.1, the unlockables and emblems system has been totally revamped. Your mod wad can now specify exactly how, when, and what, gets unlocked. It's a little complex, so bare with me here as I go over the details of how to implement this useful new feature for you.

The first thing you have to do, of course, is set your gamedata file in the maincfg section. Unlockables can not be modified unless the gamedata is separate from vanilla SRB2.
Code:
MainCFG Category
GameData = supergame.dat

Now that that's out of the way, our wad is officially its own mod, complete with a time attack folder and unique savegames and such. Congratulations, we're ready to make some fun secrets and unlockables!

First things first, though: You might want to remove every trace of SRB2's own Unlockables, Emblems, Level Headers, etc. This can easily be done by inserting "CLEAR" commands after the MainCFG category (not inside it!), like so:

Code:
CLEAR Levels
CLEAR Unlockables
CLEAR Emblems
CLEAR ExtraEmblems
CLEAR ConditionSets

#This does all of the previous actions
CLEAR ALL

Additionally, the current Emblem structure is the same as it was in 2.0.6; however, this is subject to change in the near future. Expect to see an addendum to this message later on if that is the case.

Extra Emblems

Now, the easiest thing to add is extra emblems, which are unlocked instead of found. Extra emblem sections looks like this:
Code:
ExtraEmblem 1
Name = Perfect
Objective = Perfect Test Map A
ConditionSet = 11

ExtraEmblem 2
Name = Ultimatim
Objective = Beat Test Map A on Ultimate
ConditionSet = 12

[...]
testemblems2.png

The objective is written on the statistics page as a description of how to unlock it, and the name is used when the emblem is awarded, on a CECHO which reads something like GOT "ULTIMATIM" EMBLEM!

The condition set refers to another section of the SOC which determines how the emblem is achieved, and is the most complex new area of sOC editing, so I'll get to that last.

Unlockables

The next thing you'll want to write up is an unlockable, a reward that actually does something. Unlockable sections can look like this:
Code:
Unlockable 1
Name = Custom Sound Test
Objective = Beat Test Map A with All Emeralds
Type = SoundTest
Height = 20
ConditionSet = 1

Unlockable 2
Name = Custom Warp 1
Objective = Earn an Emblem
Type = Warp
Var = 2
Height = 110
ConditionSet = 2

[...]

Unlockable 10
Name = Custom Header
Height = 100

[...]

Unlockable 20
Type = RecordAttack
NoCecho = true
NoChecklist = true
ConditionSet = -1
testunlocks.png


The order in which you define unlockables determines their location in the Secrets Checklist, and their position on the menu is defined by the "Height" attribute. As with old unlockables, you may define a custom warp and a custom level select that can be selected in this menu. However, in 2.1, you may also define a custom sound test entry that will show up on this menu, if you so desire. Additionally, the "Var" attribute is now used for the Level Select entries -- It determines which maps to show on the list. If you use "Var = 2" on a level select unlockable, it will look for all maps that have "LevelSelect = 2" in their map headers. You can define multiple unlockable level selects in this manner.

Notice Unlockable 10 -- doesn't it look a little empty? An unlockable without a type is treated as a "Header" type; this allows you to place a bit of text on the menu before a set of menu options -- for example, "Bonus Levels".

Also notice Unlockable 20. In addition to the previous types, there are a few other additional types that enable hardcoded menu options, such as Pandora's Box, NiGHTS Mode, and Record Attack. These display in the Secrets Checklist (unless you disable that by using NoChecklist), but never in the Secrets menu itself. Additionally, note that it uses a Condition Set value of -1; this means that it is automatically unlocked from the start, without the player needing to do anything.

Condition Sets

Finally, now that we have things which need unlocking, we make a condition set to specify exactly how to unlock them. Examples of condition sets:
Code:
ConditionSet 1
Condition1 = MapAllEmeralds 1

ConditionSet 2
Condition1 = TotalEmblems 1

[...]

ConditionSet 11
Condition1 = MapPerfect 1

ConditionSet 12
Condition1 = MapUltimate 1

[...]

ConditionSet 20
Condition1 = GameClear
Condition2 = PlayTime 126000

ConditionSet 21
Condition1 = ConditionSet 1
Condition1 = ConditionSet 2
unlocked.png


Condition sets define exactly what you need to do to earn your unlockables and extra emblems. You can specify up to 128 of them if you wish, but you should never need that many.

Each condition set can have as many conditions as you desire, defined by the "Condition# = " sections. The # indicated the ID of the condition -- this is used to group specific conditions together to create a more complex one. Basically, two conditions with different IDs are treated as "Either one of these can be done for this to be true" (See ConditionSet 20); while two conditions with the same ID are treated as "Both of these must be done for this to be true" (See ConditionSet 21). There's no real limit to the complexity of the condition sets you define -- use as many different conditions with different or identical IDs to get the effect that you desire.

Below is a list of all the conditions, their syntax, and what they mean. [Brackets] designate a required parameter, and <angled brackets> designate an optional parameter.
  • PLAYTIME [tics]
    Requires the player to accumulate a set amount of play time to unlock.
    -
  • GAMECLEAR <x times>
    Requires the player to clear the game a set number of times. Defaults to 1 if the parameter is omitted.
    -
  • ALLEMERALDS <x times>
    Requires the player to clear the game with all emeralds a set number of times. Defaults to 1 if the parameter is omitted.
    -
  • ULTIMATECLEAR <x times>
    Requires the player to clear the game on Ultimate skill a set number of times. Defaults to 1 if the parameter is omitted. This is a really good way to drive people insane; it's included just in case any modders wish to hide things behind Ultimate mode.
    -
  • OVERALLSCORE [score to beat]
    Requires the player's total score in all Record Attack maps to be above a target score.
    -
  • OVERALLTIME [time to beat, tics]
    Requires the player's total time in all Record Attack maps to be below a target time.
    -
  • OVERALLRINGS [rings to beat]
    Requires the player's total rings in all Record Attack maps to be above a target amount.
    -
  • MAPVISITED [map number]
    Requires the player to visit the defined map. Does not require them to complete the map, however.
    -
  • MAPBEATEN [map number]
    Requires the player to complete the defined map.
    -
  • MAPALLEMERALDS [map number]
    Requires the player to complete the defined map with all emeralds.
    -
  • MAPULTIMATE [map number]
    Requires the player to complete the defined map on Ultimate skill. Again, included just in case any modders wish to hide things behind Ultimate mode.
    -
  • MAPPERFECT [map number]
    Requires the player to complete the defined map with a Perfect Bonus.
    -
  • MAPSCORE [map number] [score to beat]
    Requires a target score on a defined map to be beaten. This must be done in Record Attack.
    -
  • MAPTIME [map number] [time to beat, tics]
    Requires a target time on a defined map to be beaten. This must be done in Record Attack.
    -
  • MAPRINGS [map number] [rings to beat]
    Requires a target ring count on a defined map to be beaten. This must be done in Record Attack.
    -
  • NIGHTSSCORE [map number] [mare, 0 for overall] [score to beat]
    Requires a set score on a specific mare (or, if mare is 0, overall score) of a NiGHTS course to be beaten. This does not need to be achieved in NiGHTS mode, and can in fact be achieved when playing the game normally.
    -
  • NIGHTSTIME [map number] [mare, 0 for overall] [time to beat, tics]
    Requires a set time on a specific mare (or, if mare is 0, overall score) of a NiGHTS course to be beaten. This does not need to be achieved in NiGHTS mode, and can in fact be achieved when playing the game normally. Note that in NiGHTS mode, the tracked time is the time that it takes you to break the capsule, not the time that it took you to return to the drone.
    -
  • NIGHTSGRADE [map number] [mare, 0 for overall] [grade]
    Requires a set grade on a specific mare (or, if mare is 0, overall score) of a NiGHTS course to be gotten. This does not need to be achieved in NiGHTS mode, and can in fact be achieved when playing the game normally. 0 is F, 1 is E, 2 is D, 3 is C, 4 is B, and 5 is A.
    -
  • TRIGGER [trigger number]
    This one is a little unique -- This requires a special Linedef Executor with type 441 set to the desired trigger number. When this Linedef Executor is activated, the trigger flag will be set (and unlockable status will be checked immediately). These triggers carry over from map to map, and a Trigger Linedef Executor with type 317 or 318 can check for them as well. This could potentially allow you to trigger unlockables by jumping on a certain person's house three times, if you wish to run an already dead joke into the ground even further. Note that this does not work in netgames, or if gamedata is no longer being saved (due to the use of GOD, NOCLIP, NOTARGET, etc.).
    -
  • TOTALEMBLEMS [number of emblems]
    Requires a set number of emblems collected. This counts both regular emblems and extra emblems.
    -
  • EMBLEM [emblem number]
    Requires a specific emblem to be collected.
    -
  • EXTRAEMBLEM [extra emblem number]
    Requires a specific extra emblem to be earned.
    -
  • CONDITIONSET [condition set number]
    Requires a previous condition set to already be achieved.

Review
A complete secrets and unlockables SOC includes the following:
  • A maincfg category which sets a gamedata file
  • Clear commands which remove the vanilla game's secrets and headers (and any other mod's, as well)
  • Emblems and extra emblems sections marking "achievement" style collectables
  • Unlockable sections which define the secrets menu options
  • ConditionSet sections which define the rules for which extra emblems become collected and unlockables become unlocked

A complete (although simple) example follows:
Code:
MainCFG Category
GameData = smallgame.dat

Clear Unlockables
Clear Emblems
Clear ExtraEmblems
Clear ConditionSets

ExtraEmblem 1
Name = Double Complete
Objective = Complete the game twice
ConditionSet = 2

Unlockable 1
Name = Sound Test
Objective = Complete the game
Type = SoundTest
Height = 20
ConditionSet = 1

ConditionSet 1
Condition1 = GameClear

ConditionSet 2
Condition1 = GameClear 2

We hope you will use this to create entertaining and long-lasting adventures in your future projects.
 
Last edited by a moderator:
Sweet! I will be able to use a couple more ideas I wanted to do years ago for a levelpack now since the unlockable system was expanded upon. I probably will have a couple of questions about certain aspects of the new unlockable system later, but other than that it good to hear the unlockable system was revamped for 2.1.
 
This new unlockables system will certainly be very useful, although there is one thing that I would suggest you add to it. It would be nice if Linedef Type 441 could be set to work in reverse; that is, to activate another linedef executor in the level if the player triggers it and meets a specified ConditionSet. This would allow, for example, a smooth transition between the last level of a level pack and a hidden final boss unlocked by, say, collecting all emblems without the game blatantly saying "Hidden final boss unlocked!" and creating an option in the secrets menu.
 
Awesome. Once 2.1 is out, I will so make Achievement Unlocked Zone, in which you will have to perform ridiculous and unintuitive tricks to obtain emblems that don't do anything.
 
Well, let me start off by saying thanks. Thanks. Thank you. Thanks. You didn't have to do anything, but the fact that you went out of your way to create such a flexible and versatile system is really commendable. So, thanks.

With that out of the way, I have only one complaint. Suggestion. One suggestion. Don't mean to sound ungrateful or anything. Would it be possible to add character-specific requirements to those conditions? It'd be nice to be able to reward players for not flying past the entire game as Tails.
 
Awesome. With this new system I will now be able to accomplish all of my goals for my mod thing/level pack. I am certainly looking forward to this.
 
This will definetly be very useful when I get to making that level pack I'm thinking of.
Also,
With that out of the way, I have only one complaint. Suggestion. One suggestion. Don't mean to sound ungrateful or anything. Would it be possible to add character-specific requirements to those conditions? It'd be nice to be able to reward players for not flying past the entire game as Tails.
I support this suggestion, mostly because I plan to have a slightly different level order for each character.
 
From the looks of things, my mod is already working towards this system. I like.
 
  • TRIGGER [trigger number]
    This one is a little unique -- This requires a special Linedef Executor with type 441 set to the desired trigger number. When this Linedef Executor is activated, the trigger flag will be set (and unlockable status will be checked immediately). These triggers carry over from map to map, and a Trigger Linedef Executor with type 317 or 318 can check for them as well. This could potentially allow you to trigger unlockables by jumping on a certain person's house three times, if you wish to run an already dead joke into the ground even further. Note that this does not work in netgames, or if gamedata is no longer being saved (due to the use of GOD, NOCLIP, NOTARGET, etc.).

I'm particularly interested in this, as it could fix a lot of problems with a project I was going to work on. However, one thing that puts me off is the netgame-friendliness. This'll work great in the single-player aspect of this project, but it'll totally break in multiplayer. Let's just say that the idea is a hub world, and my options are one huge dynamic map, about 4 separate maps (which isn't taking a few things into account), a hybrid between the two, or this. ._.'

Overall though, this all seems awesome. I look forward to whatever other new things 2.1 brings as well.
 
Specific-map visit/completion requirements?

Linedef trigger-triggering requirements?

...JTE, you amaze me yet again. =O

EDIT: Oh whoopsies, turns out Inuyasha actually did all that, not JTE, so congrats to him instead. =x
 
Last edited:
I'm particularly interested in this, as it could fix a lot of problems with a project I was going to work on. However, one thing that puts me off is the netgame-friendliness. This'll work great in the single-player aspect of this project, but it'll totally break in multiplayer. Let's just say that the idea is a hub world, and my options are one huge dynamic map, about 4 separate maps (which isn't taking a few things into account), a hybrid between the two, or this. ._.'

Overall though, this all seems awesome. I look forward to whatever other new things 2.1 brings as well.
Nothing gets unlocked in netgames, though.
 
Nothing gets unlocked in netgames, though.
Nothing, even.

We never spent 3 hours in a netgame server to find temples in every zone of Mystic Realm to unlock the 8th zone. Not even these netgame servers were capable of recording how many emeralds you had collected from map to map to unlock the damn last zone. No, it was just a dream (or a terrible nightmare). Just saying.

Obviuosly, there are a big difference between a pre-defined unlockable (which get old fast) and a "level-pack" unlockable (made by the level designer, with limitless possibilities). If we're talking only about single-player-wise unlockables, nothing is unlocked in netgames... though.
 
Last edited:
One question I do have is could you decide if only one certain character can activate the Linedef 441? This could lead to have a way to challenge people to try to reach a certain area or perform a certain task with Sonic, Tails, or Knuckles and give those who want their levelpacks to take this direction if they chose give their pack as a whole more playablity if they can pull it off successfully.
 
One question I do have is could you decide if only one certain character can activate the Linedef 441? This could lead to have a way to challenge people to try to reach a certain area or perform a certain task with Sonic, Tails, or Knuckles and give those who want their levelpacks to take this direction if they chose give their pack as a whole more playablity if they can pull it off successfully.
You can already do this with any linedef executor trigger combined with No Sonic/Tails/Knuckles flags.
 
Awesome. Once 2.1 is out, I will so make Achievement Unlocked Zone, in which you will have to perform ridiculous and unintuitive tricks to obtain emblems that don't do anything.

This reminds me of a game I played called Achievement Unlocked.

Also, now that there is far more options for unlocking, I am eager to make some singleplayer stuff now (Or perhaps make my own little challenge based on the original SRB2 :P)
 
This reminds me of a game I played called Achievement Unlocked.

I was just about to say that, too.

And, if this will also work with SRB2Kart, (once it's upgraded to the 2.1 engine) then I'll think this may be a good way for unlocking new tracks, characters and/or cups to use in SP/Time Attack once you've cleared earlier cups in SP/Time Attack within a given timeframe. May need some tweaking, though - for example, one condition may be 'Clear This Cup in X minutes'.

Thinking about that, that would be useful outside of Kart, because then you could have an unlockable for if you clear a full Zone with X rings in total, with X points in total and/or within X minutes.
 
Now that it's April 2nd and the new emblem screenshots have been put on the forums, I might as well go over the small changes the system has undergone under the hood.

Most of the emblem structure remains the same, there's only a couple changes to accommodate new developments. The only big change, really, is the introduction of different types of emblems:

  • GLOBAL (or no type)
    This is the new default type of emblem that gets used if you ignore the TYPE parameter. It can be picked up by all characters.

  • SKIN
    This is the old, pre-2.1 emblem style emblem that is restricted to one character.

  • SCORE, TIME, RINGS
    These emblems require a specific score, time, or ring requirement. Though you can do the same with extra emblems, these will show up next to the map name in the Statistics screen, and will also show up next to the appropriate statistic on the Record Attack screen. These ignore X, Y, and Z coordinates, obviously.

The VAR variable is used to store extra information relating to the emblem. In the case of the GLOBAL type, it determines the player color that the emblem will use. In the case of the SKIN type, it determines what skin can collect the emblem. In all the other cases, it determines the target score/time/ring count to reach to obtain the emblem.

There's actually one more variable, but it's not used at the moment, and mentioning it here would spoil what it's supposed to be used for.

I doubt you really need examples for these, but here's a few anyway:

Code:
EMBLEM 1
TYPE = SKIN
LEVEL = 1
X = 1200
Y = 800
Z = 400
VAR = 0

This will give you the old, skin-specific emblems previously used in 2.0.6 and before. Specifically, this gets you a Sonic-only emblem.

Code:
EMBLEM 2
LEVEL = 1
X = 1200
Y = 800
Z = 400
VAR = SKINCOLOR_RED

On the other hand, this will give you a new, global emblem that any player can collect. It'll be colored red, too. You can use any skin color you want, though it should be noted that a couple of colors don't really work all too well.

Code:
EMBLEM 3
TYPE = RINGS
LEVEL = 1
VAR = 100

This will give you an emblem that requires the player to finish the level with at least 100 rings held. This will show up next to the player's best records for the level, as well, so you can easily tell which Record Attack emblems you've already collected.
 
Status
Not open for further replies.

Who is viewing this thread (Total: 1, Members: 0, Guests: 1)

Back
Top