Audiosurf 2

Audiosurf 2

62 ratings
How to Start Modding Game Modes
By Desert_Hill
This guide will teach and explore how to start modding Audiosurf2 gamemodes.
Keep in mind that this is not an 101 in-depth guide! It will only teach you the very basics.
   
Award
Favorite
Favorited
Unfavorite
Pre-Requisites
Recommended software:

Recommended Processes
  • Back-up all files before editing (You don't want to break a game mode)
  • Make sure to document changes with comments in the code or in a change log
  • Use version control to ensure that if you make a mistake you can roll back if needed


Note
These are some very basic tips to make sure that if you create something and them subsequently break it you don't have to try and re-create it all over again, some may say this is over kill, but better to be safe than sorry.
Finding The Game Files
Location
  • C:\Program Files (x86)\Steam\SteamApps\common\Audiosurf 2\mods\
Modes
  • double vision
  • mono
  • mono turbo
  • pusher
  • wakeboard
  • wakeboard elite
  • wakeboard grid
  • wakeboard pro
  • wakeboard puzzle
Script file
  • The script file has the extention of .lua, should you wish to mod the game mode this is the file you will need to edit.
Attributes of Script file
Gameplay Settings
  • usepuzzlegrid=(true/false), -- Used to enable puzzle grid for collecting blocks
  • usetraffic=(true/false), -- Used to remove blocks
  • greypercent=0.3, -- Used to define % of greys of total blocks(?)
  • usejumpmarkers=(true/false), -- Used to add white bars to show good places to jump
  • cancrash=(true/false), -- Used to allow users to try to perform a trick without the required amount of air time
  • canpush=(true/false), --Enables push mode (works on wakeboard) hold left click for left push right click for right push
  • canScoop=(true/false), --No noteable changes on wakeboard mode (False default)
  • multilane=(true/false), --No noteable changes on wakeboard mode (False default)
  • puzzlerows=7, -- Used to set the amount of rows in the grid (requires usepuzzlegrid=true)
  • colorcount=1, -- Used to set number of different coloured blocks (1-5) 0 defaults to 1
  • greyrandomdistribution=(true/false), -- Seems to change the position of greys on track, doesn't truly randomize though (I think) it will generate the random distribution once and use that for all subsequent plays {side note true seems to drop the quantity}
  • usecaterpillars=(true/false), -- Puts lost of blocks in a line in places
  • minimummultiplier=1, - Used to set the resting multipler rate (If set to more than 1 it will lock the multiplier progression by collecting blocks)
  • jumpautofixscaler=1, -- Valuse tested at 5 & 10 no noteable difference at each
  • cleargridonlanding=(true/false), -- Used to clear blocks after landing in grid on landing a trick
  • forceclearsinglecolumns=(true/false),
  • sideview=(true/false),
  • degreyatlandingzone = (true/false); --Used to clear landing area of greys (?)
  • launchtrickmultiplier=1.5, - Used to denote the multipler when a user holds the trick/jump key then performs the same trick (whist airborn) bound to that key.
  • twoarmcolors=(true/false),
  • autofinishgamepadjumps=(true/false),
  • autofinishmousejumps=(true/false),
  • puzzlematchmultiplier=1,
  • stealthscoremultiplier=1,
  • secondstoblockjumpsafterlanding=0,
  • easytraffic=(true/false),
  • allowtrickdowngrades=(true/false),
  • jumpmode="wake",--button",--"ramps", "wake", "none", "auto"
  • forcecollectiononoverfill=(true/false), -- Used to penalise the user if they over fill the grid (with greys ?)
  • -- minimumjump_airtime=0.65,
  • -- minimumjump_height=4,
Points Attributes
  • startingscore=0, -- Starting score for the user
  • pointspergrey=-25, -- Denotes the penalty for hitting a grey
  • pointspercolor=25,
  • matchcollectionseconds=1.5,
  • greyaction="eraseblock",
Trick Attributes
  • trickdurations={.7,2,3,6},
  • trickpoints={300,1000,3000,10000}, -- Used to denote points availible for each trick {front flip, back flip, side flip, uber trick}
Gravity Attributes
  • gravity=-.45,
  • --gravity=-.98,
  • jumpheightscaler = .8,
Player Speed Attributes
  • playerminspeed = 0.1,-- so the player is always moving somewhat
  • playermaxspeed = 2.9, -- Used to set the maximum speed a player can achieve
Track Attributes
  • minimumbestjumptime = 2.5,-- massage the track until a jump of at least this duration is possible
  • uphilltiltscaler = 0.8,--set to 1 for a less extreme track
  • downhilltiltscaler = 1.55,--set to 1 for a less extreme track
  • uphilltiltsmoother = 0.03,
  • downhilltiltsmoother = 0.06,
  • useadvancedsteepalgorithm = (true/false),--set false for a less extreme track
  • alldownhill = (true/false),
Block Attributes
  • railedblockscanbegrey=(true/false),
  • trafficcompression=0.65,
  • watercompression=0.45,
In Air Attributes
  • airstrafing = (true/false)

Note
This is all of the attributes, at this time I don't know what they all do, I will have a play and report back with recommended ranges for numerical values and with further explanation of what they do in the next few days. In the mean time if you discover good ranges for attributes or the functions of some of them do let me know and I will update the list.
Advanced Modding (Using LUA)
When creating new events/features for a game-mode prior experince with LUA will help.

First off, you should get ready for long hours of practising. But soon enough you can make a whole new feel to the game! In this section, I will not go through all of LUA. That would take too long. So I decided to take a small part of the Audiosurf2 LUA-code and then explain how it works...
--------------------------------------------------------------------------------------------------------------------------------------
function OnRequestFinalScoring()
local cleanFinishBonus = 0
local percentPuzzleFilledAndUnmatched = GetPercentPuzzleFilled(true)
if percentPuzzleFilledAndUnmatched == 0 then
cleanFinishBonus = math.floor(score * .1)
end

--local stealthBonus = 0
--if stealthy then stealthBonus = score * .2 end

return {
rawscore = score,
bonuses = {
"Clean Finish:"..cleanFinishBonus
},
finalscore = score + cleanFinishBonus
}
end
-----------------------------------------------------------------------------------------------------------------------------------
This code is how Audiosurf2 calculates the final score of a song for the mono mode. It works by performing the following commands:

"function OnRequestFinalScoring()" ----- Call the calculate the final scores function/method

"local cleanFinishBonus = 0" ----- "local" flags a variable to make it unique to the function in this case "cleanFinishBonus = 0", is the variable which will store the score and it's value will start at 0.

"local percentPuzzleFilledAndUnmatched = GetPercentPuzzleFilled(true)" ----- a local variable that is equal to another variable. (equal to a boolean to be more exact.)

if percentPuzzleFilledAndUnmatched == 0 then ----- If statements evaluate a set of conditions and perform an action if true in this case if "percentPuzzleFilledAndUnmatched" is 0 perform an action.

cleanFinishBonus = math.floor(score * .1) ----- this line is a little bit different. This sets the cleanFinishBonus to be equal to a maths problem, that will be resolved into our final score.

end ----- this ends the statement...

--local stealthBonus = 0 ----- this is a comment, because it uses "--".
--if stealthy then stealthBonus = score * .2 end ----- also the same...

return { ----- this returns the score/bonuses. (The "{}" are used as an box.).
rawscore = score, ----- this line will show the rawscore when a song is at it's end. (Remmember the "," everytime you make a new line here.).
bonuses = { ----- also a box that contains the bonuses...
"Clean Finish:"..cleanFinishBonus ----- this will show us the clean finish that will be a part of our finalscore.
}, ----- this closes the first box.
finalscore = score + cleanFinishBonus ----- this shows us the finalscore. (It is two variables together.).
} ----- closes the second box...
end ----- ends the whole function.
-----------------------------------------------------------------------------------------------------------------------------------
If you need any further help or this was not good enought, then go to this website:http://www.dev-hq.net/lua/

This will explain all basics much easier. But if you can understand the lines of code I just tried to explain, then try to add new variables and maybe new functions? Always remmember that LUA is case-sensitive and remmember to take a backup file before doing this.
Comments in the script
  • Comments should be denoted with --
  • Where I have stated (true/false) the brackets should be removed and one value chosen
Notes
  • You must restart the game for any script changes to take effect (Some parts of the LUA-code in AS2 can be live-coded. This means that you can edit the LUA-code while the game is running and you will only have to restart the song you are listening too, or, change to a new song.)
  • Make sure the .lua script has the same name as the folder name otherwise game mode can't be changed.
13 Comments
Rein Kayomi 26 Aug, 2022 @ 11:39am 
This is an old ass guide, but any idea how to literally make any gamemode greyless?
KawaiiPyro 29 Apr, 2017 @ 12:19pm 
how 2 edit keys so i dont have to use da mouse ?Plz Halp:skeletonunderneath:
Kasceus 30 Mar, 2016 @ 12:26pm 
I have a question reguarding min speed. I have tried to increase this value, but as it increases, the ammount of blocks generated decreases. if I go above .5 the track is just a series of turns with only like 2-6 blocks generated. is there any way to increase playerminspeed while actually creating enough blocks to be interresting? I ask because I would like to increase the difficulty of my mod just a bit, while still being playable.
Desert_Hill  [author] 24 Mar, 2015 @ 11:00am 
I will update now with regards to the install drive. As for getting started I chose mono as this, I felt, was the most basic and also resembled the gameplay that I wanted to utalise.
MoiraPrime [VF4-S] 23 Mar, 2015 @ 7:28pm 
Any recommended modes to play with to figure out how everything works? The code for the mono feels a bit too cluttery and confusing.

Also, not everyone installs their steam games to C:\. Might want to clarify that at the beginning.
Desert_Hill  [author] 10 Feb, 2015 @ 1:59pm 
derpynerd69, Yes this is Legit and no it wont mess your game up provided you backup all of the original .lua scripts.
derpynerd69 1 Feb, 2015 @ 11:24pm 
Is this legit? Will it mess up the game?
MOJRM_7RB 12 Dec, 2014 @ 8:09am 
now how can i post on Steam WorkShop ?
76561198140386948 14 Aug, 2014 @ 4:25am 
This Game Is More Fun But Most Error!!!!
pyratic 2 Jan, 2014 @ 3:53pm 
is anyone else haveing this error
LuaInterface.LuaScriptException: [string "chunk"]:7: ')' expected (to close '{' at line 1) near 'canpush'
if you did and you fixed then could you please tell me how to fix it?