From 041d2ed2bb07651ce7fd1bfa4a95717d91c50115 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Fri, 24 Jan 2025 15:02:23 -0800 Subject: [PATCH] Makefile: manage targets `netradiant-custom` and add NRC gamepack integration. --- BUILDING | 82 ++++++++++++++++++++++++ Makefile | 186 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- README | 11 +++- 3 files changed, 267 insertions(+), 12 deletions(-) create mode 100644 BUILDING diff --git a/BUILDING b/BUILDING new file mode 100644 index 0000000..76290ec --- /dev/null +++ b/BUILDING @@ -0,0 +1,82 @@ +# Building Manual + +## Introduction + +The Makefile (tested with GNU Make) contains an assortment of targets +that will make building of assets and code into the game easier. + +Here we will discuss the various targets mentioned, you can build +any of them at any time (dependencies should resolve themselves) +using the usual `make` syntax: + + make _target_ GAME=id1 + +Where `_target_` is to be substituted with a valid target. +The `GAME=` override decides which game directory to target. + +Generally, you want to make a copy of either `id1`, `qw` or `data1`, +name it something original (say `foobar`) and then you would +pass `GAME=foobar` instead of `GAME=id1`. + +If the GAME variable isn't passed, `id1` is assumed. + +## Targets + +### help + +Will display some short help information on important targets +that are available. + +### all + +Build all of the code, models, maps, textures and 2D graphics for +a given game. + +### pak + +Will build pak0.pak and pak1.pak files (shareware and registered archives) for your +game. Ensure you use the right Precache_* APIs so the tool knows which data belongs +to shareware and which to registered versions of your game. + +### wad + +Builds all texture wads for a given game. + +### maps + +Builds all the maps (and texture wads) for a given game. + +### GAME/maps/mapname.bsp + +Will compile GAME/maps/mapname.bsp. So if you were to run `make id1/maps/start.bsp`, that would be valid - as long as `id1/mapsrc/start.map` was to exist. + +### models + +Builds all models for a given game using FTEQW's iqmtool. + +### defs + +Builds an entities.def file for use in QED/Radiant and integrates it. + +### gfx + +Builds all the 2D graphics (menu mainy) for a given game. + +### palette + +Rebuilds the palette for the given game. Reads from GAME/gfxsrc/palette.png and will ensure to build a new palette.lmp for use in the engine, as well as a colormap.lmp for software renderers as well as a palette.pal for use in WorldCraft based editors. + +### update + +Updates ThirdParty repos. + +### radiant + +Builds GtkRadiant and integrates it with a launcher: ./radiant + +### launcher + +Builds a launcher for your game. Will accept command-line arguments and will execute a config +file with your username if present. This way developers can stay out of each others way, even +on a non-versioned filesystem. + diff --git a/Makefile b/Makefile index b8ba676..f17a95e 100644 --- a/Makefile +++ b/Makefile @@ -16,7 +16,12 @@ RADIANT_XLINK="$(NUCLIDE_DIR)/ThirdParty/gtkradiant/install/installs/$(NAME)Pack RADIANT_SYNAPSE="$(NUCLIDE_DIR)/ThirdParty/gtkradiant/install/installs/$(NAME)Pack/game/synapse.config" RADIANT_PROJECT="$(NUCLIDE_DIR)/ThirdParty/gtkradiant/install/installs/$(NAME)Pack/install/$(GAME)/scripts/default_project.proj" RADIANT_TEXTURES="$(NUCLIDE_DIR)/ThirdParty/gtkradiant/install/installs/$(NAME)Pack/install/$(GAME)/textures" -ENTITY_DEF="$(NUCLIDE_DIR)/ThirdParty/gtkradiant/install/installs/$(NAME)Pack/install/$(GAME)/scripts/entities.def" +RADIANT_DEF="$(NUCLIDE_DIR)/ThirdParty/gtkradiant/install/installs/$(NAME)Pack/install/$(GAME)/scripts/entities.def" + +NRC_GAME="$(NUCLIDE_DIR)/ThirdParty/netradiant-custom/install/gamepacks/games/$(NAME).game" +NRC_GAMEDIR="$(NUCLIDE_DIR)/ThirdParty/netradiant-custom/install/gamepacks/$(NAME).game/$(GAME)/" +NRC_DEF="$(NRC_GAMEDIR)/entities.ent" +NRC_SYNAPSE="$(NRC_GAMEDIR)/../default_build_menu.xml" EDITOR_QBSP="$(ARGSTR)TEMPLATEenginepath/qbsp" EDITOR_QVIS="$(ARGSTR)TEMPLATEenginepath/qvis" @@ -53,10 +58,10 @@ pak: game qfiles run: fteqw game ./fteqw -basedir `pwd` -netquake -game $(GAME) -wad: imgtool palette +wads: imgtool palette ./Tools/build_wads.sh $(GAME) -maps: wad +maps: wads ./Tools/build_maps.sh $(GAME) $(GAME)/maps/%.bsp: qbsp qrad qvis @@ -65,9 +70,6 @@ $(GAME)/maps/%.bsp: qbsp qrad qvis models: iqmtool palette ./Tools/build_models.sh $(GAME) -edef: - Tools/make_mapdef.sh $(GAME) - gfx: imgtool palette cd $(GAME)/gfxsrc/ && ls | grep -v palette\.lmp | grep \.xcf | xargs ../../imgtool --rgb8 --ext png cd $(GAME)/gfxsrc/ && ls | grep -v palette\.png | grep \.png | xargs mogrify -type TrueColor -compress None -flip -format tga @@ -142,13 +144,22 @@ qrad: radiant: update if [ ! -d ThirdParty/gtkradiant ];then git clone https://github.com/TTimo/gtkradiant ThirdParty/gtkradiant;fi - cd ThirdParty/gtkradiant && scons + cd ./ThirdParty/gtkradiant && scons target="radiant" + mkdir -p ./ThirdParty/gtkradiant/install/games + mkdir -p ./ThirdParty/gtkradiant/install/installs Tools/make_launcher.sh ./ThirdParty/gtkradiant/install/ ./radiant.bin radiant +netradiant-custom: + if [ ! -d ThirdParty/netradiant-custom ];then git clone https://github.com/Garux/netradiant-custom ThirdParty/netradiant-custom;fi + cd ThirdParty/netradiant-custom && $(MAKE) DOWNLOAD_GAMEPACKS=no BUILD=debug RADIANT_ABOUTMSG="NuclideLite managed build." + mkdir -p ./ThirdParty/netradiant-custom/install/gamepacks/games + Tools/make_launcher.sh ./ThirdParty/netradiant-custom/install/ ./radiant.x86_64 netradiant-custom + launcher: Tools/make_launcher.sh "./" "./fteqw -readonly -basedir ./ -netquake -game $(GAME) +exec $(USER).cfg" $(GAME).sh -radiant-game: radiant edef +defs: radiant netradiant-custom + Tools/make_mapdef.sh $(GAME) echo "" > "$(RADIANT_GAME)" echo "> "$(RADIANT_GAME)" echo " name=\"$(NAME)\"" >> "$(RADIANT_GAME)" @@ -192,7 +203,7 @@ radiant-game: radiant edef echo "wad" >> "$(RADIANT_SYNAPSE)" echo "" >> "$(RADIANT_SYNAPSE)" mkdir -p "$(NUCLIDE_DIR)/ThirdParty/gtkradiant/install/installs/$(NAME)Pack/install/$(GAME)/scripts" - cp "$(GAME)/scripts/entities.def" "$(ENTITY_DEF)" + cp "$(GAME)/scripts/entities.def" "$(RADIANT_DEF)" echo "" > "$(RADIANT_PROJECT)" echo "" >> "$(RADIANT_PROJECT)" echo "" >> "$(RADIANT_PROJECT)" @@ -214,3 +225,160 @@ radiant-game: radiant edef mkdir -p "$(HOME)/.$(GAME)/$(GAME)/scripts" rsync -rva "$(NUCLIDE_DIR)/ThirdParty/gtkradiant/install/installs/$(NAME)Pack/install/$(GAME)/." "$(HOME)/.$(GAME)/$(GAME)/." rsync -rva "$(NUCLIDE_DIR)/ThirdParty/gtkradiant/install/installs/$(NAME)Pack/install/$(GAME)/." "./$(GAME)/." + mkdir -p "$(NRC_GAMEDIR)" + echo "" > "$(NRC_GAME)" + echo "> "$(NRC_GAME)" + echo " type=\"q1\"" >> "$(NRC_GAME)" + echo " name=\"$(NAME)\"" >> "$(NRC_GAME)" + echo " enginepath_linux=\"c:$(NUCLIDE_DIR)\"" >> "$(NRC_GAME)" + echo " enginepath_win32=\"c:$(NUCLIDE_DIR)\"" >> "$(NRC_GAME)" + echo " engine_win32=\"fteqw.exe\"" >> "$(NRC_GAME)" + echo " engine_linux=\"fteqw\"" >> "$(NRC_GAME)" + echo " basegame=\"$(GAME)\"" >> "$(NRC_GAME)" + echo " basegamename=\"$(NAME)\"" >> "$(NRC_GAME)" + echo " unknowngamename=\"Custom Quake modification\"" >> "$(NRC_GAME)" + echo " default_scale=\"1.0\"" >> "$(NRC_GAME)" + echo " no_patch=\"1\"" >> "$(NRC_GAME)" + echo " no_bsp_monitor=\"1\"" >> "$(NRC_GAME)" + echo " show_wads=\"1\"" >> "$(NRC_GAME)" + echo " archivetypes=\"pak wad\"" >> "$(NRC_GAME)" + echo " texturetypes=\"tga jpg mip hlw\"" >> "$(NRC_GAME)" + echo " modeltypes=\"mdl\"" >> "$(NRC_GAME)" + echo " maptypes=\"mapq1\"" >> "$(NRC_GAME)" + echo " shaders=\"quake3\"" >> "$(NRC_GAME)" + echo " entityclass=\"quake3\"" >> "$(NRC_GAME)" + echo " entityclasstype=\"def xml\"" >> "$(NRC_GAME)" + echo " entities=\"quake3\"" >> "$(NRC_GAME)" + echo " brushtypes=\"quake\"" >> "$(NRC_GAME)" + echo " patchtypes=\"quake3\"" >> "$(NRC_GAME)" + echo "/>" >> "$(NRC_GAME)" + cp "$(GAME)/scripts/entities.def" "$(NRC_DEF)" + echo "" > $(NRC_SYNAPSE) + echo "" >> $(NRC_SYNAPSE) + echo " \"[EnginePath]qbsp\"" >> $(NRC_SYNAPSE) + echo " \"[EnginePath]qvis\"" >> $(NRC_SYNAPSE) + echo " \"[EnginePath]qrad\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] -onlyents \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -fast \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -noambient \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -noambient -fast \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] -extra \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] -extra4x4 \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] -extra \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] -extra4x4 \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] \"[MapFile]\" " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] -extra \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] -extra4x4 \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -fast \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -fast \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -fast \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] -extra \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -fast \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] -extra4x4 \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -noambient \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -noambient \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -noambient \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] -extra \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -noambient \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] -extra4x4 \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -noambient -fast \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -noambient -fast \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] \"[MapFile]\" " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -noambient -fast \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] -extra \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo " [bsp] \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [vis] -noambient -fast \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " [light] -extra4x4 \"[MapFile]\"" >> $(NRC_SYNAPSE) + echo " " >> $(NRC_SYNAPSE) + echo "" >> $(NRC_SYNAPSE) diff --git a/README b/README index 8592ec8..52eae85 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Nuclide-Vanilla +Nuclide-Lite This is a tiny pet project that will offer you a bit of Nuclide for the most barebone Quake engine on planet Earth: Quake. @@ -12,7 +12,7 @@ such as the Dreamcast without doing any heavy engine modifications. Games can then query a very simple API and get started making games rather quickly! There are 3 sample directories. Each has a different engine/protocol target: -q1 = Quake, qw = QuakeWorld, h2 = Hexen II. +id1 = Quake, qw = QuakeWorld, data1 = Hexen II. Copy the base you'd like to target. If you need to switch targets later down the line simply either this to your progs.src: @@ -24,5 +24,10 @@ This will make Nuclide target those protocol standards instead. Games should ideally not break. Nuclide tries its best to ensure the code builds, but the behaviour may be slightly different between the targets. +Read BUILDING for details on how to make use of the Makefile switches +available in the project. + Hope you enjoy, -Marco \ No newline at end of file + +Marco Cawthorne +Vera Visions, LLC \ No newline at end of file