Jump to content
aidenpons

Custom Level Cafeteria Framework

Recommended Posts

aidenpons
Posted (edited)

I've picked up LRR modding again, and one of RRU's dreams has, I think, always been to convert the Training Missions accessible from the main menu into an area where you could quickly play custom levels. However, given the difficulty of file naming (Cror_13.map), CFG shenanigans (FrontEndX and FrontEndY), and images, it's just generally been a bit painful: hence why several levels just overwrite existing ones: clearly not good for compatibility.

 

However, I have created a Cafeteria framework which allows you to insert your own levels with ease!

 

 

It functions by ignoring the config for the tutorial levels entirely and creating its own new batch of levels: RRULevel01 through to RRULevel08*, shamelessly copying the icons and positioning from the tutorials (why not?) But from here, levels can be inserted using a common file configuration: you only need to specify the level number and some properties about the level: for instance, what biome, what level name, erosion parameters.

 

* It will be extremely easy to extend this up to 8+25 = 33 using the existing LevelPicker, and it is straightforward to add more, so there's hardly a limit.

 

 

Screenshots? Well, I have to say they don't exactly look that impressive due to Community Edition not having a background for the tutorial missions. But I guarantee you it works!

 

large.Missions1.PNG.3cbec994adab277ddeedd6767532139c.PNG

 

 

 

Download the framework here (also contains a template which contains Driller Night.). I also have prepared some examples for you, using Ice Sanctuary. Bolt Molt, Cunning Canyons, and Xiron: download these here.

 

 

List of levels that are known to use the framework. Bracketed indicates name of author.

- Ice Sanctuary (aidenpons)

- Bolt Molt (Cyrem)

- Cunning Canyons (alan)

- Xiron (aidenpons), download links for the four above

- Christchurch (aidenpons)

- Hard Luck (JimbobJeffers)

- Water Lot of Fun II (aidenpons)

 

 

 

Known Issues and General Shenanigans:

 

- Levels that do not have data set to them will show up as RRU Level 05 or suchlike, and clicking them will crash the game. Just click on the levels you actually installed files for :P

 

- The set of default priorities includes Priority_BuildPath. If Improvements Pack is not installed, this will show up as an empty box. However, it does not have an effect on the game. You can modify this for your own maps.

 

- Due to the Training Missions being unable to reliably access saved data, you will not have upgraded trained raiders. This is especially a problem where certain levels require Explosive Experts (eg Bolt Molt). If this is neccessary, load a save with upgraded raiders, go back to the main menu, and re-access the Training Missions.

 

- Using the same number for two sets of level data will probably cause stupid stuff. Just don't even try.

 

- Plays up on Cafeteria v0.9.3 due to that version of Cafeteria liking to do doubles of everything you tell it, which doesn't work well when the commands are separate. However it works fine with the version of Cafeteria that comes with Community Edition.

 

- No background for Training Missions means it looks extremely glitchy as it doesn't 'paint' over where your cursor / anything else was. The menu is still functional. This depends on what version of CE you are using.

 

- "Reward" (the scoring system) is currently not functional.

 

- A crystal requirement of less than 25 will not be reflected in the size of the crystal bar on the right (for instance in Driller Night you can clearly see you only need five crystals). This is because the size of the crystal bar is actually defined under Reward. You can change this by using CFG:SetProperty in script.txt

 

- The menu still says "Training Missions" as opposed to "RRU Levels" or suchlike.

 

 

 

 

The hope is that @Cyrem will be able to automate this into Cafeteria: such that you don't even need to pick a number, you just put your files in a Custom Levels\MyLevelName folder and Cafeteria sorts everything out, and it shows up!

 

 

With thanks to:

@Cyrem for Cafeteria, for the modding tools, for the forum, and for everything ❤️ Also putting up with the pings on the Discord :P

@alan for making me realise that we weren't restricted to just Level01...Level25 for level names

@everyone for making RRU my happy place (this is why Christchurch was not included as one of the example levels).

Edited by aidenpons

Share this post


Link to post
Share on other sites
aidenpons
Posted (edited)

This post is reserved for a less waffly and more technical section on how to make a level compatible.

 

0) Have a map to start off with! Map Creator is a fantastic tool. If you need to use high tutorial block numbers, Map Tool can handle that, but you really shouldn't be experimenting with this unless you know what you're doing. As for objectives, you'll need the NPL scripter.

 

 

 

1) Download the template. You can construct your own level from scratch but really just use the template. Copy it out so you always have the template handy when you need it again, and start editing the copy.

 

 

 

2) Pick a number. This corresponds to what slot your level will use. We don't need this number just yet but we will soon. Currently the framework handles 1-8. It's okay to pick a number used by another level - just don't install both levels at the same time in Cafeteria!

 

 

 

3) Edit info.xml accordingly (use Notepad or better). This tells Cafeteria the name and etc of your patch. Currently, info.xml contains something like

Spoiler


<?xml version='1.0'?>
<patch system="1">
                <name>Custom Level Template - Driller Night 01</name>
                <author>aidenpons</author>
                <version>1.0</version>
                <description>Does exactly what the title says. Uses Slot 01.</description>
                <uid>rru.lrr.aidenpons.customleveltemplate</uid>
                <priority>3</priority>
                <dependency></dependency>
                <incompatible></incompatible>
</patch>


 

 

I reccomend keeping a priority of 3. Just edit all the fields. Description is currently depreciated in Cafeteria so you can leave that blank. Having what slot it uses in the title is handy. I like the format Level## - Title myself.

 

 

 

4) Put all the level files exported from Map Creator and the NPL Scripter into the folder LevelFiles. The full list of files you need is:

Spoiler

Map Data Files:

Cror.map

Dugg.map

Emrg.map

Erod.map

Fall.map

High.map

Path.map

Surf.map

Tuto.map

ObjectList.ol

 

Other Files:

script.npl (it must be called script.npl)

messages.txt

ObjectiveText.txt

The map files are spat out by Map Creator when you press the Export button (just export it to Desktop; then move the files over), but you'll need to watch out for the other three as you could miss them. Even if you don't use these files they must be present in this folder.

If you aren't using messages, you still need that file to exist. Just create an empty text document: right-click the background + New Text Document + call it messages.txt + you're done!

 

 

 

5) Open ObjectiveText.txt. The template contains Driller Night's text, and it usually looks something like

[RRULevel01]
Objective:			Initial text goes here
Failure:			Bad luck! You failed to find the Tool Store and retrieve five Energy Crystals. Mission failed.
Completion:			Well done! You got all five Energy Crystals. Mission complete.
CrystalFailure:		Too many Energy Crystals have been stolen for you to be able to complete this mission.

Change the [RRULevel01] to whatever level you overwrite. So if you picked slot #4, change that 01 to an 04.

 

 

 

6) Open script.txt (doable with Notepad). Do not confuse this file with script.npl. Unless you're doing anything special, you can stick with what's specified:

CFG:SetProperty Lego*\Levels\RRULevel01\FullName The_Sanctuary_Of_Ice
WAD:AddFilesFromDirectory LevelFiles\ Levels\RRULevels\RRULevel01\
CFG:InsertCFG Lego*\Levels\RRULevel01\ cfg.cfg

However, you'll need to adjust this for your level. If you picked slot #5 and your level was called Fantastic Fire then you would write

CFG:SetProperty Lego*\Levels\RRULevel05\FullName Fantastic_Fire
WAD:AddFilesFromDirectory LevelFiles\ Levels\RRULevels\RRULevel05\
CFG:InsertCFG Lego*\Levels\RRULevel05\ cfg.cfg

If you're doing things greatly out of the ordinary (dedicated PTL file, priority changing) you'll need to include these lines here. See Cafeteria Patch Documentation for more detail, as well as section 7. Don't use TAB to indent as that crashes Cafeteria, just use spaces (very carefully!)


 

7) Open cfg.cfg with Notepad or better and put any more properties you need here. The minimum properties are shown below:

			EmergeCreature					RockMonster
			EmergeTimeOut					2500.0
			
			BoulderAnimation				ROCK
			TextureSet						Textures::ROCK
			RockFallStyle					ROCK
			SafeCaverns						FALSE
			NoFallins						TRUE
            
            FallinMultiplier				30
			NumberOfLandSlidesTillCaveIn	6
            

(The last two can be omitted but will cause strange behaviour when dealing with landslides.)

In here, also insert the bits that make your level special. For instance, Christchurch's cfg.cfg file is a little more complicated, and looks like
 

Spoiler


			DisableStartTeleport		TRUE
			
			InitialCrystals				9
			InitialOre					18
			
			EmergeCreature					LavaMonster
			EmergeTimeOut							750.0
			
			BoulderAnimation				Lava
			TextureSet						Textures::Lava
			RockFallStyle					Lava
			
			
			FallinMultiplier				30
			NumberOfLandSlidesTillCaveIn	2
			SafeCaverns						TRUE
			NoFallins						TRUE
			
			ErodeTriggerTime				1
			ErodeErodeTime					1
			ErodeLockTime					1
			
			OxygenRate						5

 


 

 

 

Not everything is specified in here as some is specified in the setup. Details in spoiler below:

 

Spoiler

 

This notably includes the PTL file, priorities, level bitmaps for the menu select, fog properties and a couple of other parameters you should really never have to edit. If these require changing, they need to be done with CFG:SetProperty in script.txt.

 

Again using Christchurch, it has a couple of extra lines in script.txt to change the priorities around:

CFG:ClearBlock Lego*\Levels\RRULevel08\Priorities\ TRUE
CFG:InsertCFG Lego*\Levels\RRULevel08\Priorities\ priorities.cfg

Ice Sanctuary also has a custom .ptl file to remove ore generation upon clearing rubble:

CFG:SetProperty Lego*\Levels\RRULevel01\PTLFile	Levels\RRULevels\RRULevel01\MyPTL.ptl

 

For completeness, the properties the template specifies are:

 

Spoiler

GenerateSpiders					TRUE

			BlockSize						40
			DigDepth						40
			RoughLevel						6
			RoofHeight						40
			UseRoof							YES
			SelBoxHeight					10
			FogColourRGB					149:29:1		;Lava Fog
			HighFogColourRGB				190:60:0		;Lava Fog
			
			NextLevel						Levels::RRULevel04
			LevelLinks						Levels::RRULevel04
			FrontEndX						450
			FrontEndY						122
			FrontEndOpen					TRUE
			MenuBMP							Levels\TutorialLevels\Tutorial03.bmp,Levels\TutorialLevels\GTutorial03.bmp,Levels\TutorialLevels\Tutorial03G.bmp
			ObjectiveImage640x480			Interface\BriefingPanel\BriefingPanel.bmp,76,100

			SurfaceMap					Levels\RRULevels\RRULevel03\High.map
			PredugMap					Levels\RRULevels\RRULevel03\Dugg.map
			TerrainMap					Levels\RRULevels\RRULevel03\Surf.map
			CryoreMap					Levels\RRULevels\RRULevel03\Cror.map
			PathMap						Levels\RRULevels\RRULevel03\Path.map
			FallinMap					Levels\RRULevels\RRULevel03\Fall.map
			ErodeMap					Levels\RRULevels\RRULevel03\Erod.map
			EmergeMap					Levels\RRULevels\RRULevel03\Emrg.map
			BlockPointersMap			Levels\RRULevels\RRULevel03\Tuto.map
			OListFile					Levels\RRULevels\RRULevel03\ObjectList.ol
			ObjectiveText				Levels\RRULevels\RRULevel03\ObjectiveText.txt
			
			NERPFile					Levels\RRULevels\RRULevel03\script.npl
			NERPMessageFile				Levels\RRULevels\RRULevel03\messages.txt
			
			PTLFile						Levels\DefaultPTL.ptl
			
			Priorities {
				AI_Priority_GetIn					TRUE
				AI_Priority_Repair					TRUE
				AI_Priority_Recharge				TRUE
				AI_Priority_Reinforce				TRUE
				AI_Priority_Destruction				TRUE
				AI_Priority_BuildPath				TRUE	
				AI_Priority_Clearing				TRUE				
				AI_Priority_Crystal					TRUE
				AI_Priority_Ore						TRUE

			}

 

If a property is in this template, it requires CFG:SetProperty to change in script.txt. If a property is not in here, it belongs in cfg.cfg

 

 

 

 

 

 

 

 

 

8 ) You're done! Compile to .wadp using Wad Recycler, which automatically detects that it's a .wadp not a .wad, put in in the Mods folder, enable it and the framework in Cafeteria and you're good to go!


 

Edited by aidenpons

Share this post


Link to post
Share on other sites
Cyrem

Great stuff Aiden! I think we can get a good amount of this automated in Cafeteria with an unrestrained amount of levels that can be added.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.