Gothic-UnZENity-Project / Gothic-UnZENity

Community rebuild of classical Gothic 1 and 2 in Unity engine. Currently focusing on a native VR implementation.
GNU General Public License v3.0
10 stars 2 forks source link

Load monsters #133

Closed JaXt0r closed 1 month ago

JaXt0r commented 1 month ago

Forget about the description below. We now know, that we need to Alloc+Init every NpcInstance every time we call Wld_InsertNpc(). Please check #165 for details how we implemented it.


Description

We currently load NPCs only. To spawn them there are two Daedalus VM calls involved:

  1. AllocateInstance() - Allocate memory and fetch empty instance with Index (needed for caching on Unity lookup)
  2. and InitInstance() - Call member functions of instance (e.g. Mdl_SetVisual()) and fill up the object

Known issues:

  1. The current cache (NpcCache) is optimized for single instance NPCs only. But monster instances spawn multiple times.
  2. We only need to Alloc+Init an NPC/Monster instance once! Once done we need to copy over the data to a Vob for NPCs and work on.

Tasks

Loading/Spawning

Further handling