Jump to content

Mods:Introduction: Difference between revisions

From Logic World Wiki
m Another mod example finished, TO-DO shortened. Hopefully we can finish the TO-DO list?
Made the introduction actually good.
Line 1: Line 1:
{{stub}}
{{stub}}


[[Logic World]] currently features '''unofficial''' first-party modification (mod) support, this means, the Logic World client / server will load & compile mods, and while this will most likely be maintained, it might be lacking some quality of life features, and the API may undergo heavy changes. Though, this does '''not''' mean that every game update will break the game.
[[Logic World]] currently features '''unofficial''' first-party [[modification]] support. While the Logic World client / server will load and compile mods, it hasn't been fully implemented, and the [[Mods:LogicAPI|API]] may undergo changes per update, which has a chance to break certain mods.


Of course the probability of a mod breaking depends on how deep you are interfacing with the game; if you are simply adding components it is likely that updating the mod will be very easy or not even necessary.
Of course, the probability of a mod breaking depends on how deep you are interfacing with the game. If you’re making simple components, updating the mod should be easy if it breaks.


There are currently two built-in ways of adding components to the game:
There are currently two built-in ways of adding functionality to components in your mod:


== C# ==
== C# ==
This allows you to edit nearly all game code, and thus there is almost no limit to what can be achieved. Most mods are currently written this way, and thus you will find many pre-existing that you could base your mod off of. If you are already familiar with programming, with C, C++, Java, or with C# itself, it should be very easy to pick up the concepts. But even in case you are not, it should be fairly easy to just tweak an existing mod and pick up the language that way.
[[wikipedia:C_Sharp_(programming_language)|C# (C-sharp)]] is a programming language developed by Microsoft in 2002. It's '''similar''' to [[wikipedia:Java_(programming_language)|Java]], which if you already know the language, can help you learn C#, and develop mods, if you don't already know how to program in C#.  


The initial setup consists of creating a manifest.jecs<ref>Formerly, <code>.jecs</code> files used the <code>.succ</code> file-extension.</ref> file, along with any required folders. This initial structure could look like, as follows, though empty folders can be omitted:
Logic World is programmed primarily in C#, which is also the scripting language used by its current engine, Unity.
YourMod/ <-- This folder ('''not''' its contents) is supposed to be placed into the GameData folder when installing the mod
 
  manifest.jecs
Almost all mods for Logic World are programmed in C#. Mods are distributed as [[Mod Distribution Formats|source]], and the game compiles them into [https://learn.microsoft.com/en-us/troubleshoot/windows-client/setup-upgrade-and-drivers/dynamic-link-library DLLs] that it caches in the <code>cache</code> folder. This allows you to edit nearly all of Logic World's code if you use [https://harmony.pardeike.net/ Harmony], and thus there is almost no limit to what you can create.
  components/
 
  <.jecs component files> <-- these files define the actual component shapes, colors, peg counts and reference the C# code, if desired
While currently not fully supported, you can distribute your mod as a zip file with the <code>[[Mod Distribution Formats|lwmod]]</code> suffix.
  languages/
 
  English/
If you are unfamiliar with C#, but have knowledge in other languages like [[wikipedia:C++|C++]], [[wikipedia:Python_(programming_language)|Python]], or other [[wikipedia:Object-oriented_programming|OOP]] languages, it should be fairly easy to pick up the concepts. To help yourself learn C#, you can tweak an existing mod (like the ones from below) and pick up the language that way, or refer to other ways of learning C#, like using [https://www.youtube.com/results?search_query=Learn+C%23 YouTube], [https://www.w3schools.com/cs/index.php W3Schools], or the [https://learn.microsoft.com/en-us/dotnet/csharp/ C# documentation].
    English.jecs <-- Translation files simply map an internal name, e.g. author.modname.componentname to a human readable name, e.g. And Gate; See the MHG basemod for a complete list of supported languages.
  French/
    French.jecs
  <other language folders>
  src/ <-- (indirectly) contains all C# source files, which will be compiled when starting the game
  client/
    <.cs source files>
  server/
    <.cs source files>
{| class="wikitable sortable"
{| class="wikitable sortable"
|+Examples to base your mod off of
|+C# Mods to base your own mod on
!Mod Name
!Mod Name
!Description
!Description
Line 34: Line 24:
!License
!License
|-
|-
|MHG (basemod)
|[[Mouse Hat Games|MHG]] (basemod)
|The Logic World base mod which contains most game content.
|The Logic World base mod which contains most game content.
|Located in your <code>Logic World/GameData</code> folder
|Located in Logic World's <code>GameData</code> folder.
|All Rights Reserved
|All Rights Reserved
|-
|-
Line 45: Line 35:
|-
|-
|MorLogic
|MorLogic
|Simple Logic World mod adds XNOR, OR, NOR, NAND gates.
|Simple Logic World mod that adds XNOR, OR, NOR, and NAND gates.
|https://github.com/ru0wl/morlogic
|https://github.com/ru0wl/morlogic
|MIT
|MIT
|-
|-
|Dynamic Nand Gate
|Dynamic Nand Gate
|Adds a basic NAND Gate component that uses dynamic pegs.
|Adds a basic NAND gate component that uses dynamic pegs.
|https://github.com/FoxFireFive0135/Dynamic-Nand-Gate
|https://github.com/FoxFireFive0135/Dynamic-Nand-Gate
|MIT
|MIT
|-
|-
|Tcp Bridge
|TCP Bridge
|Adds a component supporting real-world tcp connections. Farily complex, but shows off using threads within components.
|Adds a component supporting real-world TCP connections. Fairly complex, but shows off using threads within components.
|https://github.com/GHXX/LogicWorld-TcpBridge
|https://github.com/GHXX/LogicWorld-TcpBridge
|MIT
|MIT
|}
|}
{{Todo|List more mods that perform various actions, e.g. one that adds custom UI; maybe one for adding chat commands or something; etc.}}
{{Todo|List more mods that perform various actions. e.g. one that adds custom UI; one for adding chat commands; one using Harmony to edit game code; etc...}}


To learn how to create your first mod refer to the [[Mods:Bare Bones|Bare Bones]] mod guide.
{{Todo|actually create the guide}}


== Logic Script ==
== Logic Script ==
This is an alternative way which requires less programming knowledge, but is much more limited.
LogicScript is a built-in scripting language which you can use instead of C#. There is currently the issue with LogicScript that it is likely to be removed<ref>LogicScript is likely to be removed.[[File:JimmySayingHeWillLikelyRemoveLogicScript.png|frameless]]</ref>, but for now you can still make mods with it.
{{Todo|describe logic script. Reference: https://github.com/pipe01/LogicScript/wiki/Syntax-reference}}
 
It is much less powerful than C#, and fairly complex.  
 
A LogicScript script is executed sequentially from top to bottom. The script is composed of port declarations, constant declarations, and code blocks.
 
{{Todo|describe LogicScript better. Reference: https://github.com/pipe01/LogicScript/wiki/Syntax-reference}}


== References ==
== References ==
<references />
<references />

Revision as of 07:44, 7 March 2026

This article is a stub. Please help expand it by adding content.

Logic World currently features unofficial first-party modification support. While the Logic World client / server will load and compile mods, it hasn't been fully implemented, and the API may undergo changes per update, which has a chance to break certain mods.

Of course, the probability of a mod breaking depends on how deep you are interfacing with the game. If you’re making simple components, updating the mod should be easy if it breaks.

There are currently two built-in ways of adding functionality to components in your mod:

C#

C# (C-sharp) is a programming language developed by Microsoft in 2002. It's similar to Java, which if you already know the language, can help you learn C#, and develop mods, if you don't already know how to program in C#.

Logic World is programmed primarily in C#, which is also the scripting language used by its current engine, Unity.

Almost all mods for Logic World are programmed in C#. Mods are distributed as source, and the game compiles them into DLLs that it caches in the cache folder. This allows you to edit nearly all of Logic World's code if you use Harmony, and thus there is almost no limit to what you can create.

While currently not fully supported, you can distribute your mod as a zip file with the lwmod suffix.

If you are unfamiliar with C#, but have knowledge in other languages like C++, Python, or other OOP languages, it should be fairly easy to pick up the concepts. To help yourself learn C#, you can tweak an existing mod (like the ones from below) and pick up the language that way, or refer to other ways of learning C#, like using YouTube, W3Schools, or the C# documentation.

C# Mods to base your own mod on
Mod Name Description Link License
MHG (basemod) The Logic World base mod which contains most game content. Located in Logic World's GameData folder. All Rights Reserved
Basic Logic World Mod Adds a basic NAND Gate component to Logic World. https://github.com/FoxFireFive0135/Basic-Logic-World-Mod MIT
MorLogic Simple Logic World mod that adds XNOR, OR, NOR, and NAND gates. https://github.com/ru0wl/morlogic MIT
Dynamic Nand Gate Adds a basic NAND gate component that uses dynamic pegs. https://github.com/FoxFireFive0135/Dynamic-Nand-Gate MIT
TCP Bridge Adds a component supporting real-world TCP connections. Fairly complex, but shows off using threads within components. https://github.com/GHXX/LogicWorld-TcpBridge MIT

TODO: List more mods that perform various actions. e.g. one that adds custom UI; one for adding chat commands; one using Harmony to edit game code; etc...

To learn how to create your first mod refer to the Bare Bones mod guide.


TODO: actually create the guide

Logic Script

LogicScript is a built-in scripting language which you can use instead of C#. There is currently the issue with LogicScript that it is likely to be removed[1], but for now you can still make mods with it.

It is much less powerful than C#, and fairly complex.

A LogicScript script is executed sequentially from top to bottom. The script is composed of port declarations, constant declarations, and code blocks.


TODO: describe LogicScript better. Reference: https://github.com/pipe01/LogicScript/wiki/Syntax-reference

References

  1. LogicScript is likely to be removed.