使用ecs系统进行重构

This commit is contained in:
walkpan
2025-01-31 21:50:59 +08:00
parent 6ea3e9504d
commit c5c01c6cf4
18 changed files with 491 additions and 44 deletions

150
settings/README.md Normal file
View File

@@ -0,0 +1,150 @@
# 基于马斯洛需求理论的IAA小游戏设计指南
## 设计理论映射
### 需求层次对应游戏机制
1. **生理需求** → 即时反馈机制(基础操作快感)
2. **安全需求** → 稳定预期系统(进度保存/每日奖励)
3. **社交需求** → 轻量化社交功能(排行榜/分享)
4. **尊重需求** → 成就认可体系(徽章/称号)
5. **自我实现** → 成长系统(角色培养/技能树)
![马斯洛需求层次与游戏机制对应关系示意图]
## 分层实现策略
### 1. 生理需求层 - 即时反馈系统
```typescript
/** 短平快爽感循环设计 */
class GameCore {
// 每10秒设置一个小高潮点
createQuickRewardCycle() {
setInterval(() => {
this.spawnPowerUp(); // 生成强化道具
this.playJuicyEffect(); // 播放炸裂特效
this.vibrateDevice(200); // 设备震动反馈
}, 10000);
}
}
```
### 2. 安全需求层 - 稳定预期系统
```typescript
/** 七日循环奖励机制 */
class DailyReward {
private streakDays: number = 0;
checkLogin() {
if (!this.isClaimedToday()) {
this.streakDays = (this.streakDays + 1) % 7;
this.giveReward(this.streakDays);
// 第七日大奖设计
if (this.streakDays === 0) {
this.giveSpecialPrize();
this.showFireworksAnimation();
}
}
}
}
```
### 3. 社交需求层 - 异步互动系统
```typescript
/** 动态排行榜实现 */
class SocialSystem {
updateLeaderboard(score: number) {
// 三轴对比系统
const comparisonData = {
top10: this.getTopPlayers(10),
nearby: this.getNearestPlayers(score),
friends: this.getFriendScores()
};
this.displayLeaderboard(comparisonData);
// 破纪录特效
if (score > this.bestScore) {
this.playRecordBreakEffect();
this.saveLocalRecord(score);
}
}
}
```
### 4. 尊重需求层 - 成就系统
```typescript
/** 阶梯式成就解锁 */
class AchievementSystem {
unlockAchievement(id: string) {
if (!this.isUnlocked(id)) {
// 成就解锁三要素
this.showUnlockAnimation(id);
this.triggerSocialNotification();
this.awardExclusiveSkin(id);
}
}
/** 进度追踪设计 */
trackProgress(metric: string, target: number) {
const progress = this.getProgress(metric);
this.showProgressBar(metric, progress, target);
}
}
```
### 5. 自我实现层 - 成长系统
```typescript
/** 非线性成长曲线 */
class ProgressionSystem {
private xp: number = 0;
/** 经验值增益算法 */
addExperience(value: number) {
const multiplier = 1 + this.getPrestigeLevel() * 0.2;
this.xp += value * multiplier;
// 动态难度调整
const needXP = 100 * Math.pow(1.5, this.level) * this.difficultyFactor;
if (this.xp >= needXP) {
this.levelUp();
this.unlockBranchingAbility();
}
}
}
```
## 增强粘性设计
### 可变奖励机制
```typescript
/** 多级奖励池设计 */
class LootSystem {
generateReward() {
const rewardTiers = [
{ pool: ["coin", "gem"], weight: 80 },
{ pool: ["energy", "ticket"], weight: 15 },
{ pool: ["legendarySkin"], weight: 5 }
];
return this.selectFromWeightedPool(rewardTiers);
}
}
```
### 峰终体验设计
```typescript
/** 单局体验优化 */
class RoundManager {
endGameSession() {
// 终局三要素
this.playHighlightReplay();
this.showProgressComparison();
this.presentContinueOptions();
// 广告接入点
if (this.checkAdOpportunity()) {
this.showRewardedAdButton();
}
}
}
```
## 关键平衡要素
1. **时长控制**:单局时长 ≤3分钟通过动态难度调整实现
2. **广告融合**:在成就时刻(新纪录/升级时)提供奖励视频选项
3. **内容更新**每次版本更新保留10%新内容供探索
4. **难度曲线**:波浪形难度设计(紧张→放松→紧张的循环)
## 系统协同效应
- 🎮 **即时反馈** → 满足本能快感(生理层)
- 📅 **每日目标** → 建立稳定预期(安全层)
- 🏆 **社交对比** → 激发竞争欲望(社交/尊重层)
- 🌱 **成长体系** → 实现自我价值(自我实现层)
最终形成「高频短时+长线目标」的双层吸引力模型,通过神经可塑性原理培养玩家习惯,提升长期留存。