├── README.md └── UEFN Verse ├── UEFN_VerseCodex.md └── UEFN_VerseNotes.md /README.md: -------------------------------------------------------------------------------- 1 | # ❤ Verse programming language 2 | **Functional logic language developed by Epic Games** - repo of all informations, official resources and snippets 3 | 4 | Also called "MaxVerse" by [SPJ](https://simon.peytonjones.org/): "Analogy Haskell" "built on top of **VC**" 5 | 6 |
7 | 8 | ***🔴Official descriptions of language by its authors*** 9 | 10 | ---------------------- 11 | ### General descritpions 12 | * Verse is a functional logic language (like Curry or Mercury) 13 | * Verse is a declarative language: a variable names a single 14 | value, not a cell whose value changes over time 15 | * Verse is lenient but not strict: 16 | * Like strict: everything gets evaluated in the end 17 | * Like lazy: functions can be called before the argument has a value 18 | * Verse has an unusual static type system: types are firstclass values 19 | * Verse has an effect system, rather than using monads 20 | * ***Verse is open: Open spec, open-source compiler, verifier, published papers, runtime under permissive open-source license with no IP encumberances*** 21 | * Mutable state, I/O, and other effects 22 | * Pervasive transactional memory 23 | * Structs, classes, inheritance 24 | ### Ideas & visions 25 | * Kick functional logic programming out the lab and into the mainstream 26 | * Learnable as a first language (c.f. Javascript yes, C++ no) 27 | * Stretches from end users to professional developers 28 | * Transactional memory at scale 29 | * Very strong stability guarantees 30 | * A radical new approach to types 31 | * Extensible: mechanisms for the language to grow over time, without breaking code 32 | 33 | ---------------------- 34 |
35 | 36 | do not confuse with: ~~https://github.com/verse-lang/verse https://github.com/Idyllei/verse-pl ~~ 37 | 38 | #### Official materials: 39 | * ▶[Beyond Functional Programming: The Verse Programming Language (Simon Peyton Jones)](https://www.youtube.com/watch?v=832JF1o7Ck8&ab_channel=SkillsMatter) Dec 2022 SPJ 40 | * 📟 [^slide deck](https://simon.peytonjones.org/assets/pdfs/haskell-exchange-22.pdf) 41 | * ▶ **[The Verse programming language GDC 2023](https://youtu.be/teTroOAGZjM?t=22494)** 42 | ------------- 43 | # 💙 Verse in [UEFN - Unreal Editor For Fortnite](https://store.epicgames.com/en-US/p/fortnite--uefn) 44 | **Called "ShipVerse" by SPJ or "BetaVerse"(Tim Sweeney) "very conservative subset" of Verse programming language avilable in UEFN, sometimes related as "Verse scripting"** 45 | 46 | UEFN Verse does differ a bit from Verse programming language and what we see in VC 47 | 48 | [I've made video summarizing how Verse might play in UEFN and to clarify these 3 different terms: CoreVerse, ShipVerse, MaxVerse](https://youtu.be/Xon9r3piIIw?t=251) at 4:14 video time, video is from before UEFN release and has many predictions 49 | 50 | #### Official materials: 51 | * ▶[2020 Year In Review | Inside Unreal (reveal of Verse scripting language)](https://youtu.be/pjK6QHlbfKE?t=3632) at 1:00:45 video time. Dec 2020 52 | * ▶ **[The Verse programming language GDC 2023](https://youtu.be/teTroOAGZjM?t=22494)** 53 | * 📘 **[UEFN Verse documentation](https://dev.epicgames.com/documentation/en-us/uefn/verse-language-reference)** 54 | ------------- 55 | 56 | # 💚 Visual Verse - visual scripting language developed by Epic 57 | **Epic is working on visual scripting language and Unreal Engine IDE for it and to be used potentially in UEFN/Fortnite** 58 | 59 |
60 | 61 | ***🟢 Visual Verse - what we know alreadyc*** 62 | 63 | ------------- 64 | ## Epic is working on ***[Visual Verse](https://twitter.com/UnrealVerseGuru/status/1636691915927171072)*** visual scripting language 65 | * Visual scripting is a process of using a visual programming language to create computer programs/scripts. Instead of writing lines of code You use GUI elements, connecting nodes/blocks defining behaviour & logic (Unreal Engine uses **Blueprints** (old Kismet) visual scripting language heavily in UE editor for most of in editor avilable tasks & scripting logic) 66 | * there are not much informations about it beside registering trademark, recruitment posts for Fortnite (probably UEFN) [1](https://twitter.com/UnrealVerseGuru/status/1582139223355768832) [2](https://twitter.com/UnrealVerseGuru/status/1593014047091351552), and some minor mentions/leaks related to it 67 | * From those we know IDE for Unreal Engine for VV is in the works 68 | 69 | ------------- 70 |
71 | 72 | 73 | ------------- 74 | 75 | # 💜 VC - Verse Calculus 76 | **New Core Calculus for Functional Logic Programming** 77 | 78 | Called "CoreVerse" by SPJ "analogy: [Lambda Calculus](https://en.wikipedia.org/wiki/Lambda_calculus)" but made for Verse and FLP languages 79 | #### Official materials: 80 | [1📝]: *[The Verse Calculus: a Core Calculus for Functional Logic Programming](https://simon.peytonjones.org/assets/pdfs/verse-March23.pdf)* 81 | 82 | ------------- 83 | > #### repo: [VC_VerseCalculusNotes](https://github.com/UnrealVerseGuru/VC_VerseCalculus) contains notes from [1📝] *WIP* 84 | 85 | 86 | 87 | ------------- 88 | ###### Other Verse related works: 89 | 90 | * [miniVerse](https://github.com/gregr/experiments/tree/master/verse) Attempt adhering to VC rewrite semantics with runnable examples from [1📝] written in authors miniVerse notation 91 | 92 | This repo is not endorsed by Epic Games, Inc. I'm not Epic Games employee. Made solely for learning and knowledge sharing 93 | -------------------------------------------------------------------------------- /UEFN Verse/UEFN_VerseCodex.md: -------------------------------------------------------------------------------- 1 | # UEFN / Verse Codex 2 | Attempt at standarization for style and structure of UEFN & Verse projects, feedback/your ideas more than welcome ! ❤️ 3 | post your thoughts on [Fortnite forums](https://forums.unrealengine.com/t/verse-codex-naming-conventions-program-structure-code-clarity/838073) 4 | 5 | Codex assumes strict access modifiers hygiene: expose only as much public/protected interface as needed. 6 | 7 | ## Verse style guide 8 | 9 | ### Proposed file structure 10 | 11 | * module A `````` 12 | * module B `````` 13 | * module C ``` #by default``` 14 | * module D `````` 15 | * module E `````` 16 | ---------------- 17 | 18 | General rule: statics > events > functions > fields > else 19 | 20 | module A `````` 21 | 22 | 1. **module statics** like: logs, tags, constants, messages 23 | 2. **interfaces** 24 | 3. **constructors** (non-local by API) 25 | 4. **class/struct** definition 26 | * ``` ``` 27 | * **statics** like: logs, tags, constants 28 | * **events** 29 | * **methods** 30 | * for Devices: `OnBegin()` should be high 31 | * **fields** 32 | * `@editable` should be highest 33 | * messages (non-local by API) 34 | * **ui** 35 | * **debug/temps** (good practive to keep it in one place) 36 | * `````` 37 | * `````` 38 | 5. **extension methods** adhering to class from 4. 39 | 40 | ------------ 41 | 42 | ### Naming Conventions 43 | Although not forced by compiler naming convention helps with code readability. Esp given limited capabilities of LSP atm 44 | 45 | * **types**: lower_snake_case 46 | ```diff 47 | fort_character 48 | my_new_device 49 | ``` 50 | * **variables** CamelCase 51 | ``` 52 | CoinsAmount 53 | ``` 54 | * optionals: preferably prefix "Maybe", prefix/suffix "Opt" 55 | ```diff 56 | MaybePlayer : ?player = false 57 | DamageAmountOpt : ?int = false 58 | ``` 59 | * `logic` variables with "b" prefix 60 | ```diff 61 | bContainsWeapons:logic 62 | ``` 63 | 64 | ------------- 65 | 66 | #### Functions naming 67 | * Getters start with "Get" 68 | ```diff 69 | (InAgent:agent).GetFortCharacter():fort_character 70 | ``` 71 | * `` effect might be distinguished with forming an question, e.g. "Try" or "Is" prefix 72 | ```diff 73 | TrySelectNext():void 74 | (V:vector3).IsFinite():vector3 75 | #note: for failable getters to distinguish them from non failable ones 76 | TryGetCharacter()():character 77 | ``` 78 | * Setters prefix with "Set" 79 | ```diff 80 | SetText(InText:message):void 81 | ``` 82 | * `` distinguished with "Async", pre/post 83 | ```diff 84 | AsyncMoveTo():void 85 | ``` 86 | * `` with "Make" 87 | ```diff 88 | MakeCountdownTimer() := countdown_timer: 89 | ``` 90 | 91 | ----------- 92 | 93 | ### Comments 94 | * Preffer **multi-line block comment** for multi lined comments or **indentend comment** 95 | ```diff 96 | <# This comment spans multiple lines, 97 | to avoid typing hashes all over the place preffer multi-line block comments #> 98 | 99 | <#> Or use this indentend comment 100 | use 4 spaces to add it's contents 101 | ThisFunctionIsNotCommentedOut() 102 | ``` 103 | 104 | ### Style 105 | * Line length: 150 106 | * **directives**: sorted alphabetically, ascending 107 | * first global, then local 108 | * group common elements 109 | * prefer shorer styles, use inferring were possible (untill readability suffers) e.g. 110 | ```diff 111 | if (X := Y). X else. Y 112 | # instead of 113 | if (X : type = Y): 114 | X 115 | else: 116 | Y 117 | 118 | #inferring 119 | One := 1 120 | #instead of verbose: 121 | One : int = 1 122 | ``` 123 | 124 | ### language reserved keywords 125 | ```diff 126 | # declaration keywords 127 | var 128 | set 129 | in 130 | ref 131 | alias 132 | live 133 | # logical/flow keywords 134 | if 135 | then 136 | else 137 | and 138 | or 139 | not 140 | for 141 | do 142 | # language keywords 143 | return 144 | yield 145 | break 146 | continue 147 | # other keywords 148 | where 149 | is 150 | of 151 | at 152 | until 153 | over 154 | when 155 | while 156 | with 157 | upon 158 | next 159 | catch 160 | ``` 161 | -------------- 162 | 163 | ## UEFN style guide 164 | ### Asset naming conventions 165 | For most stock UE assets working in UEFN follow [ue-5-style-guide](https://github.com/Allar/ue5-style-guide/commits?author=Allar) 166 | 167 | -------------------------------------------------------------------------------- /UEFN Verse/UEFN_VerseNotes.md: -------------------------------------------------------------------------------- 1 | DISCLAIMER: This is very much old & WIP, I've dumped few thoughts from UEFN release skimming over docs, will soon fix this and fill with info. 2 | 3 | ### UEFN Verse general info: 4 | - case sensitive globally. no strict naming conventions, You can do whatever you like, but recommendation: CamelCase values, lower_case types (snake_case for long types) 5 | - no semicolons to finish statement 6 | - indentation defines scoping 7 | - member functions and classes are overrideable by default, `override` specifier required when overriding 8 | 9 | **Comments** 10 | ```diff 11 | # This is single-line comment 12 | 13 | SomeVar : int = 3 #here comment starts, single-line comments extends till end of line 14 | 15 | 1<# inline block comment, can be put inbetween expressions and dont change them #>+2 16 | 17 | 18 | # multi-line block comment 19 | DoThis() 20 | <# And they 21 | can run multiple 22 | long lines #> 23 | DoThat() 24 | 25 | <# nested block comment <# like this #> #> 26 | 27 | # indented comment: everyting indented four spaces over after <#> is part of the code comment, anything not having four spaces is not: 28 | 29 | <#> 30 | Here is a long 31 | description spanning 32 | multiple lines. 33 | DoThis() # This expression is not part of the indented comment 34 | ``` 35 | 36 | #### Variables 37 | - **Constant variables declaration** 38 | ```diff 39 | # name : type = value 40 | WeekDaysNum : int = 7 41 | # initialization is required at declaration 42 | # note spaces do not matter 43 | WeekDaysNum:int=7 44 | 45 | ``` 46 | #### **Mutable variables declaration** 47 | - differ from constants only by ```var``` keyword 48 | ```diff 49 | # var name : type = value 50 | var Coins : int 51 | # note no initialization required 52 | ``` 53 | 54 | #### 55 | * Setting variables 56 | ```diff 57 | set YourVar = option{Player} 58 | set YourVar = option. Player 59 | ``` 60 | 61 | #### basic types 62 | 63 | - `string` 64 | ```diff 65 | "This is string" 66 | # emojiis allowed 67 | "I ❤️ Verse" 68 | ``` 69 | - `float` 70 | ```diff 71 | 10.5 72 | ``` 73 | - `int` 74 | ```diff 75 | 99 76 | ``` 77 | - `logic` usual boolean equivalent with either: false, true 78 | ``` 79 | false 80 | var TargetLocked : logic = false 81 | ``` 82 | - `void` 83 | 84 | #### keywords 85 | - `set` 86 | ```diff 87 | # changes mutable variable value 88 | set Coins = 22 89 | ``` 90 | - 91 | 92 | #### operators 93 | * query `?` postfix, use to check if `logic` is true or false 94 | ``` diff 95 | if (IsMorning?): 96 | Say("Good Morning!") 97 | ``` 98 | * failable `=` infix, to test if two logic values are equal 99 | ```diff 100 | # Initialize logic variables for demonstration purposes. 101 | var TargetLocked : logic = false 102 | var WeaponEquipped : logic = true 103 | 104 | # Determine whether or not the "unavailable action" icon is appropriate. 105 | if (WeaponEquipped <> TargetLocked): 106 | # The icon should show up, because the player appears to be trying to 107 | # attack, but is missing either a weapon or a target. 108 | ShowUnavailableIcon() 109 | ``` 110 | * `and`, `or` infix 111 | ``` dif 112 | if (Tired? or SchoolTomorrow?): 113 | set WhatToWatch = "your eyelids" 114 | else if (FriendsAvailable?): 115 | set WhatToWatch = "a movie with your friends" 116 | else: 117 | set WhatToWatch = "cartoons" 118 | ``` 119 | 120 | #### logging 121 | ```diff 122 | CoinsAmount : int = 2 123 | # string taking curly braces "{}" allows operation evaluation before Print() gets executed: 124 | Print(" 2 + Coins amount = {2 + CoinsAmount}") 125 | # Logs: 2 + Coins amount = 4 126 | 127 | Print(" Concatenated string: {"I " + "❤️ " + " Verse"}") 128 | # Logs: Concatenated string: I ❤️ Verse 129 | ``` 130 | 131 | #### conditional expressions 132 | - `if` `else` 133 | ```diff 134 | var Tired: logic = false 135 | var WhatToWatch: string = “nothing” 136 | 137 | if (Tired?): 138 | set WhatToWatch = “your eyelids” #note indentation defines scope, if Tired? = true, only this expression will be evaluated, else: scope will be omitted 139 | else: 140 | set WhatToWatch = “cartoons” 141 | 142 | Print(“You should watch {WhatToWatch}”) 143 | 144 | # logs: You should watch cartoons 145 | ``` 146 | 147 | #### functions 148 | * function (routine) declaration 149 | ```diff 150 | #function signature: 151 | # name() : type = 152 | #codeblock/body has local scope 153 | 154 | PrintHelloWorld() : void = 155 | Print("Hello World") 156 | ``` 157 | * function call 158 | ```diff 159 | PrintHelloWorld() 160 | ``` 161 | * member functions: **methods** 162 | ```dif 163 | # call a member function 164 | Cat.Pounce() 165 | ``` 166 | 167 | * Calling method that can fail/succeed, used with `` **specifier** **effect** in failure context 168 | ```diff 169 | # explicit notation for querying failable function in failure context 170 | if (FailableMethod[]): 171 | Print("Failable function succeeded") 172 | ``` 173 | * `return` works mostly like cpp 174 | ```diff 175 | WIP 176 | ``` 177 | 178 | ### classes 179 | * **composite** type made of bundle of data from other **types** 180 | * inheritance by subclasses 181 | * methods - member functions 182 | 183 | ### attributes `@` 184 | * `@editable` 185 | * not supported for classes that aren’t `` 186 | ```diff 187 | # DefaultCreativePropAsset must be used for creative_prop_asset type, other types can instantiate normally with {} notation 188 | @editable 189 | PropAssetRef : creative_prop_asset = DefaultCreativePropAsset 190 | ``` 191 | 192 | ### `using` directive 193 | ```diff 194 | using. /Fortnite.com/Devices 195 | using { /Verse.org/Simulation } 196 | ``` 197 | --------------------------------------------------------------------------------