The NPC Face Editor allows you to create custom pixel art faces for your NPCs. Each NPC can have a unique face that will be displayed in-game on a 128x128 texture.
Location: tools/face-editor.html Access: Open directly in web browser - no server needed!
Features
Drawing Canvas
512x512 Editor Canvas: Large canvas for easy pixel art creation
128x128 Preview: Real-time preview of how the face will look in-game
Pixelated Rendering: Sharp, retro pixel art aesthetic
Drawing Tools
1. Draw Tool (✏️)
Default tool for drawing pixels
Use selected color and brush size
Click and drag to draw
2. Erase Tool (🧹)
관련 스킬
Removes pixels by painting with the NPC's skin color
Same brush size controls as draw tool
Useful for fixing mistakes
3. Fill Tool (🪣)
Flood fill an area with selected color
Click on any region to fill all connected pixels of the same color
Great for filling large areas quickly
4. Eyedropper Tool (💧)
Pick colors from the canvas
Click any pixel to select its color
Useful for matching existing colors
Brush Sizes
Four square brush sizes available:
1x1: Single pixel precision
2x2: Small square brush
8x8: Large square brush for quick coverage
16x16: XL square brush (same size as default face eye)
Color Palette
Preset Colors
12 pre-selected colors optimized for NPC faces:
Black (#000000) - Eyes, outlines
White (#FFFFFF) - Eyes, teeth
Brown (#8B4513) - Hair, eyebrows
Blue (#4169E1) - Eyes
Green (#228B22) - Eyes
Red (#FF0000) - Blush, details
Gold (#FFD700) - Jewelry, decorations
Pink (#FF69B4) - Blush, lips
Gray (#808080) - Beards, shadows
Sienna (#A0522D) - Dark hair
Tan (#DEB887) - Light skin tones
Purple (#9370DB) - Mystical effects
Custom Color Picker
Full color picker for any hex color
Located below the preset palette
Selected color is automatically used for drawing
Quick Actions
Clear (🗑️)
Clears the entire canvas
Fills with NPC's skin color
Use this to start fresh
Default Face (😊)
Loads the default hard-coded face
Features: Simple eyes, nose, and mouth
Good starting point for customization
Workflow
Creating a New Face
Open NPC Editor (tools/npc-editor.html)
Select an NPC from the list
Click "✏️ Edit Face" button
Draw your face:
Start with the Default Face button for a template
Or clear and draw from scratch
Use different tools and brush sizes as needed
Preview your work in the 128x128 preview box
Save when satisfied
Editing an Existing Face
Open the Face Editor for an NPC with a saved face
The existing face will load automatically
Make your changes
Save to update
Best Practices
Resolution Awareness
Editor is 512x512, but game uses 128x128
What looks smooth at 512px may look blocky at 128px
Check the preview frequently! This is how it will appear in-game
Design Tips
Keep it simple: Small details may not be visible at 128x128
Use contrast: High contrast features read better at low resolution
Symmetry: Most faces look better when symmetrical
Reference the default: The default face is well-proportioned for the 128px resolution
Test in-game: Load the NPC in-game to see the actual result
Color Choices
Skin tones are inherited from NPC's base color
Use darker shades for depth (eyebrows, shadows)
Use lighter shades for highlights
Black and white work well for high contrast features
Consider which colors contrast with the NPC's shirt color
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
for f in public/data/npcs/*.json; do
echo "Checking $f..."
node -e "JSON.parse(require('fs').readFileSync('$f'))" && echo "✓ Valid"
done
Remove all face data (reset)
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
# Backup first!
cp public/data/npcs/*.json public/data/npcs/backup/
# Then modify to remove faceData fields
Verify PNG encoding
cd /home/gianfiorenzo/Documents/Vs\ Code/babylon_fp
# Check if face data starts with correct PNG data URL prefix
grep -o '"faceData": "data:image/png;base64,[^"]*"' public/data/npcs/*.json | head -1
Keyboard Shortcuts
Currently the Face Editor uses mouse-only controls. Potential future shortcuts:
D - Draw tool
E - Erase tool
F - Fill tool
I - Eyedropper
[ / ] - Decrease/increase brush size
Ctrl+Z - Undo (not yet implemented)
Space - Pan canvas (not yet implemented)
Future Enhancements
Potential improvements for future versions:
Undo/Redo history
Layer system for organization
Animation frames for expressions
Face templates/presets
Import/export individual faces
Symmetry tool for better proportions
Grid overlay for alignment
Zoom and pan for detail work
Animation system for animated expressions
Facial expression presets (happy, sad, angry, etc.)