Skip to content

Instantly share code, notes, and snippets.

View dpogue's full-sized avatar
👨‍💻
I may be slow to respond.

Darryl Pogue dpogue

👨‍💻
I may be slow to respond.
View GitHub Profile

Plasma Object IDs

Background

The 2003 version of the Plasma engine used by the original version of Uru handled all object references by comparing object names. Comparing object names essentially means stepping through each letter of the name and comparing them one at a time until you find a mismatch or reach the end of the name. That's generally quick enough, but imagine doing that for every single reference between objects in an Age and it starts to become a performance bottleneck.

For Myst V, Cyan developer Colin Bonstead came up with the idea of assigning every object in a PRP file a numeric ID. That changes references from needing to do N comparisons (where N is the number of letters in the object name) to 1 comparison.

These numeric IDs are computed at 3DS Max export time by sorting all the objects alphabetically and assigning IDs sequentially.

The Problem

@dpogue
dpogue / vcpkg.md
Last active January 13, 2024 19:54

vcpkg in H-uru/Plasma

The H-uru/Plasma repo uses vcpkg to manage C++ library dependencies. The libraries provided by vcpkg are called "ports" and it's a model similar to MacPorts, pacman (PKGBUILD), and other common software package managers.

One difference from typical package managers is that vcpkg also tries to accomodate different target compilers and target systems, as well as different build configuations. To do this, it uses a concept it calls "triplets". A triplet is an architecture, platform, and linking type (i.e., x86-windows-dynamic or x64-windows-static).

When you install Visual Studio 2022 with Desktop C++ component, vcpkg is automatically installed as well. You can also download vcpkg as a standalone tool, or use it as part of a CMake build system. The H-uru/Plasma repo uses CMake as its build system, so it has opted to use vcpkg's CMake integration, controlled by the USE_VCPKG boolean flag. By default this is enabled on

class plClientWindow
{
protected:
pcSmallRect fWindowSize;
public:
plClientWindow() : fWindowSize(0, 0, 800, 600) { }
virtual ~plClientWindow() = default;
/**
#include <CoreFoundation/CoreFoundation.h>
#include <stdio.h>
int main(int argc, char** argv)
{
CFStringRef str = CFStringCreateWithCString(NULL, argv[0], kCFStringEncodingUTF8);
printf("Ref Count: %d\n", CFGetRetainCount(str));
return 0;
}
/*==LICENSE==*
CyanWorlds.com Engine - MMOG client, server and tools
Copyright (C) 2011 Cyan Worlds, Inc.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
<?xml version="1.0" encoding="utf-8"?>
<plWaveSet7>
<plKey Name="cWater_Harbor" Type="plWaveSet7" Location="6;3" LocFlag="0x0000" LoadMask="0xFFF0" ObjID="1" />
<SyncParams flags="0x00000000">
<ExcludePersistentStates></ExcludePersistentStates>
<VolatileStates></VolatileStates>
</SyncParams>
<ModFlags>
<hsBitVector></hsBitVector>
@dpogue
dpogue / st_cocoa.h
Last active February 19, 2023 06:46
#include <CoreFoundation/CoreFoundation.h>
[[nodiscard]]
CFStringRef CFStringCreateWithSTString(CFAllocatorRef alloc, const ST::string& stString)
{
return CFStringCreateWithCString(alloc, stString.c_str(), kCFStringEncodingUTF8);
}
[[nodiscard]]
const ST::string CFStringGetSTString(CFStringRef theString)
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by python configure 3.10, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./../src/v3.10.5-191871e52e.clean/configure --with-openssl=/Users/runner/work/Plasma/Plasma/build/vcpkg_installed/arm64-osx --without-ensurepip --with-suffix= --with-system-expat --without-readline --disable-test-modules LIBS=-liconv -lintl --disable-silent-rules --verbose --disable-shared --enable-static --with-pydebug --prefix=/Users/runner/work/Plasma/Plasma/build/vcpkg_installed/arm64-osx/debug --bindir=${prefix}/../tools/python3/debug/bin --sbindir=${prefix}/../tools/python3/debug/sbin --libdir=${prefix}/lib --includedir=${prefix}/../include --datarootdir=${prefix}/share/python3
## --------- ##
## Platform. ##

Plasma Object Relationships

This is a simplified diagram showing the basic associations between class types in Plasma.

A lot of behaviour is handled by attaching various plModifier subclasses to plSceneObject instances (i.e., plPythonFileMod, plResponderModifier, plLogicModifier, etc.)

classDiagram
plSceneNode --> plSceneObject : scene objects
plSceneObject --> plAudioInterface : audio
plSceneObject --&gt; plDrawInterface : mesh

H-uru/Plasma Changelog

2022

Not yet complete