@lagless/create 0.0.34 → 0.0.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/GameState.ts +0 -29
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/MoveInput.ts +0 -23
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/MovingFilter.ts +0 -15
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/PlayerBody.ts +0 -55
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/PlayerFilter.ts +0 -15
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/PlayerJoined.ts +0 -24
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/PlayerLeft.ts +0 -23
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/PlayerResource.ts +0 -83
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/ReportHash.ts +0 -23
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/Transform2d.ts +0 -65
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/Velocity2d.ts +0 -55
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/__ProjectName__.core.ts +0 -22
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/__ProjectName__.runner.ts +0 -16
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/__ProjectName__InputRegistry.ts +0 -8
- package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/index.ts +0 -16
package/dist/index.js
CHANGED
|
@@ -115,6 +115,7 @@ program.name('create-lagless').description('Scaffold a new Lagless multiplayer g
|
|
|
115
115
|
console.log('Next steps:');
|
|
116
116
|
console.log(` cd ${packageName}`);
|
|
117
117
|
console.log(' pnpm install');
|
|
118
|
+
console.log(' pnpm codegen # Generate ECS code from schema');
|
|
118
119
|
console.log(' pnpm dev:backend # Start game server');
|
|
119
120
|
console.log(' pnpm dev:frontend # Start frontend dev server\n');
|
|
120
121
|
});
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { program } from 'commander';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as ejs from 'ejs';\nimport { fileURLToPath } from 'node:url';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\ninterface CreateOptions {\n preset: string;\n port: string;\n serverPort: string;\n}\n\nfunction toPascalCase(kebab: string): string {\n return kebab.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join('');\n}\n\nfunction getTemplatesDir(): string {\n // In development (source), templates are sibling to src/\n // In dist, templates are at package root (copied by files field)\n const devPath = path.resolve(__dirname, '..', 'templates');\n if (fs.existsSync(devPath)) return devPath;\n // Fallback for npm install\n const distPath = path.resolve(__dirname, '..', '..', 'templates');\n if (fs.existsSync(distPath)) return distPath;\n throw new Error('Templates directory not found');\n}\n\nfunction walkDir(dir: string): string[] {\n const results: string[] = [];\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n results.push(...walkDir(full));\n } else {\n results.push(full);\n }\n }\n return results;\n}\n\nfunction processPath(filePath: string, vars: Record<string, string>): string {\n let result = filePath;\n result = result.replace(/__packageName__/g, vars.packageName);\n result = result.replace(/__ProjectName__/g, vars.projectName);\n return result;\n}\n\nprogram\n .name('create-lagless')\n .description('Scaffold a new Lagless multiplayer game project')\n .version('0.0.30')\n .argument('<project-name>', 'Project name in kebab-case (e.g., my-game)')\n .option('--preset <preset>', 'Project preset', 'pixi-react')\n .option('--port <port>', 'Frontend dev server port', '4200')\n .option('--server-port <port>', 'Backend server port', '3333')\n .action(async (projectArg: string, options: CreateOptions) => {\n const targetDir = path.resolve(process.cwd(), projectArg);\n const packageName = path.basename(targetDir).toLowerCase();\n const pascalName = toPascalCase(packageName);\n\n if (fs.existsSync(targetDir)) {\n console.error(`Error: Directory \"${targetDir}\" already exists.`);\n process.exit(1);\n }\n\n const templatesDir = getTemplatesDir();\n const presetDir = path.join(templatesDir, options.preset);\n\n if (!fs.existsSync(presetDir)) {\n console.error(`Error: Preset \"${options.preset}\" not found. Available: ${fs.readdirSync(templatesDir).join(', ')}`);\n process.exit(1);\n }\n\n // Read package.json from this package to get current lagless version\n const pkgJsonPath = path.resolve(__dirname, '..', 'package.json');\n let laglessVersion = '0.0.30';\n try {\n const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));\n laglessVersion = pkg.version || laglessVersion;\n } catch {\n // fallback\n }\n\n const vars = {\n projectName: pascalName,\n packageName,\n frontendPort: options.port,\n serverPort: options.serverPort,\n laglessVersion,\n };\n\n console.log(`\\nCreating Lagless project \"${packageName}\"...`);\n console.log(` Preset: ${options.preset}`);\n console.log(` Frontend port: ${options.port}`);\n console.log(` Server port: ${options.serverPort}`);\n console.log(` Target: ${targetDir}\\n`);\n\n const templateFiles = walkDir(presetDir);\n\n for (const templateFile of templateFiles) {\n const relativePath = path.relative(presetDir, templateFile);\n const outputRelative = processPath(relativePath, vars);\n const outputPath = path.join(targetDir, outputRelative);\n const outputDir = path.dirname(outputPath);\n\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n\n const content = fs.readFileSync(templateFile, 'utf-8');\n\n // Only process .ejs files or text files that might contain EJS tags\n const ext = path.extname(templateFile);\n const textExts = ['.ts', '.tsx', '.json', '.yaml', '.yml', '.html', '.css', '.md', '.toml', '.gitignore'];\n\n if (textExts.includes(ext) || ext === '.ejs') {\n const rendered = ejs.render(content, vars, { filename: templateFile });\n const finalPath = ext === '.ejs' ? outputPath.replace(/\\.ejs$/, '') : outputPath;\n fs.writeFileSync(finalPath, rendered, 'utf-8');\n } else {\n // Binary or unknown — copy as-is\n fs.copyFileSync(templateFile, outputPath);\n }\n }\n\n console.log('Project created successfully!\\n');\n console.log('Next steps:');\n console.log(` cd ${packageName}`);\n console.log(' pnpm install');\n console.log(' pnpm dev:backend # Start game server');\n console.log(' pnpm dev:frontend # Start frontend dev server\\n');\n });\n\nprogram.parse();\n"],"names":["program","fs","path","ejs","fileURLToPath","__filename","url","__dirname","dirname","toPascalCase","kebab","split","map","s","charAt","toUpperCase","slice","join","getTemplatesDir","devPath","resolve","existsSync","distPath","Error","walkDir","dir","results","entry","readdirSync","withFileTypes","full","name","isDirectory","push","processPath","filePath","vars","result","replace","packageName","projectName","description","version","argument","option","action","projectArg","options","targetDir","process","cwd","basename","toLowerCase","pascalName","console","error","exit","templatesDir","presetDir","preset","pkgJsonPath","laglessVersion","pkg","JSON","parse","readFileSync","frontendPort","port","serverPort","log","templateFiles","templateFile","relativePath","relative","outputRelative","outputPath","outputDir","mkdirSync","recursive","content","ext","extname","textExts","includes","rendered","render","filename","finalPath","writeFileSync","copyFileSync"],"rangeMappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { program } from 'commander';\nimport * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as ejs from 'ejs';\nimport { fileURLToPath } from 'node:url';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\ninterface CreateOptions {\n preset: string;\n port: string;\n serverPort: string;\n}\n\nfunction toPascalCase(kebab: string): string {\n return kebab.split('-').map(s => s.charAt(0).toUpperCase() + s.slice(1)).join('');\n}\n\nfunction getTemplatesDir(): string {\n // In development (source), templates are sibling to src/\n // In dist, templates are at package root (copied by files field)\n const devPath = path.resolve(__dirname, '..', 'templates');\n if (fs.existsSync(devPath)) return devPath;\n // Fallback for npm install\n const distPath = path.resolve(__dirname, '..', '..', 'templates');\n if (fs.existsSync(distPath)) return distPath;\n throw new Error('Templates directory not found');\n}\n\nfunction walkDir(dir: string): string[] {\n const results: string[] = [];\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n results.push(...walkDir(full));\n } else {\n results.push(full);\n }\n }\n return results;\n}\n\nfunction processPath(filePath: string, vars: Record<string, string>): string {\n let result = filePath;\n result = result.replace(/__packageName__/g, vars.packageName);\n result = result.replace(/__ProjectName__/g, vars.projectName);\n return result;\n}\n\nprogram\n .name('create-lagless')\n .description('Scaffold a new Lagless multiplayer game project')\n .version('0.0.30')\n .argument('<project-name>', 'Project name in kebab-case (e.g., my-game)')\n .option('--preset <preset>', 'Project preset', 'pixi-react')\n .option('--port <port>', 'Frontend dev server port', '4200')\n .option('--server-port <port>', 'Backend server port', '3333')\n .action(async (projectArg: string, options: CreateOptions) => {\n const targetDir = path.resolve(process.cwd(), projectArg);\n const packageName = path.basename(targetDir).toLowerCase();\n const pascalName = toPascalCase(packageName);\n\n if (fs.existsSync(targetDir)) {\n console.error(`Error: Directory \"${targetDir}\" already exists.`);\n process.exit(1);\n }\n\n const templatesDir = getTemplatesDir();\n const presetDir = path.join(templatesDir, options.preset);\n\n if (!fs.existsSync(presetDir)) {\n console.error(`Error: Preset \"${options.preset}\" not found. Available: ${fs.readdirSync(templatesDir).join(', ')}`);\n process.exit(1);\n }\n\n // Read package.json from this package to get current lagless version\n const pkgJsonPath = path.resolve(__dirname, '..', 'package.json');\n let laglessVersion = '0.0.30';\n try {\n const pkg = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf-8'));\n laglessVersion = pkg.version || laglessVersion;\n } catch {\n // fallback\n }\n\n const vars = {\n projectName: pascalName,\n packageName,\n frontendPort: options.port,\n serverPort: options.serverPort,\n laglessVersion,\n };\n\n console.log(`\\nCreating Lagless project \"${packageName}\"...`);\n console.log(` Preset: ${options.preset}`);\n console.log(` Frontend port: ${options.port}`);\n console.log(` Server port: ${options.serverPort}`);\n console.log(` Target: ${targetDir}\\n`);\n\n const templateFiles = walkDir(presetDir);\n\n for (const templateFile of templateFiles) {\n const relativePath = path.relative(presetDir, templateFile);\n const outputRelative = processPath(relativePath, vars);\n const outputPath = path.join(targetDir, outputRelative);\n const outputDir = path.dirname(outputPath);\n\n if (!fs.existsSync(outputDir)) {\n fs.mkdirSync(outputDir, { recursive: true });\n }\n\n const content = fs.readFileSync(templateFile, 'utf-8');\n\n // Only process .ejs files or text files that might contain EJS tags\n const ext = path.extname(templateFile);\n const textExts = ['.ts', '.tsx', '.json', '.yaml', '.yml', '.html', '.css', '.md', '.toml', '.gitignore'];\n\n if (textExts.includes(ext) || ext === '.ejs') {\n const rendered = ejs.render(content, vars, { filename: templateFile });\n const finalPath = ext === '.ejs' ? outputPath.replace(/\\.ejs$/, '') : outputPath;\n fs.writeFileSync(finalPath, rendered, 'utf-8');\n } else {\n // Binary or unknown — copy as-is\n fs.copyFileSync(templateFile, outputPath);\n }\n }\n\n console.log('Project created successfully!\\n');\n console.log('Next steps:');\n console.log(` cd ${packageName}`);\n console.log(' pnpm install');\n console.log(' pnpm codegen # Generate ECS code from schema');\n console.log(' pnpm dev:backend # Start game server');\n console.log(' pnpm dev:frontend # Start frontend dev server\\n');\n });\n\nprogram.parse();\n"],"names":["program","fs","path","ejs","fileURLToPath","__filename","url","__dirname","dirname","toPascalCase","kebab","split","map","s","charAt","toUpperCase","slice","join","getTemplatesDir","devPath","resolve","existsSync","distPath","Error","walkDir","dir","results","entry","readdirSync","withFileTypes","full","name","isDirectory","push","processPath","filePath","vars","result","replace","packageName","projectName","description","version","argument","option","action","projectArg","options","targetDir","process","cwd","basename","toLowerCase","pascalName","console","error","exit","templatesDir","presetDir","preset","pkgJsonPath","laglessVersion","pkg","JSON","parse","readFileSync","frontendPort","port","serverPort","log","templateFiles","templateFile","relativePath","relative","outputRelative","outputPath","outputDir","mkdirSync","recursive","content","ext","extname","textExts","includes","rendered","render","filename","finalPath","writeFileSync","copyFileSync"],"rangeMappings":";;;;;;;;;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uF,aAAa,CAACD,WAAWH,UAAU;QACxC,OAAO;YACL,iCAAiC;YACjCnF,GAAGwF,YAAY,CAAClB,cAAcI;QAChC;IACF;IAEArB,QAAQe,GAAG,CAAC;IACZf,QAAQe,GAAG,CAAC;IACZf,QAAQe,GAAG,CAAC,CAAC,KAAK,EAAE9B,YAAY,CAAC;IACjCe,QAAQe,GAAG,CAAC;IACZf,QAAQe,GAAG,CAAC;IACZf,QAAQe,GAAG,CAAC;IACZf,QAAQe,GAAG,CAAC;AACd;AAEFrE,QAAQgE,KAAK"}
|
package/package.json
CHANGED
package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/GameState.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { MemoryTracker } from '@lagless/binary';
|
|
3
|
-
|
|
4
|
-
export class GameState {
|
|
5
|
-
public static readonly schema = {
|
|
6
|
-
gamePhase: Uint8Array,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
public readonly safe = {} as {
|
|
10
|
-
gamePhase: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
constructor(buffer: ArrayBuffer, memTracker: MemoryTracker) {
|
|
14
|
-
const gamePhaseArray = new Uint8Array(buffer, memTracker.ptr, 1);
|
|
15
|
-
memTracker.add(1);
|
|
16
|
-
|
|
17
|
-
Object.defineProperty(this.safe, 'gamePhase', {
|
|
18
|
-
get: () => gamePhaseArray[0],
|
|
19
|
-
set: (v: number) => { gamePhaseArray[0] = v; },
|
|
20
|
-
enumerable: true,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
public static calculateSize(_maxEntities: number, memTracker: MemoryTracker): void {
|
|
25
|
-
memTracker.add(1);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
Object.defineProperty(GameState, 'name', { value: 'GameState' });
|
package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/MoveInput.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { InputPayloadBuffer } from '@lagless/core';
|
|
3
|
-
|
|
4
|
-
export class MoveInput {
|
|
5
|
-
public static readonly id = 2;
|
|
6
|
-
public static readonly byteLength = 8;
|
|
7
|
-
|
|
8
|
-
public readonly schema!: {
|
|
9
|
-
directionX: number;
|
|
10
|
-
directionY: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
public static encode(data: MoveInput['schema'], buffer: InputPayloadBuffer): void {
|
|
14
|
-
buffer.writeFloat32(data.directionX);
|
|
15
|
-
buffer.writeFloat32(data.directionY);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public static decode(buffer: InputPayloadBuffer): MoveInput['schema'] {
|
|
19
|
-
const directionX = buffer.readFloat32();
|
|
20
|
-
const directionY = buffer.readFloat32();
|
|
21
|
-
return { directionX, directionY };
|
|
22
|
-
}
|
|
23
|
-
}
|
package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/MovingFilter.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { AbstractFilter, MemoryTracker } from '@lagless/binary';
|
|
3
|
-
import { Transform2d } from './Transform2d.js';
|
|
4
|
-
import { Velocity2d } from './Velocity2d.js';
|
|
5
|
-
|
|
6
|
-
export class MovingFilter extends AbstractFilter {
|
|
7
|
-
public static readonly includeMask = Transform2d.ID | Velocity2d.ID;
|
|
8
|
-
public static readonly excludeMask = 0;
|
|
9
|
-
|
|
10
|
-
constructor(maxEntities: number, buffer: ArrayBuffer, memTracker: MemoryTracker) {
|
|
11
|
-
super(maxEntities, Transform2d.ID | Velocity2d.ID, 0, buffer, memTracker);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
Object.defineProperty(MovingFilter, 'name', { value: 'MovingFilter' });
|
package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/PlayerBody.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { MemoryTracker } from '@lagless/binary';
|
|
3
|
-
|
|
4
|
-
export class PlayerBody {
|
|
5
|
-
public static readonly ID = 4;
|
|
6
|
-
public static readonly schema = {
|
|
7
|
-
playerSlot: Uint8Array,
|
|
8
|
-
radius: Float32Array,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
public readonly unsafe = {} as {
|
|
12
|
-
playerSlot: Uint8Array;
|
|
13
|
-
radius: Float32Array;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
private _cursorIndex = 0;
|
|
17
|
-
private readonly _cursor: {
|
|
18
|
-
readonly entity: number;
|
|
19
|
-
playerSlot: number;
|
|
20
|
-
radius: number;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
public getCursor(index: number) {
|
|
24
|
-
this._cursorIndex = index;
|
|
25
|
-
return this._cursor;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
constructor(maxEntities: number, buffer: ArrayBuffer, memTracker: MemoryTracker) {
|
|
29
|
-
for (const [fieldName, TypedArrayConstructor] of Object.entries(PlayerBody.schema)) {
|
|
30
|
-
const typedArray = new TypedArrayConstructor(buffer, memTracker.ptr, maxEntities);
|
|
31
|
-
this.unsafe[fieldName as keyof typeof PlayerBody.schema] =
|
|
32
|
-
typedArray as PlayerBody['unsafe'][keyof PlayerBody['unsafe']];
|
|
33
|
-
memTracker.add(typedArray.byteLength);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
37
|
-
const self = this;
|
|
38
|
-
|
|
39
|
-
this._cursor = {
|
|
40
|
-
get entity(): number { return self._cursorIndex; },
|
|
41
|
-
get playerSlot(): number { return self.unsafe.playerSlot[self._cursorIndex]; },
|
|
42
|
-
set playerSlot(value: number) { self.unsafe.playerSlot[self._cursorIndex] = value; },
|
|
43
|
-
get radius(): number { return self.unsafe.radius[self._cursorIndex]; },
|
|
44
|
-
set radius(value: number) { self.unsafe.radius[self._cursorIndex] = value; },
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public static calculateSize(maxEntities: number, memTracker: MemoryTracker): void {
|
|
49
|
-
for (const [, TypedArrayConstructor] of Object.entries(this.schema)) {
|
|
50
|
-
memTracker.add(maxEntities * TypedArrayConstructor.BYTES_PER_ELEMENT);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
Object.defineProperty(PlayerBody, 'name', { value: 'PlayerBody' });
|
package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/PlayerFilter.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { AbstractFilter, MemoryTracker } from '@lagless/binary';
|
|
3
|
-
import { Transform2d } from './Transform2d.js';
|
|
4
|
-
import { PlayerBody } from './PlayerBody.js';
|
|
5
|
-
|
|
6
|
-
export class PlayerFilter extends AbstractFilter {
|
|
7
|
-
public static readonly includeMask = Transform2d.ID | PlayerBody.ID;
|
|
8
|
-
public static readonly excludeMask = 0;
|
|
9
|
-
|
|
10
|
-
constructor(maxEntities: number, buffer: ArrayBuffer, memTracker: MemoryTracker) {
|
|
11
|
-
super(maxEntities, Transform2d.ID | PlayerBody.ID, 0, buffer, memTracker);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
Object.defineProperty(PlayerFilter, 'name', { value: 'PlayerFilter' });
|
package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/PlayerJoined.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { InputDef, InputByteLength, InputPayloadBuffer } from '@lagless/core';
|
|
3
|
-
|
|
4
|
-
export class PlayerJoined {
|
|
5
|
-
public static readonly id = 0;
|
|
6
|
-
public static readonly byteLength = 17;
|
|
7
|
-
|
|
8
|
-
public readonly schema!: {
|
|
9
|
-
slot: number;
|
|
10
|
-
playerId: Uint8Array;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
public static encode(data: PlayerJoined['schema'], buffer: InputPayloadBuffer): void {
|
|
14
|
-
buffer.writeUint8(data.slot);
|
|
15
|
-
for (let i = 0; i < 16; i++) buffer.writeUint8(data.playerId[i]);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public static decode(buffer: InputPayloadBuffer): PlayerJoined['schema'] {
|
|
19
|
-
const slot = buffer.readUint8();
|
|
20
|
-
const playerId = new Uint8Array(16);
|
|
21
|
-
for (let i = 0; i < 16; i++) playerId[i] = buffer.readUint8();
|
|
22
|
-
return { slot, playerId };
|
|
23
|
-
}
|
|
24
|
-
}
|
package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/PlayerLeft.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { InputPayloadBuffer } from '@lagless/core';
|
|
3
|
-
|
|
4
|
-
export class PlayerLeft {
|
|
5
|
-
public static readonly id = 1;
|
|
6
|
-
public static readonly byteLength = 2;
|
|
7
|
-
|
|
8
|
-
public readonly schema!: {
|
|
9
|
-
slot: number;
|
|
10
|
-
reason: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
public static encode(data: PlayerLeft['schema'], buffer: InputPayloadBuffer): void {
|
|
14
|
-
buffer.writeUint8(data.slot);
|
|
15
|
-
buffer.writeUint8(data.reason);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public static decode(buffer: InputPayloadBuffer): PlayerLeft['schema'] {
|
|
19
|
-
const slot = buffer.readUint8();
|
|
20
|
-
const reason = buffer.readUint8();
|
|
21
|
-
return { slot, reason };
|
|
22
|
-
}
|
|
23
|
-
}
|
package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/PlayerResource.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { MemoryTracker } from '@lagless/binary';
|
|
3
|
-
|
|
4
|
-
export class PlayerResource {
|
|
5
|
-
public static readonly schema = {
|
|
6
|
-
id: { type: Uint8Array, length: 16 },
|
|
7
|
-
entity: Uint32Array,
|
|
8
|
-
connected: Uint8Array,
|
|
9
|
-
lastReportedHash: Uint32Array,
|
|
10
|
-
lastReportedHashTick: Uint32Array,
|
|
11
|
-
hashMismatchCount: Uint16Array,
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
public readonly safe = {} as {
|
|
15
|
-
entity: number;
|
|
16
|
-
connected: number;
|
|
17
|
-
lastReportedHash: number;
|
|
18
|
-
lastReportedHashTick: number;
|
|
19
|
-
hashMismatchCount: number;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
public readonly unsafe = {} as {
|
|
23
|
-
id: Uint8Array;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
constructor(playerIndex: number, buffer: ArrayBuffer, memTracker: MemoryTracker) {
|
|
27
|
-
// id: uint8[16]
|
|
28
|
-
const idArray = new Uint8Array(buffer, memTracker.ptr, 16);
|
|
29
|
-
memTracker.add(16);
|
|
30
|
-
(this.unsafe as Record<string, unknown>).id = idArray;
|
|
31
|
-
|
|
32
|
-
// entity: uint32
|
|
33
|
-
const entityArray = new Uint32Array(buffer, memTracker.ptr, 1);
|
|
34
|
-
memTracker.add(4);
|
|
35
|
-
Object.defineProperty(this.safe, 'entity', {
|
|
36
|
-
get: () => entityArray[0],
|
|
37
|
-
set: (v: number) => { entityArray[0] = v; },
|
|
38
|
-
enumerable: true,
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
// connected: uint8
|
|
42
|
-
const connectedArray = new Uint8Array(buffer, memTracker.ptr, 1);
|
|
43
|
-
memTracker.add(1);
|
|
44
|
-
Object.defineProperty(this.safe, 'connected', {
|
|
45
|
-
get: () => connectedArray[0],
|
|
46
|
-
set: (v: number) => { connectedArray[0] = v; },
|
|
47
|
-
enumerable: true,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// lastReportedHash: uint32
|
|
51
|
-
const lastReportedHashArray = new Uint32Array(buffer, memTracker.ptr, 1);
|
|
52
|
-
memTracker.add(4);
|
|
53
|
-
Object.defineProperty(this.safe, 'lastReportedHash', {
|
|
54
|
-
get: () => lastReportedHashArray[0],
|
|
55
|
-
set: (v: number) => { lastReportedHashArray[0] = v; },
|
|
56
|
-
enumerable: true,
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
// lastReportedHashTick: uint32
|
|
60
|
-
const lastReportedHashTickArray = new Uint32Array(buffer, memTracker.ptr, 1);
|
|
61
|
-
memTracker.add(4);
|
|
62
|
-
Object.defineProperty(this.safe, 'lastReportedHashTick', {
|
|
63
|
-
get: () => lastReportedHashTickArray[0],
|
|
64
|
-
set: (v: number) => { lastReportedHashTickArray[0] = v; },
|
|
65
|
-
enumerable: true,
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
// hashMismatchCount: uint16
|
|
69
|
-
const hashMismatchCountArray = new Uint16Array(buffer, memTracker.ptr, 1);
|
|
70
|
-
memTracker.add(2);
|
|
71
|
-
Object.defineProperty(this.safe, 'hashMismatchCount', {
|
|
72
|
-
get: () => hashMismatchCountArray[0],
|
|
73
|
-
set: (v: number) => { hashMismatchCountArray[0] = v; },
|
|
74
|
-
enumerable: true,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
public static calculateSize(_maxEntities: number, memTracker: MemoryTracker): void {
|
|
79
|
-
memTracker.add(16 + 4 + 1 + 4 + 4 + 2);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
Object.defineProperty(PlayerResource, 'name', { value: 'PlayerResource' });
|
package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/ReportHash.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { InputPayloadBuffer } from '@lagless/core';
|
|
3
|
-
|
|
4
|
-
export class ReportHash {
|
|
5
|
-
public static readonly id = 3;
|
|
6
|
-
public static readonly byteLength = 8;
|
|
7
|
-
|
|
8
|
-
public readonly schema!: {
|
|
9
|
-
hash: number;
|
|
10
|
-
atTick: number;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
public static encode(data: ReportHash['schema'], buffer: InputPayloadBuffer): void {
|
|
14
|
-
buffer.writeUint32(data.hash);
|
|
15
|
-
buffer.writeUint32(data.atTick);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public static decode(buffer: InputPayloadBuffer): ReportHash['schema'] {
|
|
19
|
-
const hash = buffer.readUint32();
|
|
20
|
-
const atTick = buffer.readUint32();
|
|
21
|
-
return { hash, atTick };
|
|
22
|
-
}
|
|
23
|
-
}
|
package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/Transform2d.ts
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { MemoryTracker } from '@lagless/binary';
|
|
3
|
-
|
|
4
|
-
export class Transform2d {
|
|
5
|
-
public static readonly ID = 1;
|
|
6
|
-
public static readonly schema = {
|
|
7
|
-
positionX: Float32Array,
|
|
8
|
-
positionY: Float32Array,
|
|
9
|
-
prevPositionX: Float32Array,
|
|
10
|
-
prevPositionY: Float32Array,
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
public readonly unsafe = {} as {
|
|
14
|
-
positionX: Float32Array;
|
|
15
|
-
positionY: Float32Array;
|
|
16
|
-
prevPositionX: Float32Array;
|
|
17
|
-
prevPositionY: Float32Array;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
private _cursorIndex = 0;
|
|
21
|
-
private readonly _cursor: {
|
|
22
|
-
readonly entity: number;
|
|
23
|
-
positionX: number;
|
|
24
|
-
positionY: number;
|
|
25
|
-
prevPositionX: number;
|
|
26
|
-
prevPositionY: number;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
public getCursor(index: number) {
|
|
30
|
-
this._cursorIndex = index;
|
|
31
|
-
return this._cursor;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
constructor(maxEntities: number, buffer: ArrayBuffer, memTracker: MemoryTracker) {
|
|
35
|
-
for (const [fieldName, TypedArrayConstructor] of Object.entries(Transform2d.schema)) {
|
|
36
|
-
const typedArray = new TypedArrayConstructor(buffer, memTracker.ptr, maxEntities);
|
|
37
|
-
this.unsafe[fieldName as keyof typeof Transform2d.schema] =
|
|
38
|
-
typedArray as Transform2d['unsafe'][keyof Transform2d['unsafe']];
|
|
39
|
-
memTracker.add(typedArray.byteLength);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
43
|
-
const self = this;
|
|
44
|
-
|
|
45
|
-
this._cursor = {
|
|
46
|
-
get entity(): number { return self._cursorIndex; },
|
|
47
|
-
get positionX(): number { return self.unsafe.positionX[self._cursorIndex]; },
|
|
48
|
-
set positionX(value: number) { self.unsafe.positionX[self._cursorIndex] = value; },
|
|
49
|
-
get positionY(): number { return self.unsafe.positionY[self._cursorIndex]; },
|
|
50
|
-
set positionY(value: number) { self.unsafe.positionY[self._cursorIndex] = value; },
|
|
51
|
-
get prevPositionX(): number { return self.unsafe.prevPositionX[self._cursorIndex]; },
|
|
52
|
-
set prevPositionX(value: number) { self.unsafe.prevPositionX[self._cursorIndex] = value; },
|
|
53
|
-
get prevPositionY(): number { return self.unsafe.prevPositionY[self._cursorIndex]; },
|
|
54
|
-
set prevPositionY(value: number) { self.unsafe.prevPositionY[self._cursorIndex] = value; },
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public static calculateSize(maxEntities: number, memTracker: MemoryTracker): void {
|
|
59
|
-
for (const [, TypedArrayConstructor] of Object.entries(this.schema)) {
|
|
60
|
-
memTracker.add(maxEntities * TypedArrayConstructor.BYTES_PER_ELEMENT);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
Object.defineProperty(Transform2d, 'name', { value: 'Transform2d' });
|
package/templates/pixi-react/__packageName__-simulation/src/lib/schema/code-gen/Velocity2d.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { MemoryTracker } from '@lagless/binary';
|
|
3
|
-
|
|
4
|
-
export class Velocity2d {
|
|
5
|
-
public static readonly ID = 2;
|
|
6
|
-
public static readonly schema = {
|
|
7
|
-
velocityX: Float32Array,
|
|
8
|
-
velocityY: Float32Array,
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
public readonly unsafe = {} as {
|
|
12
|
-
velocityX: Float32Array;
|
|
13
|
-
velocityY: Float32Array;
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
private _cursorIndex = 0;
|
|
17
|
-
private readonly _cursor: {
|
|
18
|
-
readonly entity: number;
|
|
19
|
-
velocityX: number;
|
|
20
|
-
velocityY: number;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
public getCursor(index: number) {
|
|
24
|
-
this._cursorIndex = index;
|
|
25
|
-
return this._cursor;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
constructor(maxEntities: number, buffer: ArrayBuffer, memTracker: MemoryTracker) {
|
|
29
|
-
for (const [fieldName, TypedArrayConstructor] of Object.entries(Velocity2d.schema)) {
|
|
30
|
-
const typedArray = new TypedArrayConstructor(buffer, memTracker.ptr, maxEntities);
|
|
31
|
-
this.unsafe[fieldName as keyof typeof Velocity2d.schema] =
|
|
32
|
-
typedArray as Velocity2d['unsafe'][keyof Velocity2d['unsafe']];
|
|
33
|
-
memTracker.add(typedArray.byteLength);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
37
|
-
const self = this;
|
|
38
|
-
|
|
39
|
-
this._cursor = {
|
|
40
|
-
get entity(): number { return self._cursorIndex; },
|
|
41
|
-
get velocityX(): number { return self.unsafe.velocityX[self._cursorIndex]; },
|
|
42
|
-
set velocityX(value: number) { self.unsafe.velocityX[self._cursorIndex] = value; },
|
|
43
|
-
get velocityY(): number { return self.unsafe.velocityY[self._cursorIndex]; },
|
|
44
|
-
set velocityY(value: number) { self.unsafe.velocityY[self._cursorIndex] = value; },
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
public static calculateSize(maxEntities: number, memTracker: MemoryTracker): void {
|
|
49
|
-
for (const [, TypedArrayConstructor] of Object.entries(this.schema)) {
|
|
50
|
-
memTracker.add(maxEntities * TypedArrayConstructor.BYTES_PER_ELEMENT);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
Object.defineProperty(Velocity2d, 'name', { value: 'Velocity2d' });
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { ECSDeps } from '@lagless/core';
|
|
3
|
-
|
|
4
|
-
import { Transform2d } from './Transform2d.js';
|
|
5
|
-
import { Velocity2d } from './Velocity2d.js';
|
|
6
|
-
import { PlayerBody } from './PlayerBody.js';
|
|
7
|
-
import { GameState } from './GameState.js';
|
|
8
|
-
import { PlayerResource } from './PlayerResource.js';
|
|
9
|
-
import { PlayerFilter } from './PlayerFilter.js';
|
|
10
|
-
import { MovingFilter } from './MovingFilter.js';
|
|
11
|
-
import { PlayerJoined } from './PlayerJoined.js';
|
|
12
|
-
import { PlayerLeft } from './PlayerLeft.js';
|
|
13
|
-
import { MoveInput } from './MoveInput.js';
|
|
14
|
-
import { ReportHash } from './ReportHash.js';
|
|
15
|
-
|
|
16
|
-
export const <%= projectName %>Core: ECSDeps = {
|
|
17
|
-
components: [Transform2d, Velocity2d, PlayerBody],
|
|
18
|
-
singletons: [GameState],
|
|
19
|
-
playerResources: [PlayerResource],
|
|
20
|
-
filters: [PlayerFilter, MovingFilter],
|
|
21
|
-
inputs: [PlayerJoined, PlayerLeft, MoveInput, ReportHash],
|
|
22
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { AbstractInputProvider, ECSConfig, ECSRunner } from '@lagless/core';
|
|
3
|
-
import { IECSSystemConstructor, ISignalConstructor } from '@lagless/core';
|
|
4
|
-
|
|
5
|
-
import { <%= projectName %>Core } from './<%= projectName %>.core.js';
|
|
6
|
-
|
|
7
|
-
export class <%= projectName %>Runner extends ECSRunner {
|
|
8
|
-
constructor(
|
|
9
|
-
Config: ECSConfig,
|
|
10
|
-
InputProviderInstance: AbstractInputProvider,
|
|
11
|
-
Systems: Array<IECSSystemConstructor>,
|
|
12
|
-
Signals: Array<ISignalConstructor> = []
|
|
13
|
-
) {
|
|
14
|
-
super(Config, InputProviderInstance, Systems, Signals, <%= projectName %>Core);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
import { InputRegistry } from '@lagless/core';
|
|
3
|
-
import { PlayerJoined } from './PlayerJoined.js';
|
|
4
|
-
import { PlayerLeft } from './PlayerLeft.js';
|
|
5
|
-
import { MoveInput } from './MoveInput.js';
|
|
6
|
-
import { ReportHash } from './ReportHash.js';
|
|
7
|
-
|
|
8
|
-
export const <%= projectName %>InputRegistry = new InputRegistry([PlayerJoined, PlayerLeft, MoveInput, ReportHash]);
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
// Generated by @lagless/codegen. Do not edit manually.
|
|
2
|
-
|
|
3
|
-
export * from './<%= projectName %>.core.js';
|
|
4
|
-
export * from './<%= projectName %>.runner.js';
|
|
5
|
-
export * from './<%= projectName %>InputRegistry.js';
|
|
6
|
-
export * from './Transform2d.js';
|
|
7
|
-
export * from './Velocity2d.js';
|
|
8
|
-
export * from './PlayerBody.js';
|
|
9
|
-
export * from './GameState.js';
|
|
10
|
-
export * from './PlayerResource.js';
|
|
11
|
-
export * from './PlayerFilter.js';
|
|
12
|
-
export * from './MovingFilter.js';
|
|
13
|
-
export * from './PlayerJoined.js';
|
|
14
|
-
export * from './PlayerLeft.js';
|
|
15
|
-
export * from './MoveInput.js';
|
|
16
|
-
export * from './ReportHash.js';
|