npx agentspec-cli install 9c5545a9-e5d7-4e23-b019-76309993f4dc --file-type cursorrules→ .cursor/rules/
You will be developing a game in a custom 2D engine that DOES NOT HAVE ALL UNITY APIs.
- Start files with `using AO;` *Do not try to import anything except from the C# System namespace*
- You do not need to write any movement or basic networking code. These are handled for you
- To create an entity use Entity.Create(). If you want it to be visible to others you must Network.Spawn() it. This must be done on the server only
- To get components in the scene (e.g all the players) use foreach (var player in Scene.Components<MyPlayer>())
- If you need to get a specific entity use Entity.FindByName()
- For timers use Time.TimeSinceStartup and compare. DO NOT use coroutines or any other methods.
- Prefer using standard library math functions. If a math function you want doesn't exist, make it using the standard library
- File names should use PascalCase
- Do not try to use any Unity APIs, including inheriting anything other than Component
- Because it's 2D, use Vector2 instead of Vector3
- There is no HasComponent, only GetComponent and AddComponent
- To check whether an entity exists use .Alive() instead of checking if it's null
- In Player classes add IsLocal checks if you only want something to happen on the local client (e.g. creating a CameraControl)
- These games are mobile-first so don't use any keyboard input
- Use Entity.LocalScale instead of .Scale
- To generate random numbers use the `RNG` class by starting with `RNG.Seed(1337)` and then calling RangeInt or RangeFloat (do not try any other RNG methods)
## Assets
- To see available assets list files in the /res directory. You'll have to look in nested folders.
- To reference an asset use Assets.GetAsset<TYPE>("path"). Common types are Texture, AudioAsset and SpineSkeletonAsset. Do not prefix with /res
## Sprite Renderers
- Sprite Renderers are under the Sprite_Renderer type
- Sprite_Renderers have a .Tint property. We use Vector4 to represent colors. Do not try to use .Color
- Make sure that any UI code or Sprite_Renderer stuff is done on the client
## Networking
- To check if code is running on the client or server use the Network.IsClient/IsServer booleans
- Only use SyncVars when you need to sync state between clients and the server
- To change the value of a SyncVar use .Set() which can only be called on the server
### RPCs
ClientRpcs must be **public** functions used when you want the server to call a function on the client
For example to play a "success" sound from a function running on the server you would create a ClientRpc
[ClientRpc]
public void PlaySuccessSound()
{
}
- [ClientRpc] functions must be called with a prefix CallClient_[FUNCTION NAME] e.g CallClient_PlaySuccessSound
- Classes with RPCs must use the partial keyword
- You can pass entities to RPCs
### SyncVars
SyncVars wrap a primative and automatically keep it in sync for all clients and the server
For example, to store "Health" on a Player, you can add a SyncVar as a field of your player class:
public partial class BattlePlayer : Player
{
public SyncVar<int> Health = new(100);
}
The Health variable can be used (e.g. if (Health.Value <= 0))
To respond to a SyncVar changing you can use .OnSync(old, new)
When declaring SyncVars make sure to call the constructor.
SyncVars only support the following types:
- int
- float
- bool
- string
- Vector2
- Vector3
- Vector4
- Entity
Unity C Expert Developer Prompt
You are an expert Unity C# developer with deep knowledge of game development best practices, performance optimization, and cross-platform considerations. When generating code or providing solutions: 1. Write clear, concise, well-documented C# code adhering to Unity best practices.
by AgentHub Crawler
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
by AgentHub Crawler
rules
Windsurf IDE rules and conventions for AI-assisted development.
by AgentHub Crawler
Agentic Coding with PocketFlow-PHP
Sign in to leave a comment.
> **Attention AI Agent:** This is your primary instruction manual. Follow these rules strictly to generate correct, robust, and bug-free PHP code for the PocketFlow-PHP framework. Failure to adhere to these rules will result in errors.
by AgentHub Crawler