🎯

hytopia-entities

🎯Skill

from abstrucked/hytopia-skills

VibeIndex|
What it does

Generates and manages game entities in HYTOPIA SDK, enabling creation of interactive objects, NPCs, and game elements with advanced lifecycle and component management.

πŸ“¦

Part of

abstrucked/hytopia-skills(12 items)

hytopia-entities

Installation

Quick InstallInstall with npx
npx skills add Abstrucked/hytopia-skills --skill='*'
Quick InstallInstall with npx
npx skills add Abstrucked/hytopia-skills --skill='*' -g
Quick InstallInstall with npx
npx skills add Abstrucked/hytopia-skills --skill='hytopia-entities'
Quick InstallInstall with npx
npx skills add Abstrucked/hytopia-skills --skill='hytopia-world'
πŸ“– Extracted from docs: abstrucked/hytopia-skills
2Installs
-
AddedFeb 4, 2026

Skill Details

SKILL.md

Helps create and manage entities in HYTOPIA SDK games. Use when users need to create game objects, NPCs, items, or any interactive objects. Covers Entity class, spawn/despawn, components, animations, and lifecycle management.

Overview

# HYTOPIA Entities

This skill helps you create and manage entities in HYTOPIA SDK games.

Documentation: https://dev.hytopia.com/sdk-guides/entities

When to Use This Skill

Use this skill when the user:

  • Wants to create game objects, NPCs, items, or interactive objects
  • Needs to spawn or despawn entities
  • Asks about entity components or behaviors
  • Wants to animate entities or handle entity lifecycle
  • Needs collision detection between entities
  • Asks about player entities vs non-player entities

Core Entity Concepts

Creating an Entity

```typescript

import { Entity } from 'hytopia';

class MyEntity extends Entity {

constructor() {

super();

// Initialize entity properties

}

onSpawn() {

// Called when entity is spawned into the world

}

onDespawn() {

// Called when entity is removed from the world

}

tick(deltaTime: number) {

// Called every frame - use for continuous updates

}

}

```

Spawning Entities

```typescript

// Spawn an entity in the world

const entity = new MyEntity();

world.spawnEntity(entity, {

position: { x: 0, y: 10, z: 0 },

rotation: { x: 0, y: 0, z: 0 }

});

// Despawn when done

world.despawnEntity(entity);

```

Entity with Model

```typescript

import { Entity, Model } from 'hytopia';

class ItemEntity extends Entity {

constructor() {

super();

this.model = new Model({

modelUri: 'models/sword.gltf',

scale: 0.5

});

}

}

```

Entity Components

```typescript

import { Entity, PhysicsComponent, HealthComponent } from 'hytopia';

class EnemyEntity extends Entity {

constructor() {

super();

// Add physics

this.addComponent(new PhysicsComponent({

mass: 10,

colliders: [/ collision shapes /]

}));

// Add health

this.addComponent(new HealthComponent({

maxHealth: 100,

currentHealth: 100

}));

}

}

```

Common Patterns

Following Player

```typescript

tick(deltaTime: number) {

const player = world.getClosestPlayer(this.position);

if (player) {

const direction = player.position.subtract(this.position).normalize();

this.position.add(direction.multiply(5 * deltaTime));

}

}

```

Projectile Entity

```typescript

class Projectile extends Entity {

velocity: Vector3;

lifetime: number = 5;

tick(deltaTime: number) {

this.position.add(this.velocity.multiply(deltaTime));

this.lifetime -= deltaTime;

if (this.lifetime <= 0) {

world.despawnEntity(this);

}

}

}

```

Best Practices

  1. Always clean up in onDespawn() - remove event listeners, stop sounds
  2. Use tick() sparingly - expensive operations every frame hurt performance
  3. Pool reusable entities - don't constantly spawn/despawn the same type
  4. Set proper collision layers - use layers to filter what collides with what
  5. Network efficiently - only sync properties that change and need to be visible to clients

Common Mistakes to Avoid

  • Don't forget to call super() in constructor
  • Don't modify entity properties directly on the client - server is authoritative
  • Don't spawn entities before world is initialized
  • Don't forget to handle entity cleanup on game end

More from this repository10

🎯
hytopia-multiplayer🎯Skill

Enables seamless multiplayer game development in HYTOPIA SDK by providing comprehensive player management, networking, and state synchronization tools.

🎯
hytopia-events🎯Skill

Handles game events and input in HYTOPIA SDK, enabling responsive player interactions, chat commands, and game lifecycle management.

🎯
hytopia-world🎯Skill

Programmatically builds, generates, and manages worlds in HYTOPIA SDK with advanced block placement, terrain generation, and world editor integration.

🎯
hytopia-physics🎯Skill

I apologize, but I cannot generate a description without seeing the actual context or details about the "hytopia-physics" skill. Could you provide more information about what this specific skill do...

🎯
hytopia-assets🎯Skill

I apologize, but I cannot generate a description without seeing the actual repository or skill details. Could you provide more context about the "hytopia-assets" skill from the "abstrucked/hytopia-...

🎯
hytopia-camera🎯Skill

I apologize, but I cannot generate a description without seeing the actual code or context of the "hytopia-camera" skill. Could you provide more details about the skill's functionality or share the...

🎯
hytopia-lighting🎯Skill

Configures dynamic lighting in HYTOPIA SDK games, supporting ambient, directional, point, and spot lights with shadow and performance optimization.

🎯
hytopia-debugging🎯Skill

Debugs HYTOPIA SDK games by providing performance metrics, error tracking, client debugging tools, and comprehensive logging across client and server environments.

🎯
hytopia-persisted-data🎯Skill

Enables persistent data storage and retrieval for HYTOPIA SDK games, supporting global game configurations and per-player progress tracking.

🎯
hytopia-mobile🎯Skill

Enables mobile game support in HYTOPIA SDK by providing touch controls, device detection, responsive UI, and cross-platform compatibility.