ModBuild

Discussions about Coding and Scripting
User avatar
Gustavo6046
Godlike
Posts: 1264
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Zeta Group leader
Location: Brazil

ModBuild

Post by Gustavo6046 » Thu Oct 21, 2021 12:50 am

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.

User avatar
Shrimp
Experienced
Posts: 148
Joined: Wed Oct 10, 2018 11:15 am
Location: Australia

Re: ModBuild

Post by Shrimp » Sat Oct 23, 2021 6:00 am

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 20 years of user-created content for the Unreal series!

User avatar
Gustavo6046
Godlike
Posts: 1264
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Zeta Group leader
Location: Brazil

Re: ModBuild

Post by Gustavo6046 » Sun Oct 24, 2021 12:25 am

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 :)

1337GameDev
Skilled
Posts: 175
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: ModBuild

Post by 1337GameDev » 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 ..

User avatar
Gustavo6046
Godlike
Posts: 1264
Joined: Mon Jun 01, 2015 7:08 pm
Personal rank: Zeta Group leader
Location: Brazil

Re: ModBuild

Post by Gustavo6046 » Thu Jan 13, 2022 7:18 am

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

1337GameDev
Skilled
Posts: 175
Joined: Thu Apr 16, 2020 3:23 pm
Personal rank: GameDev

Re: ModBuild

Post by 1337GameDev » Fri Jan 14, 2022 4:57 am

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.