Skip to content

Add Comprehensive Documentation for SpriteAI SDK Game Development Features #439

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions docs/core-features/game-development-with-sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
# Game Development with SpriteAI SDK

## Overview

The SpriteAI SDK provides powerful tools for game development, enabling developers to easily generate and manage game assets, characters, and environments. This guide will walk you through the core features of game development using the SpriteAI SDK.

## Key Functions for Game Asset Generation

### Character Sprite Generation

The `generateCharacterSpritesheet()` function allows you to create dynamic character spritesheets with multiple animation states:

```javascript
import { generateCharacterSpritesheet } from 'spriteai';

async function createPlayerSprite() {
const playerSprite = await generateCharacterSpritesheet('fantasy warrior', {
states: ['idle', 'walk', 'run', 'attack'],
framesPerState: 6,
style: 'pixel-art'
});

console.log(playerSprite.metadata);
}
```

#### Available Options
- `states`: Animation states (default: ['idle', 'walk', 'run', 'attack'])
- `framesPerState`: Number of frames per animation state
- `style`: Sprite art style
- `size`: Spritesheet dimensions
- `save`: Option to save the generated spritesheet

### Available Animation States

You can fetch the list of predefined animation states:

```javascript
import { fetchAvailableAnimationStates } from 'spriteai';

async function getAnimationStates() {
const states = await fetchAvailableAnimationStates();
console.log(states);
// Returns: ['idle', 'walk', 'run', 'attack', 'jump', 'fall', 'hurt', 'die']
}
```

### Available Sprite Styles

Get a list of supported sprite art styles:

```javascript
import { fetchAvailableSpriteStyles } from 'spriteai';

async function getSpriteStyles() {
const styles = await fetchAvailableSpriteStyles();
console.log(styles);
// Returns: ['pixel-art', 'vector', '3d', 'hand-drawn', 'anime']
}
```

## Environment and Item Sprite Generation

### Creating Environment Sprites

Generate environment tilesets for your game world:

```javascript
import { generateEnvironmentSprites } from 'spriteai';

async function createGameEnvironment() {
const environmentSprites = await generateEnvironmentSprites('fantasy forest', {
elements: 4,
style: 'pixel-art',
theme: 'fantasy'
});

console.log(environmentSprites.metadata);
}
```

### Creating Item Sprites

Generate item sprites for inventory and collectibles:

```javascript
import { generateItemSprites } from 'spriteai';

async function createGameItems() {
const itemSprites = await generateItemSprites('medieval weapons', {
itemCount: 4,
style: 'pixel-art',
itemType: 'equipment'
});

console.log(itemSprites.metadata);
}
```

## Background Color Removal

Remove background colors from sprites for seamless integration:

```javascript
import { removeBackgroundColor } from 'spriteai';

async function processSprite() {
await removeBackgroundColor(
'input-sprite.png',
'output-sprite.png',
'white',
colorThreshold
);
}
```

## Best Practices

1. Always check the available styles and states before generating sprites
2. Use consistent art styles across your game assets
3. Experiment with different generation options
4. Save generated assets for reuse
5. Consider performance when generating large or complex spritesheets

## Next Steps

- Explore advanced sprite manipulation techniques
- Learn about animation state management
- Investigate sprite optimization strategies

Happy game development with SpriteAI!
125 changes: 125 additions & 0 deletions docs/core-features/sdk-quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# SDK Quickstart Guide

## Overview

This quickstart guide will help you get started with the SpriteAI SDK, providing a step-by-step introduction to generating game sprites and assets.

## Prerequisites

- Node.js (version 12 or higher)
- npm package manager
- OpenAI API key (for AI-powered sprite generation)

## Installation

Install the SpriteAI SDK using npm:

```bash
npm install spriteai
```

## Basic Usage

### Character Sprite Generation

Generate a character spritesheet with different animation states:

```javascript
import { generateCharacterSpritesheet } from 'spriteai';

async function createCharacterSprite() {
const characterSprite = await generateCharacterSpritesheet('warrior hero', {
states: ['idle', 'walk', 'run', 'attack'],
style: 'pixel-art',
framesPerState: 6
});

console.log(characterSprite.metadata);
}
```

### Available Animation States

Retrieve a list of available animation states:

```javascript
import { fetchAvailableAnimationStates } from 'spriteai';

async function getAnimationStates() {
const states = await fetchAvailableAnimationStates();
console.log('Available Animation States:', states);
}
```

### Sprite Styles

Get a list of available sprite styles:

```javascript
import { fetchAvailableSpriteStyles } from 'spriteai';

async function getSpriteStyles() {
const styles = await fetchAvailableSpriteStyles();
console.log('Available Sprite Styles:', styles);
}
```

## Advanced Sprite Generation

### Environment Sprites

Generate environment sprites for your game:

```javascript
import { generateEnvironmentSprites } from 'spriteai';

async function createEnvironmentSprites() {
const environmentSprites = await generateEnvironmentSprites('fantasy forest', {
elements: 4,
style: 'pixel-art',
theme: 'fantasy'
});

console.log(environmentSprites.metadata);
}
```

### Item Sprites

Create game item sprites:

```javascript
import { generateItemSprites } from 'spriteai';

async function createItemSprites() {
const itemSprites = await generateItemSprites('medieval weapons', {
itemCount: 4,
style: 'pixel-art',
itemType: 'equipment'
});

console.log(itemSprites.metadata);
}
```

## Best Practices

- Always handle async operations with try/catch
- Check the metadata returned by sprite generation functions
- Use appropriate styles and state configurations for your game
- Consider saving generated sprites for reuse

## Next Steps

- Explore the full API documentation
- Join our community forums for tips and advanced techniques
- Experiment with different sprite generation options

## Troubleshooting

- Ensure you have a valid OpenAI API key
- Check your internet connection
- Verify the SDK is up to date
- Review the error messages for specific issues

Happy sprite creation!
Loading