ModBuild

Discussions about Coding and Scripting
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil

ModBuild

Post by Gustavo6046 »

See on GitHub.



ModBuild

This is a build system that lets you, the modder, spend more of your time writing your mod, and less of it dealing with building it.

What I mean by this is that you can simply

It is useful for the following reasons:
  • Easily building your mod (if on Linux) with a single command!
  • Versioning your mod ostensibly!
  • Having GitHub build your mod for you, and even release it for you if you tag it accordingly, via the Github Actions CI workflow
    (which includes checking possible compiler errors in your commits); yay for convenience!
There are, however, drawbacks, which can be more insightful than the
strengths, and an exercise in humility. See:
  • Does not work natively on Windows: you will need WSL, or Cygwin or Msys2, or even a virtual machine or container.
    This build system is built around Linux, in and out.
    This does not mean you cannot use it from Windows, but if you want to build locally, it will require an environment that is compatible with what you see in Linux, including Bash.
    Or, just use CI!
  • This build system requires installing Go, precisely because of Mustache.
    Golang is a bit of a heft, and I can understand why this can be a turn-off for some people.
  • To me it feels a bit hacky... though, sure, that is subjective.
  • The CI workflow only works in GitHub.
    I'm not shilling Microsoft, it's just the one CI I know how to work with.
    Adding support for Travis CI, and maybe even GitLab CI, may be considered for the near future, but I wouldn't hold my breathe if I were you.
  • It's difficult to update ModBuild once you start using it. This should be rectified in the near future. How? Good question.
It was still a hell of a lot of fun to work on, and I sincerely really hope that, if you consider using this for your mod, it helps you have more fun working on it too :)


For more information on its usage, see the GitHub repo.
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
User avatar
Shrimp
Adept
Posts: 299
Joined: Wed Oct 10, 2018 11:15 am
Location: Australia

Re: ModBuild

Post by Shrimp »

This is really cool.

I'm surprised we haven't seen more CI tooling yet (or more likely I just haven't see it). This seems like a pretty neat solution, which I'm sure can get refined over time :gj:
ShrimpWorks
Unreal Archive - preserving over 25 years of user-created content for the Unreal series!
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil

Re: ModBuild

Post by Gustavo6046 »

Aw, thank you!

Yeah, it could use some refinement. For instance, it feels a bit all over the place with regards to, say, the values that are formatted in through Mustache. I think it also leaves built files in the build tree's System folder, and just copies them into dist instead of removing them, but I forgot that part, I'll check momentarily.

It could also have the mod source tree separate from the one where the Makefile and other build system files are, right now I didn't have that in mind when I wrote it. I'd love to do this because it'd allow mods to simply have this as a Git submodule.

By the way, thanks for assisting with the hairy Mustache dependency stuff! I should start a credits file or something :)
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: ModBuild

Post by 1337GameDev »

Interesting. What does this tool provide that git via command-line / the github client and a batch script+doskey macro can't do?

I currently have a batch file in my ut99 folder, and a "macros.doskey" entry registered with windows that calls my batch scripts to build as well as run my test map from any cmd instance.

My batch script is just:

@ECHO OFF
cd %~dp0\System
del /f MyMod.u
del /f UnrealTournament.log
copy NUL UnrealTournament.log
ucc make
cd ..

and then:

@ECHO OFF
cd %~dp0\System
start UnrealTournament.exe "TEST-TestBox.unr" -no3dsound -windowed
cd ..
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil

Re: ModBuild

Post by Gustavo6046 »

1337GameDev wrote: Sat Nov 13, 2021 7:18 am Interesting. What does this tool provide that git via command-line / the github client and a batch script+doskey macro can't do?

I currently have a batch file in my ut99 folder, and a "macros.doskey" entry registered with windows that calls my batch scripts to build as well as run my test map from any cmd instance.

My batch script is just:

@ECHO OFF
cd %~dp0\System
del /f MyMod.u
del /f UnrealTournament.log
copy NUL UnrealTournament.log
ucc make
cd ..

and then:

@ECHO OFF
cd %~dp0\System
start UnrealTournament.exe "TEST-TestBox.unr" -no3dsound -windowed
cd ..
Sorry for the late response!

Batch scripts are a Windows thing. This project standardizes mod biulding for Linux systems. While it is not cross-platform, Linux is the dominant form of continuous integration (aka building things "on the cloud"), so it allows e.g. automating building a mod with a simple 'git push'. You don't need to do any manual tweaking either; no messing with EditPackages in UnrealTournament.ini, you can simply run 'make' and it'll do all the things automatically.

Heck, it doesn't even need a pre-existing copy of Unreal Tournament! It takes care of that on its own (the README explains this well). Which among other things means you can simply put this on a folder alongside other projects, rather than git cloning UT-related projects into the UnrealTournament folder and making a mess. There are environment variables available so that you can reuse the same UT server path (used just to use ucc) for every project, avoiding waste of disk space. See the top of the Makefile. This also makes CI/CD a hell of a breeze, and even using this with Docker or Podman if you're that inclined.

As for your batch script, yes, that's kind of the approach I used to take when I was ytounger! :D
I do howerver suggest that, instead of outright removing the "old" version of a package (if any), you move it to a backup folder, in case the build goes wrong. Maybe make a subfolder with the timestamp and move pre-existing files to there, to !


Just a little sidenote. If you have an IDE with plugin support, don't use the GitHub Client, it's slow because of Electron and it's kind of redundant. Most general-purpose IDEs, like Atom and Visual Studio Code, support Git integration and even some level of GitHub integration, either out of the box or with plugins (or both). I like using Atom; I don't like running 50 Electron apps at the same time on my system! :p
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction
1337GameDev
Skilled
Posts: 198
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: ModBuild

Post by 1337GameDev »

Interetsing. A pretty neat script. i might explore it in the future. I love atom, and wish it had U1 script support (ive only been able to find u2 -- and considered making a grammar for u1 scripts but havent gotten around with it).

I generally code ut99 stuff on windows, so batch files work well. And I do routinely back up my projects via git, so I don't need to really save my output builds. :noidea

I generally don't have much issue with electronc apps, as the only ones I run, I run when I need them. The biggest hit is around 150mb of bootstrap webview/dependency code, which on my system, is very much a non-issue as I have 8gb of ram and don't open much at once (aside from chrome tabs of course ha).

I thought about integration with git command line, but I vastly prefer a UI, as handling any merge / issues with authentication are a huge pain. It's also much easier to edit prior commits before you push / their comments.

I used to use git command line for other projects, and it just got old.

For ut99 editing, I mainly use notepad++ and WOTgreal for intellisense+highlighting.
User avatar
Gustavo6046
Godlike
Posts: 1462
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Resident Wallaby
Location: Porto Alegre, Brazil

Re: ModBuild

Post by Gustavo6046 »

I was thinking about something.

ModBuild should support building with another mod as a dependency. @Shrimp how could we do that? It should be able to (optionally build, then) install the dependency packages into the temporary UT build directory before building the current project. Perhaps, for such dependency resolution, we should move to a language that is more powerful (and platform agnostic!) than mere Makefiles. Like, I dunno... Rust?


---


In other news, a "lock file" mechanism has been added. A lock file contains the hashes of dependencies that are put in build/deps by the Makefile. During a local build, a lock file is automatically generated. This way, when you publish your commit to Git, CI scripts can cache the contents of the dependencies directory and retrieve them as long as the lock file remains identical.

Any change to the downloaded dependencies will require a local update to the lock file.

Additionally, GitLab CI support was added.

There is a chance GitHub detects the GitLab CI file and refuses to run the GitHub Actions workflows for you. :wth: :facepalm:
If that is the case for you, try removing .gitlab-ci.yml from your codebase, then make a commit of that deletion and push it to your GitHub repo. Hopefully that fixes it.

If you're already using ModBuild in your project and want to update to use this cool new feature, just perform the following operations.

If your repository consists of changes to the UT-ModBuild template tracked by Git, a git merge like below suffices.

Code: Select all

git remote add modbuild https://gitlab.com/Gustavo6046/ut-modbuild
git fetch modbuild
git merge moduilb/main
If your repository is based on the UT-ModBuild template but not tracked by Git, a git cherrypick like below will be needed.

Code: Select all

git remote add modbuild https://gitlab.com/Gustavo6046/ut-modbuild
git fetch modbuild
git cherrypick ef6068e..3712abe
"Everyone is an idea man. Everybody thinks they have a revolutionary new game concept that no one else has ever thought of. Having cool ideas will rarely get you anywhere in the games industry. You have to be able to implement your ideas or provide some useful skill. Never join a project whose idea man or leader has no obvious development skills. Never join a project that only has a web designer. You have your own ideas. Focus on them carefully and in small chunks and you will be able to develop cool projects."

Weapon of Destruction