jak-project/docs/markdown
ManDude 2e18cb605a
[runtime] optimize DirectRenderer for multiple textures + optimize sprite renderer (#1054)
* optimize sprite texture flush + update shaders

* fix bugs

* change logic a bit

* crunch PNGs

* hud size fix

* clang

* remove shaders from list

* use really small alpha cut-off point for sprites

* ad `flat` to vertex shaders too

* increase cut-off very slightly

* take *2 into account

* ok for real this should be good enough
2022-01-06 18:47:20 -05:00
..
imgs [runtime] optimize DirectRenderer for multiple textures + optimize sprite renderer (#1054) 2022-01-06 18:47:20 -05:00
progress-notes add declare-file debug (#1004) 2021-12-12 12:52:23 -05:00
_404.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
_sidebar.md docs: add new porting tfrag page to docs (#1033) 2021-12-28 14:26:49 -05:00
asm_emitter.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
compiler_example.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
debugging.md [runtime] pckernel implementation (#1032) 2021-12-30 18:48:37 -05:00
decompiler_states.md add support for non virtual states (#764) 2021-08-17 20:54:03 -04:00
drawable_and_tfrag.md Start a debug tool for looking through level data (#954) 2021-10-31 13:12:50 -04:00
editor_setup.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
goos.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
graphics.md clean up 2021-08-12 19:03:33 -04:00
lib.md [decomp] joint and related (#1003) 2021-12-26 11:43:16 -05:00
method_system.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
object_file_formats.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
porting_tfrag.md [graphics] TIE extractor (#1026) 2021-12-26 12:33:51 -05:00
porting_to_x86.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
process_and_state.md give defstate a parent type and allow anonymous behaviors inside (#715) 2021-07-25 00:23:30 -04:00
reader.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
README.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
registers.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
repl.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
syntax.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00
tfrag.md [graphics] partial tfrag implementation (#958) 2021-11-13 20:44:17 -05:00
type_system.md docs: Overhaul and organize all of the existing documentation we have (#412) 2021-05-02 14:58:22 -04:00

An Overview

This is the main documentation for the OpenGOAL language. It's designed to be read in order to learn OpenGOAL. It does not explain the OpenGOAL kernel or state system.

The syntax descriptions uses these rules:

  • Something [in-brackets] is optional and can be left out.
  • Something like [:type type-name] means there is an optional named argument.
    • It can be used like :type type-name, replacing type-name with what you want, or left out entirely.
  • When there are multiple choices, they are separated by |. Example: #t|#f is either #t or #f.
  • ... means more of the thing before can be included. Example (f arg...) can have multiple arguments.

Language Basics

OpenGOAL is a compiled language. Source code is stored in .gc files. Each .gc file is compiled into a .o file. These .o files are then loaded by the game. When they are loaded, it has the effect of running every "top level" expression in the file. Usually these are function, type, and method declarations, but you can also use this for initialization code. For example, it is common to first define types, functions, and methods, then set up global instances.

There are effectively three different "languages":

  1. OpenGOAL - the normal compiled language.
  2. OpenGOAL compiler commands - simple commands to run the compiler, listener, and debugger. These run in the compiler only.
  3. GOOS macro language. This is used in OpenGOAL macros and runs at compile-time. These macros generate OpenGOAL compiler commands or OpenGOAL source which is then processed. These run in the compiler only.

The OpenGOAL language uses a LISP syntax, but on the inside is closer to C or C++. There is no protection against use-after-free or other common pointer bugs.

Unlike a C/C++ compiler, the OpenGOAL compiler has a state. It remembers functions/methods/types/macros/constants/enums/etc defined in previous files.

Type System Introduction

OpenGOAL has a type system. Every expression and object in OpenGOAL has a type. With the exception of three special types (none, _varags_, and _types_), every type has a parent type, and the root of all types is object. Types themselves are objects in the runtime that contain some basic information and their method table.

One annoying detail of OpenGOAL is that the type system has some slightly different types for variables and places in memory, and automatic conversions between them.

Another annoying detail is that there are a totally separate set of rules for 128-bit integer types (or children of these). Nothing in this section applies to these.

Some types are boxed vs. unboxed. If you have an object of boxed type, it is possible to figure out its type at runtime. If you have an object of unboxed type, you can't. If you have an unboxed type, you can't tell if it's a boxed or unboxed object.

Some types are value or reference. A value type means it has value semantics, it is passed by value everywhere. A reference type is like a C/C++ pointer or reference, where there is memory allocated for the data somewhere, and the you just pass around a reference to this memory.

For more information on the type system, see the following