Commit graph

26 commits

Author SHA1 Message Date
Hat Kid c64eea6337
[buildactor] support generating collide-meshes for custom models (#3540)
This adds support for generating collide meshes when importing custom
models. A couple of things to keep in mind:

- A single `collide-mesh` may only have up to 255 vertices.
- When exporting a GLTF file in Blender, a `collide-mesh` will be
generated for every mesh object that has collision properties applied
(ideally, you would set all visual meshes to `ignore` and your collision
meshes to `invisible` in the OpenGOAL plugin's custom properties).
- Ensure that your actor using the model properly allocates enough
`collide-shape-prim-mesh`es for each `collide-mesh` ([example from the
original game that uses multiple
meshes](f6688659f2/goal_src/jak1/levels/finalboss/robotboss.gc (L2628-L2806))).

~One annoying problem that I haven't fully figured out yet (unrelated to
the actual functionality):
`collide-mesh`es are stored in art groups as an `(array collide-mesh)`
in the `art-joint-geo`'s `extra`, so I had to add a new `Res` type to
support this. The way that `array`s are stored in `res-lump`s is a bit
of a hack right now. The lump only stores a pointer to the array, so the
size of that is 4 bytes, but because we have to generate all the actual
array data too, the current `ResLump` code in C++ doesn't handle this
case well and would assert, so I decided to omit the asserts if an
`array` tag is present and "fake" the size so the object file is
generated more closely to how the game expects it until we figure out
something better.~
This was fixed by generating the array data beforehand and creating a
`ResRef` class that takes the pointer to the array data and adds it to
the lump.
2024-05-29 06:09:20 +02:00
Hat Kid 62ef9fe49d
[wip] build actor tool (#3266)
This does a couple of things:

- The `custom_levels` folder was renamed to `custom_assets` and contains
`levels`, `models` and `texture_replacements` folders for Jak 1, 2 and 3
in order to keep everything regarding custom stuff in one place.
- With this, texture replacements now use separate folders for all games
- A build actor tool was added that generates art groups for custom
actors
- Custom levels can now specify what custom models from the `models`
folder they want to import, this will add them to the level's FR3.
- A `test-zone-obs.gc` file was added, containing a `test-actor` process
that uses a custom model as an example.

The build actor tool is still very WIP, the joints and the default
animation are hardcoded, but it allows for importing any GLB file as a
merc model.
2024-05-18 18:18:25 +02:00
Tyler Wilding d1ece445d4
Dependency graph work - Part 1 - Preliminary work (#3505)
Relates to #1353 

This adds no new functionality or overhead to the compiler, yet. This is
the preliminary work that has:
- added code to the compiler in several spots to flag when something is
used without being properly required/imported/whatever (disabled by
default)
- that was used to generate project wide file dependencies (some
circulars were manually fixed)
- then that graph underwent a transitive reduction and the result was
written to all `jak1` source files.

The next step will be making this actually produce and use a dependency
graph. Some of the reasons why I'm working on this:
- eliminates more `game.gp` boilerplate. This includes the `.gd` files
to some extent (`*-ag` files and `tpage` files will still need to be
handled) this is the point of the new `bundles` form. This should make
it even easier to add a new file into the source tree.
- a build order that is actually informed from something real and
compiler warnings that tell you when you are using something that won't
be available at build time.
- narrows the search space for doing LSP actions -- like searching for
references. Since it would be way too much work to store in the compiler
every location where every symbol/function/etc is used, I have to do
ad-hoc searches. By having a dependency graph i can significantly reduce
that search space.
- opens the doors for common shared code with a legitimate pattern.
Right now jak 2 shares code from the jak 1 folder. This is basically a
hack -- but by having an explicit require syntax, it would be possible
to reference arbitrary file paths, such as a `common` folder.

Some stats:
- Jak 1 has about 2500 edges between files, including transitives
- With transitives reduced at the source code level, each file seems to
have a modest amount of explicit requirements.

Known issues:
- Tracking the location for where `defmacro`s and virtual state
definitions were defined (and therefore the file) is still problematic.
Because those forms are in a macro environment, the reader does not
track them. I'm wondering if a workaround could be to search the
reader's text_db by not just the `goos::Object` but by the text
position. But for the purposes of finishing this work, I just statically
analyzed and searched the code with throwaway python code.
2024-05-12 12:37:59 -04:00
Hat Kid c7c615a043
custom levels: refactor level building code and jak 2 support (#3090)
Co-authored-by: water <awaterford111445@gmail.com>
2023-10-21 06:07:43 +02:00
ManDude 18ddd1613c
Jak 2 pc subtitle support (#2672)
Adds support for adding custom subtitles to Jak 2 audio. Comes with a
new editor for the new system and format. Compared to the Jak 1 system,
this is much simpler to make an editor for.

Comes with a few subtitles already made as an example.
Cutscenes are not officially supported but you can technically subtitle
those with editor, so please don't right now.

This new system supports multiple subtitles playing at once (even from a
single source!) and will smartly push the subtitles up if there's a
message already playing:

![image](https://github.com/open-goal/jak-project/assets/7569514/033e6374-a05a-4c31-b029-51868153a932)

![image](https://github.com/open-goal/jak-project/assets/7569514/5298aa6d-a183-446e-bdb6-61c4682df917)

Unlike in Jak 1, it will not hide the bottom HUD when subtitles are
active:

![image](https://github.com/open-goal/jak-project/assets/7569514/d466bfc0-55d0-4689-a6e1-b7784b9fff59)

Sadly this leaves us with not much space for the subtitle region (and
the subtitles are shrunk when the minimap is enabled) but when you have
guards and citizens talking all the time, hiding the HUD every time
anyone spoke would get really frustrating.

The subtitle speaker is also color-coded now, because I thought that
would be fun to do.

TODO:
- [x] proper cutscene support.
- [x] merge mode for cutscenes so we don't have to rewrite the script?

---------

Co-authored-by: Hat Kid <6624576+Hat-Kid@users.noreply.github.com>
2023-06-08 01:04:16 +01:00
Tyler Wilding 10ac78200b
repl: add gameVersionFolder to repl-config for running the non-default version (#2463)
Adds a decent way to customize the folders the project file expects the
iso data and decompiler data to be in. When you run any version other
than the default, for example Jak 1 PAL, it uses the `gameName`
decompiler config to consume and output it's results.

However the project file will assume `jak1` unless you hard-code it
differently -- basically, it needs to be explicitly told just the
decompiler is told what version to use.

We now have a per-user REPL Config json file, so that can be used to
override the default `jak1` behaviour.

Fixes #1993
2023-04-11 17:57:20 -04:00
ManDude 4b8b2abbed
port pckernel to Jak 2 (#2248)
Adds the `pckernel` system to Jak 2, allowing you to do the PC-specific
things that Jak 1 lets you do like change game resolution, etc.

In other to reduce the amount of code duplication for something that
we're gonna be changing a lot over time, I split it into a few more code
files. In this new system, `pckernel-h.gc`, `pckernel-common.gc`
(previously `pckernel.gc`) and `pc-debug-common.gc` are the files that
should be shared across all games (I hacked the Jak 2 project to pull
these files from the Jak 1 folder), while `pckernel-impl.gc`,
`pckernel.gc` and `pc-debug-methods.gc` are their respective
game-specific counterparts that should be loaded after. I'm not fully
happy with this, I think it's slightly messy, but it cleanly separates
code that should be game-specific and not accidentally copied around and
code that should be the same for all games anyway.
2023-02-25 10:19:32 -05:00
ManDude 324def1303
split new pc features in some files into their own code files + address some old issues + ripple graphics improvements (#2216)
Moves PC-specific entity and debug menu things to `entity-debug.gc` and
`default-menu-pc.gc` respectively and makes `(declare-file (debug))`
work as it should (no need to wrap the entire file in `(when
*debug-segment*` now!).

Also changes the DGO descriptor format so that it's less verbose. It
might break custom levels, but the format change is very simple so it
should not be difficult for anyone to update to the new format. Sadly,
you lose the completely useless ability to use DGO object names that
don't match the source file name. The horror!

I've also gone ahead and expanded the force envmap option to also force
the ripple effect to be active. I did not notice any performance or
visual drawbacks from this. Gets rid of some distracting LOD and some
water pools appearing super flat (and pitch back for dark eco).

Fixes #1424
2023-02-13 21:39:14 +00:00
Matt Dallmeyer fc5c75534d
Autosplitter - add per-level fly & orb counts (#2192)
Adds fields to the autosplit struct for the number of orbs and scout
flies collected in each level. This can be used for autosplitting on
orb/fly counts

Tested together with https://github.com/open-goal/speedrunning/pull/8


[autosplit_orbs.mp4](https://user-images.githubusercontent.com/2515356/216900730-92b7b947-cc4a-4629-b7f2-1dc10248c9e9.mp4)

[autosplit_fly.mp4](https://user-images.githubusercontent.com/2515356/216900759-e3042426-7cb0-4cb9-ae05-9c44827df6a0.mp4)


![image](https://user-images.githubusercontent.com/2515356/216901323-ffae97c8-3557-45f8-91db-cd86d76dd498.png)

![image](https://user-images.githubusercontent.com/2515356/216901026-59eb3fb6-281d-489d-a50c-010760246072.png)
2023-02-07 19:41:48 -05:00
Matt Dallmeyer 2645fed47a
Jak 1 Checkpoint Select / IL Speedrun support (#2162) 2023-01-30 19:11:57 -05:00
Tyler Wilding f6bdc07990
d/jak2: finish progress menu code and initialize the camera (#1945)
This PR does a few main things:
- finish decompiling the progress related code
- implemented changes necessary to load the text files end-to-end
   - japanese/korean character encodings were not added
- finish more camera code, which is required to spawn the progress menu
/ init the default language settings needed for text
  - initialized the camera as well

Still havn't opened the menu as there are a lot of checks around
`*target*` which I havn't yet gone through and attempted to comment out.
2022-10-11 18:30:26 -04:00
Tyler Wilding 81b6d5fe08
d/jak2: finish find-nearest | trajectory | editable-h and most of editable and editable-player (#1847)
Also made a first-pass of their SQL schema in preparation for getting
that working.
2022-09-10 18:03:17 -04:00
Tyler Wilding 0896bef2bf
jak1/speedruns: Some final touches for speedrunning in jak 1 (#1830)
* jak1: put common speedrunning code into it's own file

* jak1: enforce `60` fps while in speedrunning mode

* jak1: when speedrunning, display the version until you get the first powercell

* jak1: add an explicit option for skipping cutscenes

* jak1: extend `game-option` to allow any menu option to be disabled

* tests/jak1: allow whitelisting types to be redefined to satisfy typeconsistency checks

* jak1: add file headers

* jak1: cleanup bool checking

* test: delete the es substitle file

* test: add it back

* jak1: missed one cleanup spot related to bool comparisons
2022-09-02 18:15:42 -04:00
Tyler Wilding 346a258902
game/speedrunning: Add struct with relevant information to facilitate Auto Splitting (#1775)
* game: add auto-splitter structs

* game/jak1: wire up auto-splitter updating to game when in SR mode

* game/jak1: add info to split on picking up white eco

* game/jak1: add another two tasks for fish and finalboss

* game/jak1: autosplitting code entirely in GOAL
2022-08-22 18:55:08 -04:00
ManDude 665c578ccf
[game] cutscene skipping (#1779)
* split some subtitles

* allow cutscene skipping in retail and fix softlock

* formatting

* make intro skipping work?

* citadel sagecage skipping

* finalboss sage skipping

* quicker quit to title

* uk text fixes

* fisher cutscene skipping

* fix test
2022-08-21 18:13:47 -04:00
ManDude 7b25afa697
add a bunch of new cheat codes & re-do all pc cheat codes (#1770)
* redo cheat encodings

* fix error

* add no texture cheat

* tiny cleanup + add sidekick stats button

* crappy implementation of big/small head mode

* more correct bone scaling

* redo bone manip code a bit

* jp text fixes

* improved matrix math!

* add big fist cheat, minor type cleanup, add some debug toggles

* move all this mess to a new file

* slightly rework joint scaling function

* add big head npc cheat

* subtitles typo

* WIP mirror mode

* fix mirrored hud sprites

* fix mirror mode sound pan

* add cheats to menu!

* split some subtitles
2022-08-20 10:30:37 -04:00
ManDude dee8feb003
fix a game bug and add a new compiler feature (#1758)
* dont crash on inline static value array

* [goalc] add support for non-static inline arrays of values

* add a kernel group to jak1

* move and cleanup pc debug code

* random cleanup in `hud-classes`

* pc port fix for gondola spools

* format

* address feedback (wow it was actually just changing 1 line all along...)

* minor decomp cleanup

* ref test
2022-08-15 18:46:29 -04:00
ManDude 5148523917
more small cleanupses (#1722)
* reduce max supersampling options in progress menu

* cleanup knuth rng file

* save & load cheats

* allow keyboard controls when cpad is connected

* ignore key presses when imgui is being used

* save settings when quitting game
2022-08-03 21:51:13 -04:00
ManDude 3e538dabe6
more random cleanup (#1716)
* correct some comments

* change `pc-cheats?` macro to be more generic

* more generic custom fps stuff

* better subtitle timings

* oopsie!

* fix burn effect stacking

* fix some windows scripts

* fix project

* cleanup this func

* more fix

* oops

* ???
2022-08-02 18:48:10 -04:00
Matt Dallmeyer a04bdff80d
RNG - mimic Java's Util.Random (#1672)
* initial java Util.Random mimic

* add comment referencing java impl

* fix 64 bit stuff

* copy scf-time definition into math.gc, use for initial seed

* rename java -> knuth

* move knuth-rand to separate file

* move knuth-rand to separate file

* PR comments
2022-07-29 20:04:22 -04:00
ManDude bb76fc442c
Fix typo in game.gp when building test zone (#1695) 2022-07-22 10:03:55 +01:00
water111 5e23057ed1
[goalc] compile/run code for jak2 ckernel, set up dummy KERNEL.CGO (#1625)
[goalc] start can compile and run code for jak2 ckernel, set up dummy KERNEL.CGO
2022-07-08 19:23:49 -04:00
ManDude b74399ed57
rework goal_src structure for jak 1 a bit (#1615)
* move files

* update game.gp
2022-07-05 16:00:09 -04:00
water111 f763eb6bf0
[jak2] support for multiple out/ directories (#1585)
* [jak2] support for multiple out/ directories

* windows
2022-06-30 21:11:58 -04:00
water111 1e33dcda4b
Remove assets folder, use more std::filesystem (#1575)
* Remove assets folder, use more std::filesystem

* windows fix

* another one for windows

* another one

* better system for different folders

* rm debugging stuff

* let extractor override everything

* dont revert jak1 change
2022-06-29 23:32:46 -04:00
Tyler Wilding 36dc015d62
jak2: Create goal_src skeleton (#1576) 2022-06-29 22:20:09 -04:00
Renamed from goal_src/game.gp (Browse further)