将源代码输入传递给 AST 分析的流程
编写日期:2026 年 6 月 26 日
目的
本文档用于补充 docs/roadmaps/2026-06-25-source-analysis-scoring-architecture.md 的前置部分。
在基准路线图中已经整理了以下流程。
project source
-> AST chunks or direct chunks
-> official docs JSONL retrieval
-> on-demand LLM verification
-> score DB
-> classified filesystem这里整理了当用户提供提示词和源代码时,如何将这些输入以何种形式传递给 AST Parser。
核心原则
提示词和源代码虽然属于同一输入集合,但作用不同。
| 输入 | 作用 |
|---|---|
| 用户提示词 | 分析意图、问题类型、期望输出方向 |
| 源代码 | AST Parser 实际要解析的对象 |
| 文件路径/项目信息 | 用于识别分析单元、进行项目级别分类的元数据 |
AST Parser 解析源代码。提示词并不是 AST 语法分析的对象。
不过提示词会在后续阶段用于决定先查看哪些片段、使用哪个 Retriever、以及在 Qwen 3.6 中生成何种验证请求。
输入包
用户输入首先被汇总为一个分析请求。
analysis_request
prompt
source
source_kind
project_id
source_file
source_sha256
source_origin各项的含义如下。
| 项目 | 说明 |
|---|---|
prompt |
用户输入的问题。例如:“这段代码是什么意思?”, “需要转换为 Godot 4 吗?” |
source |
原始源码文本。尽可能原样保留。 |
source_kind |
gdscript、scene、resource、project_config、markdown、unknown 等输入类型 |
project_id |
用于区分 GitHub 仓库或本地项目的 ID |
source_file |
项目内的文件路径。如果是单个代码粘贴,则使用临时路径。 |
source_sha256 |
原始源码文本的哈希值。粘贴和文件输入都会在请求创建时计算。 |
source_origin |
github、local_directory、uploaded_file、pasted_snippet 等来源 |
在此阶段不确定输出 JSONL 架构或 score DB 列。目的是让 AST Parser 与后续 Retriever/LLM 步骤能够以相同的基准追踪相同的输入。
单个源码粘贴
用户在 Web UI 或 CLI 中直接输入提示词和源码的情况。
示例:
需要将此转换为 Godot 4 吗?
extends KinematicBody2D
func _physics_process(delta):
move_and_slide()处理流程:
- 将输入包装为
analysis_request。 source_origin设为pasted_snippet。- 由于没有实际文件路径,
source_file使用类似pasted://snippet-<id>.gd的临时标识符。 source_sha256根据粘贴的原始代码立即计算。source_kind根据扩展名提示、代码内容、用户指定的语言进行推断。- 将
source、source_kind、source_file、source_sha256传递给 AST Parser。 - 将 Prompt 保存在
analysis_request.prompt中,不与 Parser 混用。
项目目录输入
用于分析 GitHub 仓库或本地文件夹的情况。
处理流程:
- 将项目根目录包装为
project_id。 - 按相对路径遍历文件系统。
- 首先记录每个文件的包含/排除状态。
- 将被排除的文件以
excluded_files形式保留,以便在 Web UI 或日志中查看。 - 将被包含的文件展开为带有
# <relative/path>标题的纯文本块。 .gd文件交给 AST Parser,按原始顺序生成函数/代码片段。- 对非 AST Parser 目标的包含文件,应用适合文件特性的直接碎片化规则。
- 每个碎片携带原始路径、原始顺序、哈希后传递给 Retriever 请求。
初始目标文件与基准路线图相同。
| 文件 | AST/碎片化方向 |
|---|---|
.gd |
GDScript AST,函数,类,signal,变量,API 调用候选 |
.tscn |
场景节点类型,脚本引用,资源引用,导出属性 |
.tres |
资源类型,脚本类,material/shader/resource 线索 |
project.godot |
Godot 版本提示,autoload,renderer,feature,input map |
| README/文档 | 基本上在源码 AST 分析中排除。将排除与否及原因记录在 UI/日志中。 |
项目源码纯文本展开
项目级输入首先展开为按文件分组的纯文本块。该纯文本不是直接一次性放入 LLM 的最终 Prompt,而是为保持文件边界和相对路径而使用的中间表示。
基本形式:
# project.godot
; original project.godot content
# scripts/player.gd
extends KinematicBody2D
func _physics_process(delta):
move_and_slide(velocity)
# scenes/player.tscn
[gd_scene load_steps=2 format=3]
[node name="Player" type="CharacterBody2D"]规则:
- 文件头部使用
# <relative/path>形式。 - 相对路径以项目根目录为基准。
- 文件正文尽可能保持原文不变。
- 此纯文本块用于文件边界确认和调试。
- 实际处理时不会一次性将整个纯文本块交给 LLM 或 AST 解析器。
- 通过标题划分的每个文件首先接受包含/排除判定。
- 被排除的文件记录在
excluded_files中。 - 被包含的
.gd文件会经过analysis_request后进入 AST 解析器。 - 被包含的非
.gd文本/配置文件直接交给分块器处理。
这样既能保留用户提供的“整个项目源码”供人阅读,又能在后续阶段按文件/分块追踪排除文件、AST 分块、直接分块、Retriever 负载等信息。
克隆项目基准确认计划
仅凭抽象示例难以确认 AST 解析器向 Retriever 传递的流程。因此,需要克隆一个实际的 Godot 项目,并以该项目的文件树、纯文本展开、AST 分块/直接分块划分、Retriever 请求循环等为基准进行确认。
基准项目设置如下。
| 项目 | 值 |
|---|---|
| 仓库 | godotengine/godot-demo-projects |
| 项目路径 | 2d/dodge_the_creeps |
| 选择原因 | 是 Godot 官方演示项目,包含 .gd、.tscn、project.godot、README、资源引用等,可小范围验证项目输入流程。 |
| 保存基准 | 克隆的源码不提交到仓库,仅在文档中保留树结构和处理计划。 |
克隆基准:
git clone --depth 1 --filter=blob:none --sparse https://github.com/godotengine/godot-demo-projects.git /tmp/idea_world_godot_demo_projects
cd /tmp/idea_world_godot_demo_projects
git sparse-checkout set 2d/dodge_the_creeps此克隆用于流程确认。不会复制仓库中克隆的项目源代码或资源。
确认对象是克隆项目的全部文件路径。首先按排序顺序展开所有路径,并将每个文件划分为 LLM 可读取的片段。此处不创建额外的中间数据库。关键不是“一次性读取整个仓库”,而是“按路径顺序创建片段,并对每个片段多次调用”。
2d/dodge_the_creeps
.gitignore
LICENSE
README.md
art/House In a Forest Loop.ogg
art/House In a Forest Loop.ogg.import
art/enemyFlyingAlt_1.png
art/enemyFlyingAlt_1.png.import
art/enemyFlyingAlt_2.png
art/enemyFlyingAlt_2.png.import
art/enemySwimming_1.png
art/enemySwimming_1.png.import
art/enemySwimming_2.png
art/enemySwimming_2.png.import
art/enemyWalking_1.png
art/enemyWalking_1.png.import
art/enemyWalking_2.png
art/enemyWalking_2.png.import
art/gameover.wav
art/gameover.wav.import
art/playerGrey_up1.png
art/playerGrey_up1.png.import
art/playerGrey_up2.png
art/playerGrey_up2.png.import
art/playerGrey_walk1.png
art/playerGrey_walk1.png.import
art/playerGrey_walk2.png
art/playerGrey_walk2.png.import
fonts/FONTLOG.txt
fonts/LICENSE.txt
fonts/Xolonium-Regular.ttf
fonts/Xolonium-Regular.ttf.import
hud.gd
hud.gd.uid
hud.tscn
icon.webp
icon.webp.import
main.gd
main.gd.uid
main.tscn
mob.gd
mob.gd.uid
mob.tscn
player.gd
player.gd.uid
player.tscn
project.godot
screenshots/.gdignore
screenshots/dodge.png文件碎片化标准:
| 文件类型 | 碎片化方式 | 后续调用方式 |
|---|---|---|
.gd |
AST Parser 按原始顺序生成函数、signal、变量、class extends、API 调用碎片。 | 对每个 AST 碎片调用 Retriever,并将 提示词 + AST 碎片 + 检索结果 发送给 LLM。 |
project.godot |
不放入 AST Parser。若为包含对象,则生成 section/key-value、主场景、特性、input map 碎片。 | 直接将碎片发送给 Retriever,或作为 .gd AST 判断的周边上下文附加。 |
.tscn, .tres |
不放入 AST Parser。若为包含对象,则生成 node block、ext_resource、sub_resource、connection 碎片。 | 直接将碎片发送给 Retriever,或作为关联的 .gd 文件的 AST 判断的周边上下文附加。 |
.md, .txt, LICENSE |
在源码 AST 分析中默认排除。 | 将排除与否及原因记录在 UI/日志中。若不是单独的文档分析模式,则不发送给 Retriever。 |
.import, .uid, .gitignore, .gdignore |
不放入 AST Parser。若为包含对象,则生成行或 key-value 碎片。 | 直接将碎片发送给 Retriever,或仅用作文件路径/资源关系的周边上下文。 |
| 图片、音频、字体等二进制文件 | 同样不放入 AST Parser,也不将原始 bytes 放入 LLM。仅保留路径和排除原因。 | 当该路径出现在 .tscn、.import 等文本碎片中时,仅作为关联信息使用。 |
即进入 AST Parser 的对象是 .gd 文件。整个仓库按路径顺序展开,但结果并不是“一次性发送给 LLM 的大正文”。# <relative/path> 标题用于标记文件来源路径,以及随后被拆分为哪些函数/代码/设置碎片并进入 Retriever。像 .md 这类被排除的文件会记录在排除列表中,包含的 .gd 文件则由 AST Parser 按函数或代码碎片顺序拆分。随后对 LLM 的调用始终以 提示词 + 当前碎片 + Retriever 检索结果 的形式多次执行。
for each file in repository path order:
record file path under "# <relative/path>"
if file is excluded by source-analysis policy:
save excluded_files entry with reason
continue
if file.path endswith ".gd":
ast_chunks = ast_parse(full_file_text)
for each ast_chunk in ast_chunks:
retrieved = retrieve(build_query_from_chunk(prompt, ast_chunk))
response = call_llm(prompt + ast_chunk + retrieved)
validate(response)
save_chunk_result(response)
else:
text_chunks = split_without_ast(file)
for each text_chunk in text_chunks:
retrieved = retrieve(build_query_from_chunk(prompt, text_chunk))
response = call_llm(prompt + text_chunk + retrieved)
validate(response)
save_chunk_result(response)最终的 LLM 输入单元始终是以下形式。
llm_judgment_request
user_prompt
project_id
source_file
chunk_id
chunk_order
chunk_kind
chunk_text
retrieved_evidenceRetriever 搜索输入
Retriever 只负责在数据库中搜索我提供的代码片段。文件路径、chunk id、chunk order 不是搜索条件,而是追踪信息。因此在实现中将这两个对象分离。
chunk_trace
project_id
source_file
source_sha256
chunk_id
chunk_order
chunk_kindretriever_query
query_text
query_terms
raw_chunk_text
symbol_candidates
api_call_candidates
reference_candidates
prompt_termschunk_trace仅用于 UI、日志、重启、调试、LLM 响应连接。Retriever 搜索函数只传递 retriever_query。
AST/direct chunk
-> build_retriever_query(chunk_text, extracted_candidates, user_prompt)
-> retriever.search(retriever_query)
-> orchestrator attaches chunk_trace to returned hits
-> prompt + chunk_text + retrieved_hits -> LLM judgment即搜索使用以下值。
| 使用于搜索 | 不用于搜索 |
|---|---|
chunk_text |
source_file |
symbol_candidates |
chunk_id |
api_call_candidates |
chunk_order |
reference_candidates |
source_sha256 |
prompt_terms |
project_id |
需要文件路径的原因是追踪,而不是搜索。例如,需要有 player.gd:function:_process 这样的 trace,才能在网页 UI 中显示 “此响应来自 player.gd 的第四段”。但当 Retriever 在数据库中查找依据时,需要搜索的不是 player.gd 路径,而是 _process 函数内部的代码和 API 候选项。
例如,player.gd 的 _process 函数片段首先会将追踪信息和搜索信息分离。
chunk_trace
project_id: "github:godotengine/godot-demo-projects/2d/dodge_the_creeps"
source_file: "player.gd"
source_sha256: "87f4fcf7481dba031f74a363475cee75b81c3d42eb1347b318f6b824e37329a6"
chunk_id: "player.gd:function:_process"
chunk_order: 4
chunk_kind: "function"retriever_query
raw_chunk_text: |
func _process(delta):
var velocity = Vector2.ZERO # The player's movement vector.
if Input.is_action_pressed(&"move_right"):
velocity.x += 1
if Input.is_action_pressed(&"move_left"):
velocity.x -= 1
if Input.is_action_pressed(&"move_down"):
velocity.y += 1
if Input.is_action_pressed(&"move_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite2D.play()
else:
$AnimatedSprite2D.stop()
position += velocity * delta
position = position.clamp(Vector2.ZERO, screen_size)
if velocity.x != 0:
$AnimatedSprite2D.animation = &"right"
$AnimatedSprite2D.flip_v = false
$Trail.rotation = 0
$AnimatedSprite2D.flip_h = velocity.x < 0
elif velocity.y != 0:
$AnimatedSprite2D.animation = &"up"
rotation = PI if velocity.y > 0 else 0
symbol_candidates:
- "Vector2"
- "AnimatedSprite2D"
api_call_candidates:
- "Input.is_action_pressed"
- "Vector2.ZERO"
- "velocity.normalized"
- "position.clamp"
reference_candidates: []
prompt_terms:
- "Godot 3"
- "Godot 4"
- "migration"
query_terms:
- "Input.is_action_pressed"
- "Vector2.ZERO"
- "velocity.normalized"
- "position.clamp"
- "Vector2"
- "AnimatedSprite2D"
- "_process"
- "Godot 3"
- "Godot 4"
- "migration"
query_text: "Input.is_action_pressed Vector2.ZERO velocity.normalized position.clamp Vector2 AnimatedSprite2D _process Godot 3 Godot 4 migration"Retriever 检索 代码 标准
以下代码是用于固定实现方向的基准。向 Retriever 只传递 RetrieverQuery。ChunkTrace 在 Retriever 之外由 orchestrator 持有,然后与搜索结果重新绑定。
from dataclasses import dataclass, field
import re
@dataclass(frozen=True)
class ChunkTrace:
project_id: str
source_file: str
source_sha256: str
chunk_id: str
chunk_order: int
chunk_kind: str
@dataclass(frozen=True)
class RetrieverQuery:
query_text: str
query_terms: list[str]
raw_chunk_text: str
symbol_candidates: list[str] = field(default_factory=list)
api_call_candidates: list[str] = field(default_factory=list)
reference_candidates: list[str] = field(default_factory=list)
prompt_terms: list[str] = field(default_factory=list)
@dataclass(frozen=True)
class RetrievalHit:
table_name: str
record_id: str
score: float
title: str
content: str
metadata: dict
IDENTIFIER_RE = re.compile(r"[A-Za-z_][A-Za-z0-9_]*(?:\\.[A-Za-z_][A-Za-z0-9_]*)?")
def unique_keep_order(values: list[str]) -> list[str]:
seen: set[str] = set()
result: list[str] = []
for value in values:
normalized = value.strip()
if normalized and normalized not in seen:
seen.add(normalized)
result.append(normalized)
return result
def extract_identifiers(chunk_text: str) -> list[str]:
return unique_keep_order(IDENTIFIER_RE.findall(chunk_text))
def extract_prompt_terms(user_prompt: str) -> list[str]:
terms: list[str] = []
prompt = user_prompt.lower()
if "godot 3" in prompt or "godot3" in prompt:
terms.append("Godot 3")
if "godot 4" in prompt or "godot4" in prompt:
terms.append("Godot 4")
if "변환" in user_prompt or "마이그레이션" in user_prompt or "migration" in prompt:
terms.extend(["migration", "deprecated", "renamed"])
if "설명" in user_prompt or "뜻" in user_prompt or "explain" in prompt:
terms.extend(["description", "usage"])
return terms
def build_retriever_query(
*,
user_prompt: str,
chunk_text: str,
symbol_candidates: list[str],
api_call_candidates: list[str],
reference_candidates: list[str],
) -> RetrieverQuery:
prompt_terms = extract_prompt_terms(user_prompt)
query_terms = unique_keep_order(
api_call_candidates
+ symbol_candidates
+ reference_candidates
+ extract_identifiers(chunk_text)
+ prompt_terms
)
return RetrieverQuery(
query_text=" ".join(query_terms),
query_terms=query_terms,
raw_chunk_text=chunk_text,
symbol_candidates=symbol_candidates,
api_call_candidates=api_call_candidates,
reference_candidates=reference_candidates,
prompt_terms=prompt_terms,
)
def build_embedding_text(query: RetrieverQuery) -> str:
return "\n".join(
[
query.raw_chunk_text,
" ".join(query.api_call_candidates),
" ".join(query.symbol_candidates),
" ".join(query.reference_candidates),
" ".join(query.prompt_terms),
]
)
def retrieve_for_query(db, embedder, query: RetrieverQuery, limit_per_table: int = 5) -> list[RetrievalHit]:
query_embedding = embedder.embed_query(build_embedding_text(query))
tables = ["docs_chunks", "api_mapping", "label_prototypes"]
hits: list[RetrievalHit] = []
for table_name in tables:
hits.extend(search_table(db, table_name, query, query_embedding, limit_per_table))
hits.sort(key=lambda hit: hit.score, reverse=True)
return hits
def search_table(db, table_name: str, query: RetrieverQuery, query_embedding: list[float], limit: int) -> list[RetrievalHit]:
sql = """
select
%(table_name)s as table_name,
id::text as record_id,
title,
content,
metadata,
1 - (embedding <=> %(query_embedding)s::vector) as vector_score,
ts_rank(search_tsv, websearch_to_tsquery('simple', %(query_text)s)) as text_score,
similarity(search_text, %(query_text)s) as trigram_score
from godot_rag.dynamic_retrieval_view
where table_name = %(table_name)s
and (
embedding is not null
or
search_tsv @@ websearch_to_tsquery('simple', %(query_text)s)
or search_text %% %(query_text)s
)
order by
embedding <=> %(query_embedding)s::vector asc,
ts_rank(search_tsv, websearch_to_tsquery('simple', %(query_text)s)) desc,
similarity(search_text, %(query_text)s) desc
limit %(limit)s
"""
rows = db.fetch_all(
sql,
{
"table_name": table_name,
"query_text": query.query_text,
"query_embedding": query_embedding,
"limit": limit,
},
)
return [
RetrievalHit(
table_name=row["table_name"],
record_id=row["record_id"],
score=float(row["vector_score"] or 0) + float(row["text_score"] or 0) + float(row["trigram_score"] or 0),
title=row["title"],
content=row["content"],
metadata={
**row["metadata"],
"query_text": query.query_text,
"query_terms": query.query_terms,
},
)
for row in rows
]
def retrieve_with_trace(db, embedder, trace: ChunkTrace, query: RetrieverQuery) -> dict:
hits = retrieve_for_query(db, embedder, query)
return {
"trace": trace,
"retriever_query": query,
"hits": hits,
}在上述代码中,重要点如下。
- Retriever 检索函数不接受
source_file、chunk_id、chunk_order作为检索条件。 - Retriever 使用代码片段中生成的
query_embedding进行向量搜索,query.query_text用于关键字/三元组的辅助检索。 query_embedding由raw_chunk_text、API 候选、符号候选、提示意图词组合而成。query.query_text由文件内部代码片段中提取的 API、符号、标识符、提示意图词构成。- 文件路径和 chunk 顺序仅保留在
ChunkTrace中。 retrieve_with_trace是在检索后将结果与 trace 捆绑的 orchestrator 函数,实际检索由retrieve_for_query完成。docs_chunks、api_mapping、label_prototypes使用相同的RetrieverQuery进行检索。
godot_rag.dynamic_retrieval_view 并非新的判断逻辑,而是用于检索的平坦化视图。即使三个表的 payload 结构不同,Retriever 也会看到相同的列。
dynamic_retrieval_view
table_name
id
title
content
embedding
search_text
search_tsv
metadata搜索目标展开如下。这里仍然将 source_file、source_url 等来源字段保留在 metadata 中,但不放入默认搜索字符串。搜索应基于代码片段的 API/符号/模式进行。
| 表格 | title |
content |
search_text 中的值 |
|---|---|---|---|
docs_chunks |
文档标题、section 路径、symbol | 文档正文块 | doc_type、symbol、section_path、content、api_symbols |
api_mapping |
已更改的 API 或旧 API 名称 | 迁移说明、变更原因、示例 | old_symbol、new_symbol、change_type、description、before_code、after_code |
label_prototypes |
prototype 名称或标签 | 函数使用方式、参数构成、调用模式变更示例 | label、input_pattern、prompt_pattern、before_code、after_code、expected_response、explanation |
示例 SQL 视图形式:
create or replace view godot_rag.dynamic_retrieval_view as
select
'docs_chunks' as table_name,
id,
coalesce(payload->>'title', payload->>'symbol', source_file) as title,
coalesce(payload->>'content', '') as content,
embedding,
concat_ws(
' ',
payload->>'doc_type',
payload->>'symbol',
payload->>'section_path',
payload->>'content',
payload->>'api_symbols'
) as search_text,
search_tsv,
payload || jsonb_build_object('source_file', source_file, 'source_url', payload->>'source_url') as metadata
from godot_rag.docs_chunks
union all
select
'api_mapping' as table_name,
id,
concat_ws(' -> ', payload->>'old_symbol', payload->>'new_symbol') as title,
concat_ws(' ', payload->>'description', payload->>'rationale') as content,
embedding,
concat_ws(
' ',
payload->>'old_symbol',
payload->>'new_symbol',
payload->>'change_type',
payload->>'description',
payload->>'before_code',
payload->>'after_code'
) as search_text,
search_tsv,
payload || jsonb_build_object('source_file', source_file, 'source_url', payload->>'source_url') as metadata
from godot_rag.api_mapping
union all
select
'label_prototypes' as table_name,
id,
coalesce(payload->>'label', payload->>'name', source_file) as title,
concat_ws(' ', payload->>'expected_response', payload->>'explanation') as content,
embedding,
concat_ws(
' ',
payload->>'label',
payload->>'input_pattern',
payload->>'prompt_pattern',
payload->>'before_code',
payload->>'after_code',
payload->>'expected_response',
payload->>'explanation'
) as search_text,
search_tsv,
payload || jsonb_build_object('source_file', source_file) as metadata
from godot_rag.label_prototypes;在此视图上,Retriever 实际检索的值是 query_text。例如,如果是 _process 块,则如下检索。
query_text =
"Input.is_action_pressed Vector2.ZERO velocity.normalized position.clamp Vector2 AnimatedSprite2D _process Godot 3 Godot 4 migration"搜索结果不是可以直接信任并放入 LLM 的答案,而是候选依据。对 LLM 的判断请求,需要同时放入 chunk 和搜索候选,Qwen 3.6 会再次验证“该依据是否与当前 chunk 相关”。
传输调试标准
为了防止 AI 在 .gd 文件中随意只挑选“核心函数”发送,或相反将整个文件作为一次 LLM 请求发送,需要能够通过 diff 检查传输前后的差异。检查的对象不是“原始文件整体是否已发送至 LLM”,而是“原始文件中生成的函数/代码片段是否按原始顺序完整追踪,并且每个片段是否已传递给 Retriever 请求”。
在文件展开阶段,首先按路径创建原文块。
# player.gd
extends Area2D
signal hit
@export var speed = 400 # How fast the player will move (pixels/sec).
var screen_size # Size of the game window.
func _ready():
screen_size = get_viewport_rect().size
hide()
func _process(delta):
var velocity = Vector2.ZERO # The player's movement vector.
if Input.is_action_pressed(&"move_right"):
velocity.x += 1
if Input.is_action_pressed(&"move_left"):
velocity.x -= 1
if Input.is_action_pressed(&"move_down"):
velocity.y += 1
if Input.is_action_pressed(&"move_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite2D.play()
else:
$AnimatedSprite2D.stop()
position += velocity * delta
position = position.clamp(Vector2.ZERO, screen_size)
if velocity.x != 0:
$AnimatedSprite2D.animation = &"right"
$AnimatedSprite2D.flip_v = false
$Trail.rotation = 0
$AnimatedSprite2D.flip_h = velocity.x < 0
elif velocity.y != 0:
$AnimatedSprite2D.animation = &"up"
rotation = PI if velocity.y > 0 else 0
func start(pos):
position = pos
rotation = 0
show()
$CollisionShape2D.disabled = false
func _on_body_entered(_body):
hide() # Player disappears after being hit.
hit.emit()
# Must be deferred as we can't change physics properties on a physics callback.
$CollisionShape2D.set_deferred(&"disabled", true)然后留下 AST Parser 创建的片段列表。
ast_chunk_trace
source_file: "player.gd"
source_kind: "gdscript"
source_sha256: "87f4fcf7481dba031f74a363475cee75b81c3d42eb1347b318f6b824e37329a6"
chunks:
- chunk_order: 1
chunk_id: "player.gd:class_extends:1"
node_kind: "class_extends"
code_text: "extends Area2D"
- chunk_order: 2
chunk_id: "player.gd:signal:hit"
node_kind: "signal"
code_text: "signal hit"
- chunk_order: 3
chunk_id: "player.gd:function:_ready"
node_kind: "function"
code_text: |
func _ready():
screen_size = get_viewport_rect().size
hide()
- chunk_order: 4
chunk_id: "player.gd:function:_process"
node_kind: "function"
code_text: |
func _process(delta):
var velocity = Vector2.ZERO # The player's movement vector.
if Input.is_action_pressed(&"move_right"):
velocity.x += 1
if Input.is_action_pressed(&"move_left"):
velocity.x -= 1
if Input.is_action_pressed(&"move_down"):
velocity.y += 1
if Input.is_action_pressed(&"move_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite2D.play()
else:
$AnimatedSprite2D.stop()
position += velocity * delta
position = position.clamp(Vector2.ZERO, screen_size)
if velocity.x != 0:
$AnimatedSprite2D.animation = &"right"
$AnimatedSprite2D.flip_v = false
$Trail.rotation = 0
$AnimatedSprite2D.flip_h = velocity.x < 0
elif velocity.y != 0:
$AnimatedSprite2D.animation = &"up"
rotation = PI if velocity.y > 0 else 0
- chunk_order: 5
chunk_id: "player.gd:function:start"
node_kind: "function"
code_text: |
func start(pos):
position = pos
rotation = 0
show()
$CollisionShape2D.disabled = false
- chunk_order: 6
chunk_id: "player.gd:function:_on_body_entered"
node_kind: "function"
code_text: |
func _on_body_entered(_body):
hide() # Player disappears after being hit.
hit.emit()
# Must be deferred as we can't change physics properties on a physics callback.
$CollisionShape2D.set_deferred(&"disabled", true)Retriever 在发送前也会以块为单位保留 payload。
retrieval_payload
source_file: "player.gd"
chunk_order: 4
chunk_id: "player.gd:function:_process"
chunk_text: |
func _process(delta):
var velocity = Vector2.ZERO # The player's movement vector.
if Input.is_action_pressed(&"move_right"):
velocity.x += 1
if Input.is_action_pressed(&"move_left"):
velocity.x -= 1
if Input.is_action_pressed(&"move_down"):
velocity.y += 1
if Input.is_action_pressed(&"move_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite2D.play()
else:
$AnimatedSprite2D.stop()
position += velocity * delta
position = position.clamp(Vector2.ZERO, screen_size)
if velocity.x != 0:
$AnimatedSprite2D.animation = &"right"
$AnimatedSprite2D.flip_v = false
$Trail.rotation = 0
$AnimatedSprite2D.flip_h = velocity.x < 0
elif velocity.y != 0:
$AnimatedSprite2D.animation = &"up"
rotation = PI if velocity.y > 0 else 0验证规则:
expanded_source_block["player.gd"].sha256 == ast_chunk_trace.source_sha256
ast_chunk_trace.chunks[].chunk_order is strictly increasing
retrieval_payload.chunk_id exists in ast_chunk_trace.chunks[].chunk_id
retrieval_payload.chunk_order matches ast_chunk_trace.chunks[].chunk_order如果此验证失败,则不进行发送。此规则在 .gd 文件中尤为重要。其意图不是将整个 .gd 文件输入 LLM,而是确认从 .gd 中提取的函数/代码片段在不丢失原始路径和原始顺序的情况下能够传递到 Retriever。
当项目作为输入时,首先将其展开为人类可检查的纯文本块。下面的块按 # <relative/path> 单位显示除二进制资产外的文本文件的完整原文。这里也包括像 .md、LICENSE 这类在源码分析中会被排除的文件。文档示例中会保留相对路径内的全部内容,不做省略,以便确认追踪基准。但如果实现中应用了排除策略,被排除的文件将不会发送至 Retriever,而是连同原因一起标记在 excluded_files 中。
# .gitignore
.import
logs/
# LICENSE
MIT License
Copyright (c) 2017 KidsCanCode
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
# README.md
# Dodge the Creeps
This is a simple game where your character must move
and avoid the enemies for as long as possible.
This is a finished version of the game featured in the
["Your first 2D game"](https://docs.godotengine.org/en/latest/getting_started/first_2d_game/index.html)
tutorial in the documentation. For more details,
consider following the tutorial in the documentation.
Language: GDScript
Renderer: Compatibility
> [!NOTE]
>
> There is a C# version available [here](https://github.com/godotengine/godot-demo-projects/tree/master/mono/dodge_the_creeps).
Check out this demo on the asset library: https://godotengine.org/asset-library/asset/2712
## Screenshots


## Copying
`art/House In a Forest Loop.ogg` Copyright © 2012 [HorrorPen](https://opengameart.org/users/horrorpen), [CC-BY 3.0: Attribution](https://creativecommons.org/licenses/by/3.0/). Source: https://opengameart.org/content/loop-house-in-a-forest
Images are from "Abstract Platformer". Created in 2016 by kenney.nl, [CC0 1.0 Universal](https://creativecommons.org/publicdomain/zero/1.0/). Source: https://www.kenney.nl/assets/abstract-platformer
Font is "Xolonium". Copyright © 2011-2016 Severin Meyer <sev.ch@web.de>, with Reserved Font Name Xolonium, SIL open font license version 1.1. Details are in `fonts/LICENSE.txt`.
# art/House In a Forest Loop.ogg.import
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://sgfduhhw4pno"
path="res://.godot/imported/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggvorbisstr"
[deps]
source_file="res://art/House In a Forest Loop.ogg"
dest_files=["res://.godot/imported/House In a Forest Loop.ogg-1a6a72ae843ad792b7039931227e8d50.oggvorbisstr"]
[params]
loop=true
loop_offset=0.0
bpm=0.0
beat_count=0
bar_beats=4
# art/enemyFlyingAlt_1.png.import
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dun74wipekpfq"
path="res://.godot/imported/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/enemyFlyingAlt_1.png"
dest_files=["res://.godot/imported/enemyFlyingAlt_1.png-559f599b16c69b112c1b53f6332e9489.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
# art/enemyFlyingAlt_2.png.import
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://vusf51hepduk"
path="res://.godot/imported/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/enemyFlyingAlt_2.png"
dest_files=["res://.godot/imported/enemyFlyingAlt_2.png-31dc7310eda6e1b721224f3cd932c076.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
# art/enemySwimming_1.png.import
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d182mv7y80xqy"
path="res://.godot/imported/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/enemySwimming_1.png"
dest_files=["res://.godot/imported/enemySwimming_1.png-dd0e11759dc3d624c8a704f6e98a3d80.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
# art/enemySwimming_2.png.import
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dmgglhdyowipd"
path="res://.godot/imported/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/enemySwimming_2.png"
dest_files=["res://.godot/imported/enemySwimming_2.png-4c0cbc0732264c4ea3290340bd4a0a62.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
# art/enemyWalking_1.png.import
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dgwhuvn7qb4iy"
path="res://.godot/imported/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/enemyWalking_1.png"
dest_files=["res://.godot/imported/enemyWalking_1.png-5af6eedbe61b701677d490ffdc1e6471.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
# art/enemyWalking_2.png.import
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dyw702efe6meu"
path="res://.godot/imported/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/enemyWalking_2.png"
dest_files=["res://.godot/imported/enemyWalking_2.png-67c480ed60c35e95f5acb0436246b935.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
# art/gameover.wav.import
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://td2mgko63p61"
path="res://.godot/imported/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample"
[deps]
source_file="res://art/gameover.wav"
dest_files=["res://.godot/imported/gameover.wav-98c95c744b35280048c2bd093cf8a356.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=true
edit/normalize=true
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
# art/playerGrey_up1.png.import
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bcow5c46vixno"
path="res://.godot/imported/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/playerGrey_up1.png"
dest_files=["res://.godot/imported/playerGrey_up1.png-6bd114d0a6beac91f48e3a7314d44564.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
# art/playerGrey_up2.png.import
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dw3lwgwhpbfx8"
path="res://.godot/imported/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/playerGrey_up2.png"
dest_files=["res://.godot/imported/playerGrey_up2.png-d6aba85f5f2675ebc7045efa7552ee79.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
# art/playerGrey_walk1.png.import
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://b2aofu01vxvea"
path="res://.godot/imported/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/playerGrey_walk1.png"
dest_files=["res://.godot/imported/playerGrey_walk1.png-c4773fe7a7bf85d7ab732eb4458c2742.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
# art/playerGrey_walk2.png.import
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ddjou2q6gxlfr"
path="res://.godot/imported/playerGrey_walk2.png-34d2d916366100182d08037c51884043.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://art/playerGrey_walk2.png"
dest_files=["res://.godot/imported/playerGrey_walk2.png-34d2d916366100182d08037c51884043.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
# fonts/FONTLOG.txt
Please distribute this file along with the Xolonium fonts when possible.
Source
Find the sourcefiles of Xolonium at
<gitlab.com/sev/xolonium>
Credits
Xolonium is created with FontForge <fontforge.org>,
Inkscape <inkscape.org>, Python <python.org>, and
FontTools <github.com/fonttools>.
It originated as a custom font for the open-source
game Xonotic <xonotic.org>. With many thanks to the
Xonotic community for your support.
Supported OpenType features
case Provides case sensitive placement of punctuation,
brackets, and math symbols for uppercase text.
frac Replaces number/number sequences with diagonal fractions.
Numbers that touch a slash should not exceed 10 digits.
kern Provides kerning for Latin, Greek, and Cyrillic scripts.
locl Dutch: Replaces j with a stressed version if it follows í.
Sami: Replaces n-form Eng with the preferred N-form version.
Romanian and Moldovan: Replaces ŞşŢţ with the preferred ȘșȚț.
pnum Replaces monospaced digits with proportional versions.
sinf Replaces digits with scientific inferiors below the baseline.
subs Replaces digits with subscript versions on the baseline.
sups Replaces digits with superscript versions.
zero Replaces zero with a slashed version.
Supported glyph sets
Adobe Latin 3
OpenType W1G
ISO 8859-1 Western European
ISO 8859-2 Central European
ISO 8859-3 South European
ISO 8859-4 North European
ISO 8859-5 Cyrillic
ISO 8859-7 Greek
ISO 8859-9 Turkish
ISO 8859-10 Nordic
ISO 8859-13 Baltic Rim
ISO 8859-14 Celtic
ISO 8859-15 Western European
ISO 8859-16 South-Eastern European
Available glyphs
!"#$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
`abcdefghijklmnopqrstuvwxyz{|}~
¡¢£¤¥¦§¨©ª«¬ ®¯°±²³´µ¶·¸¹º»¼½¾¿
ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß
àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
ĀāĂ㥹ĆćĈĉĊċČčĎďĐđĒēĔĕĖėĘęĚěĜĝĞğ
ĠġĢģĤĥĦħĨĩĪīĬĭĮįİıIJijĴĵĶķĸĹĺĻļĽľ
ĿŀŁłŃńŅņŇňŊŋŌōŎŏŐőŒœŔŕŖŗŘřŚśŜŝŞş
ŠšŢţŤťŦŧŨũŪūŬŭŮůŰűŲųŴŵŶŷŸŹźŻżŽž
ƒǺǻǼǽǾǿȘșȚțȷ
ˆˇˉ˘˙˚˛˜˝
ͺ;΄΅Ά·ΈΉΊΌΎΏΐ
ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩΪΫάέήίΰ
αβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ
ЀЁЂЃЄЅІЇЈЉЊЋЌЍЎЏАБВГДЕЖЗИЙКЛМНОП
РСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп
рстуфхцчшщъыьэюяѐёђѓєѕіїјљњћќѝўџ
ѢѣѲѳѴѵҐґҒғҔҕҖҗҘҙҚқҜҝҞҟҠҡҢңҤҥҦҧҨҩ
ҪҫҬҭҮүҰұҲҳҴҵҶҷҸҹҺһҼҽӀӁӂӇӈӋӌӏӐӑӒӓ
ӔӕӖӗӘәӜӝӞӟӠӡӢӣӤӥӦӧӨөӮӯӰӱӲӳӴӵӶӷӸӹ
Ԥԥ
ḂḃḊḋḞḟṀṁṖṗṠṡṪṫẀẁẂẃẄẅẞỲỳ
‒–—―‘’‚‛“”„‟†‡•…‰′″‹›‽‾⁄
⁰⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ⁿ₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎
₤₦₩₫€₯₱₹₺₽₿
℅ℓ№℗™Ω℮
⅛⅜⅝⅞
←↑→↓
∂∆∏∑−∕∙√∞∟∫≈≠≤≥
⌖
■▬▮▰▲▶▼◀◆◊●◢◣◤◥
☄★☠☢☣⚙⚛⚠⚡⛔
❇❈❌❤❰❱❲❳
fffiflffiffl
🌌🌍🌎🌏👽💣🔥🔫
😁😃😄😆😇😈😉😊😎😐😒😕😘
😛😝😞😟😠😣😭😮😲😴😵
🚀
Debugging glyphs
U+EFFD Font version
U+F000 Font hinting indicator
Changelog
Xolonium 4.1 2016-11-22 Severin Meyer <sev.ch@web.de>
Reverted frac OpenType feature to a more stable implementation
Xolonium 4.0 2016-10-08 Severin Meyer <sev.ch@web.de>
Decreased width of most glyphs
Thinner vertical stems in Xolonium-Regular
Thicker horizontal stems in Xolonium-Bold
Revised diagonal stems
Lowered middle bars
Revised diacritical bars
Added glyphs:
ӏẞ₿
U+2007 U+2008 U+2009 U+200A U+202F
U+EFFD U+F000
Revised glyphs:
$&,JKQRXkwxy~¢¤ßǻ˜ζκλμξφЖУжћѴѵ∕₱₺₦₩€ℓ№≈ffffiffl
❤🌍🌎🌏😁😄😇😈😉😊😘😭😮😴🚀
Removed uncommon glyphs:
ʼnſʼҌҍҎҏҾҿӃӄӇӈӚӛӪӫӬӭ
U+0312 U+0313 U+0326
Simplified OpenType features pnum, zero, and case
Removed OpenType feature dlig
Revised vertical metrics
Merged outlines of composite glyphs in otf version
Added ttf version with custom outlines and instructions
Added woff and woff2 version
Xolonium 3.1 2015-06-10 Severin Meyer <sev.ch@web.de>
Added currency glyphs:
₦₩₫₱₹₺₽
Revised glyph:
₯
Relicensed public release under the SIL Open Font License 1.1
Xolonium 3.0 2015-05-04 Severin Meyer <sev.ch@web.de>
Decreased width of glyphs
Decreased descender height
Increased height of super/subscript glyphs
Revised width of dashes, underscore, and overscore
Sharper bends with more circular proportions
Decreased stroke thickness of mathematical glyphs
Revised diacritical marks
Revised diacritical bars
Revised Cyrillic hooks
Revised glyphs:
GQRYjmuwßŊŒſƒǻfffiffiffl
ΞΨΩδζιξπςστυφω
ЉЄДЛУЭЯбдлэяєљђєћѢѣҨҩҼҽӃӄӘә
#$&'()*,/69?@[]{}~¡£¤¥§©®¿
‹›₤€₯ℓ№℗℮←↑→↓∂∏∑∞≈▰☄❈❰❱❲❳😝
Raised vertical position of mathematical glyphs
Unified advance width of numeral and monetary glyphs
Unified advance width of mathematical glyphs
Revised bearings
Rewrote kern feature
Bolder Xolonium-Bold with improved proportions
Updated glyph names to conform to the AGLFN 1.7
Revised hints and PS Private Dictionary
Added glyphs:
ӶӷԤԥ
Added OpenType features:
case frac liga locl pnum sinf subs sups zero
Xolonium 2.4 2014-12-23 Severin Meyer <sev.ch@web.de>
Added dingbats:
⛔💣🔥
Revised size and design of emoticons
Revised dingbats:
⌖☄☠☣⚙⚛⚠⚡❇❈🌌🌍🌎🌏🔫
Removed dingbat:
💥
Xolonium 2.3 2014-08-14 Severin Meyer <sev.ch@web.de>
Bugfixed ε and έ, thanks to bowzee for the feedback
Xolonium 2.2 2014-03-01 Severin Meyer <sev.ch@web.de>
Added dingbats:
⌖◆●❌💥
Revised dingbats:
•←↑→↓◊☄★☠☣⚙⚛⚠⚡❇❈❤🌌🌍🌎🌏👽🔫🚀
Removed dingbats:
♻✪💡📡🔋🔧🔭
Xolonium 2.1 2013-10-20 Severin Meyer <sev.ch@web.de>
Added dingbats:
←↑→↓❰❱❲❳■▬▮▰▲▶▼◀◢◣◤◥
☄★☠☢☣♻⚙⚛⚠⚡✪❇❈❤
🌌🌍🌎🌏👽💡📡🔋🔧🔫🔭🚀
😁😃😄😆😇😈😉😊😎😐😒😕
😘😛😝😞😟😠😣😭😮😲😴😵
Xolonium 2.0.1 2013-07-12 Severin Meyer <sev.ch@web.de>
Reorganised and simplified files
Xolonium 2.0 2012-08-11 Severin Meyer <sev.ch@web.de>
Revised bends
Revised thickness of uppercase diagonal stems
Revised diacritical marks
Revised hints and PS Private Dictionary
Revised glyphs:
*1469@DPRly{}§©®¶ÐÞƒΘΞαεζνξνυЄЉЊ
ЏБЗЛУЧЪЫЬЭЯбзлчъыьэяєљњџ•€∂∙√∞∫≠
Completed glyph sets:
Adobe Latin 3
OpenType World Glyph Set 1 (W1G)
Ghostscript Standard (ghostscript-fonts-std-8.11)
Added OpenType kern feature
Added Xolonium-Bold
Xolonium 1.2 2011-02-12 Severin Meyer <sev.ch@web.de>
Revised glyphs:
D·Ðı
Completed glyph sets:
ISO 8859-7 (Greek)
Unicode Latin Extended-A block
Added glyphs:
†‡•…‰⁄™∂∑−√∞≠≤≥
Xolonium 1.1 2011-01-17 Severin Meyer <sev.ch@web.de>
Revised placement of cedilla and ogonek in accented glyphs
Revised glyphs:
,;DKTjkvwxy¥§Ð˛€
Completed glyph sets:
ISO 8859-2 (Central European)
ISO 8859-3 (South European, Esperanto)
ISO 8859-4 (North European)
ISO 8859-5 (Cyrillic)
ISO 8859-9 (Turkish)
ISO 8859-10 (Nordic)
ISO 8859-13 (Baltic Rim)
ISO 8859-14 (Celtic)
ISO 8859-16 (South-Eastern European)
Added glyphs:
ȷʼ̒ ЀЍѐѝ‒–—‘’‚‛“”„‟‹›
Xolonium 1.0 2011-01-04 Severin Meyer <sev.ch@web.de>
Completed glyph sets:
ISO 8859-1 (Western European)
ISO 8859-15 (Western European)
Added glyphs:
ĄĆĘŁŃŚŹŻąćęłńśźżıˆˇ˙˚˛˜
# fonts/LICENSE.txt
Copyright 2011-2016 Severin Meyer <sev.ch@web.de>,
with Reserved Font Name Xolonium.
This Font Software is licensed under the SIL Open Font License,
Version 1.1. This license is copied below, and is also available
with a FAQ at <http://scripts.sil.org/OFL>
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
# fonts/Xolonium-Regular.ttf.import
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bgv586r20ps8e"
path="res://.godot/imported/Xolonium-Regular.ttf-bc2981e3069cff4c34dd7c8e2bb73fba.fontdata"
[deps]
source_file="res://fonts/Xolonium-Regular.ttf"
dest_files=["res://.godot/imported/Xolonium-Regular.ttf-bc2981e3069cff4c34dd7c8e2bb73fba.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
modulate_color_glyphs=false
hinting=1
subpixel_positioning=4
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}
# hud.gd
extends CanvasLayer
signal start_game
func show_message(text):
$MessageLabel.text = text
$MessageLabel.show()
$MessageTimer.start()
func show_game_over():
show_message("Game Over")
await $MessageTimer.timeout
$MessageLabel.text = "Dodge the\nCreeps"
$MessageLabel.show()
await get_tree().create_timer(1).timeout
$StartButton.show()
func update_score(score):
$ScoreLabel.text = str(score)
func _on_StartButton_pressed():
$StartButton.hide()
start_game.emit()
func _on_MessageTimer_timeout():
$MessageLabel.hide()
# hud.gd.uid
uid://c1g57034r2c0
# hud.tscn
[gd_scene format=3 uid="uid://b0efehuavobda"]
[ext_resource type="Script" uid="uid://c1g57034r2c0" path="res://hud.gd" id="1"]
[ext_resource type="FontFile" uid="uid://bgv586r20ps8e" path="res://fonts/Xolonium-Regular.ttf" id="2_2jm3i"]
[sub_resource type="InputEventAction" id="InputEventAction_fopy7"]
action = &"start_game"
[sub_resource type="Shortcut" id="4"]
events = [SubResource("InputEventAction_fopy7")]
[node name="HUD" type="CanvasLayer" unique_id=126421993]
script = ExtResource("1")
[node name="ScoreLabel" type="Label" parent="." unique_id=1314826100]
anchors_preset = 10
anchor_right = 1.0
offset_bottom = 78.0
grow_horizontal = 2
theme_override_fonts/font = ExtResource("2_2jm3i")
theme_override_font_sizes/font_size = 60
text = "0"
horizontal_alignment = 1
[node name="MessageLabel" type="Label" parent="." unique_id=1611528703]
anchors_preset = 14
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_top = -79.5
offset_bottom = 79.5
grow_horizontal = 2
grow_vertical = 2
theme_override_fonts/font = ExtResource("2_2jm3i")
theme_override_font_sizes/font_size = 60
text = "Dodge the
Creeps"
horizontal_alignment = 1
[node name="StartButton" type="Button" parent="." unique_id=1561548516]
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -90.0
offset_top = -200.0
offset_right = 90.0
offset_bottom = -100.0
grow_horizontal = 2
grow_vertical = 0
theme_override_fonts/font = ExtResource("2_2jm3i")
theme_override_font_sizes/font_size = 60
shortcut = SubResource("4")
text = "Start"
[node name="MessageTimer" type="Timer" parent="." unique_id=1675980570]
one_shot = true
[connection signal="pressed" from="StartButton" to="." method="_on_StartButton_pressed"]
[connection signal="timeout" from="MessageTimer" to="." method="_on_MessageTimer_timeout"]
# icon.webp.import
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dfklrdtaun0xt"
path="res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://icon.webp"
dest_files=["res://.godot/imported/icon.webp-e94f9a68b0f625a567a797079e4d325f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
# main.gd
extends Node
@export var mob_scene: PackedScene
var score
func game_over():
$ScoreTimer.stop()
$MobTimer.stop()
$HUD.show_game_over()
$Music.stop()
$DeathSound.play()
func new_game():
get_tree().call_group(&"mobs", &"queue_free")
score = 0
$Player.start($StartPosition.position)
$StartTimer.start()
$HUD.update_score(score)
$HUD.show_message("Get Ready")
$Music.play()
func _on_MobTimer_timeout():
# Create a new instance of the Mob scene.
var mob = mob_scene.instantiate()
# Choose a random location on Path2D.
var mob_spawn_location = get_node(^"MobPath/MobSpawnLocation")
mob_spawn_location.progress_ratio = randf()
# Set the mob's position to a random location.
mob.position = mob_spawn_location.position
# Set the mob's direction perpendicular to the path direction.
var direction = mob_spawn_location.rotation + PI / 2
# Add some randomness to the direction.
direction += randf_range(-PI / 4, PI / 4)
mob.rotation = direction
# Choose the velocity for the mob.
var velocity = Vector2(randf_range(150.0, 250.0), 0.0)
mob.linear_velocity = velocity.rotated(direction)
# Spawn the mob by adding it to the Main scene.
add_child(mob)
func _on_ScoreTimer_timeout():
score += 1
$HUD.update_score(score)
func _on_StartTimer_timeout():
$MobTimer.start()
$ScoreTimer.start()
# main.gd.uid
uid://c4wt6ace7hycd
# main.tscn
[gd_scene format=3 uid="uid://bggkaprn62fwm"]
[ext_resource type="Script" uid="uid://c4wt6ace7hycd" path="res://main.gd" id="1_0r6n5"]
[ext_resource type="PackedScene" uid="uid://cao351pllxqpa" path="res://mob.tscn" id="2_50pww"]
[ext_resource type="PackedScene" uid="uid://bwhlkliwp13p4" path="res://player.tscn" id="3_veqnc"]
[ext_resource type="PackedScene" uid="uid://b0efehuavobda" path="res://hud.tscn" id="4_0qnje"]
[ext_resource type="AudioStream" uid="uid://sgfduhhw4pno" path="res://art/House In a Forest Loop.ogg" id="5_55d8h"]
[ext_resource type="AudioStream" uid="uid://td2mgko63p61" path="res://art/gameover.wav" id="6_hp1r0"]
[sub_resource type="Curve2D" id="1"]
_data = {
"points": PackedVector2Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, 0, 0, 0, 0, 0, 480, 720, 0, 0, 0, 0, 0, 720, 0, 0, 0, 0, 0, 0)
}
point_count = 5
[node name="Main" type="Node" unique_id=1975992027]
script = ExtResource("1_0r6n5")
mob_scene = ExtResource("2_50pww")
[node name="ColorRect" type="ColorRect" parent="." unique_id=569320965]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
color = Color(0.219608, 0.372549, 0.380392, 1)
[node name="Player" parent="." unique_id=927660131 instance=ExtResource("3_veqnc")]
[node name="MobTimer" type="Timer" parent="." unique_id=228987391]
wait_time = 0.5
[node name="ScoreTimer" type="Timer" parent="." unique_id=451982858]
[node name="StartTimer" type="Timer" parent="." unique_id=238316384]
wait_time = 2.0
one_shot = true
[node name="StartPosition" type="Marker2D" parent="." unique_id=568887530]
position = Vector2(240, 450)
[node name="MobPath" type="Path2D" parent="." unique_id=694323229]
curve = SubResource("1")
[node name="MobSpawnLocation" type="PathFollow2D" parent="MobPath" unique_id=1080274542]
[node name="HUD" parent="." unique_id=1879130737 instance=ExtResource("4_0qnje")]
[node name="Music" type="AudioStreamPlayer" parent="." unique_id=267371681]
stream = ExtResource("5_55d8h")
[node name="DeathSound" type="AudioStreamPlayer" parent="." unique_id=1715684712]
stream = ExtResource("6_hp1r0")
[connection signal="hit" from="Player" to="." method="game_over"]
[connection signal="timeout" from="MobTimer" to="." method="_on_MobTimer_timeout"]
[connection signal="timeout" from="ScoreTimer" to="." method="_on_ScoreTimer_timeout"]
[connection signal="timeout" from="StartTimer" to="." method="_on_StartTimer_timeout"]
[connection signal="start_game" from="HUD" to="." method="new_game"]
# mob.gd
extends RigidBody2D
func _ready():
var mob_types = Array($AnimatedSprite2D.sprite_frames.get_animation_names())
$AnimatedSprite2D.animation = mob_types.pick_random()
$AnimatedSprite2D.play()
func _on_VisibilityNotifier2D_screen_exited():
queue_free()
# mob.gd.uid
uid://cypxpb8arjrqt
# mob.tscn
[gd_scene format=3 uid="uid://cao351pllxqpa"]
[ext_resource type="Script" uid="uid://cypxpb8arjrqt" path="res://mob.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://dun74wipekpfq" path="res://art/enemyFlyingAlt_1.png" id="2"]
[ext_resource type="Texture2D" uid="uid://vusf51hepduk" path="res://art/enemyFlyingAlt_2.png" id="3"]
[ext_resource type="Texture2D" uid="uid://dgwhuvn7qb4iy" path="res://art/enemyWalking_1.png" id="4"]
[ext_resource type="Texture2D" uid="uid://dyw702efe6meu" path="res://art/enemyWalking_2.png" id="5"]
[ext_resource type="Texture2D" uid="uid://d182mv7y80xqy" path="res://art/enemySwimming_1.png" id="6"]
[ext_resource type="Texture2D" uid="uid://dmgglhdyowipd" path="res://art/enemySwimming_2.png" id="7"]
[sub_resource type="SpriteFrames" id="1"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2")
}, {
"duration": 1.0,
"texture": ExtResource("3")
}],
"loop": true,
"name": &"fly",
"speed": 3.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("6")
}, {
"duration": 1.0,
"texture": ExtResource("7")
}],
"loop": true,
"name": &"swim",
"speed": 4.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("4")
}, {
"duration": 1.0,
"texture": ExtResource("5")
}],
"loop": true,
"name": &"walk",
"speed": 4.0
}]
[sub_resource type="CapsuleShape2D" id="2"]
radius = 37.0
height = 100.0
[node name="Mob" type="RigidBody2D" unique_id=371809901 groups=["mobs"]]
collision_mask = 0
gravity_scale = 0.0
script = ExtResource("1")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1998522389]
scale = Vector2(0.75, 0.75)
sprite_frames = SubResource("1")
animation = &"walk"
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1880423722]
rotation = 1.5708
shape = SubResource("2")
[node name="VisibleOnScreenNotifier2D" type="VisibleOnScreenNotifier2D" parent="." unique_id=959995349]
[connection signal="screen_exited" from="VisibleOnScreenNotifier2D" to="." method="_on_VisibilityNotifier2D_screen_exited"]
# player.gd
extends Area2D
signal hit
@export var speed = 400 # How fast the player will move (pixels/sec).
var screen_size # Size of the game window.
func _ready():
screen_size = get_viewport_rect().size
hide()
func _process(delta):
var velocity = Vector2.ZERO # The player's movement vector.
if Input.is_action_pressed(&"move_right"):
velocity.x += 1
if Input.is_action_pressed(&"move_left"):
velocity.x -= 1
if Input.is_action_pressed(&"move_down"):
velocity.y += 1
if Input.is_action_pressed(&"move_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite2D.play()
else:
$AnimatedSprite2D.stop()
position += velocity * delta
position = position.clamp(Vector2.ZERO, screen_size)
if velocity.x != 0:
$AnimatedSprite2D.animation = &"right"
$AnimatedSprite2D.flip_v = false
$Trail.rotation = 0
$AnimatedSprite2D.flip_h = velocity.x < 0
elif velocity.y != 0:
$AnimatedSprite2D.animation = &"up"
rotation = PI if velocity.y > 0 else 0
func start(pos):
position = pos
rotation = 0
show()
$CollisionShape2D.disabled = false
func _on_body_entered(_body):
hide() # Player disappears after being hit.
hit.emit()
# Must be deferred as we can't change physics properties on a physics callback.
$CollisionShape2D.set_deferred(&"disabled", true)
# player.gd.uid
uid://6s0lxctks3qn
# player.tscn
[gd_scene format=3 uid="uid://bwhlkliwp13p4"]
[ext_resource type="Script" uid="uid://6s0lxctks3qn" path="res://player.gd" id="1"]
[ext_resource type="Texture2D" uid="uid://b2aofu01vxvea" path="res://art/playerGrey_walk1.png" id="2"]
[ext_resource type="Texture2D" uid="uid://ddjou2q6gxlfr" path="res://art/playerGrey_walk2.png" id="3"]
[ext_resource type="Texture2D" uid="uid://bcow5c46vixno" path="res://art/playerGrey_up1.png" id="4"]
[ext_resource type="Texture2D" uid="uid://dw3lwgwhpbfx8" path="res://art/playerGrey_up2.png" id="5"]
[sub_resource type="SpriteFrames" id="1"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": ExtResource("2")
}, {
"duration": 1.0,
"texture": ExtResource("3")
}],
"loop": true,
"name": &"right",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": ExtResource("4")
}, {
"duration": 1.0,
"texture": ExtResource("5")
}],
"loop": true,
"name": &"up",
"speed": 5.0
}]
[sub_resource type="CapsuleShape2D" id="2"]
radius = 27.0
height = 68.0
[sub_resource type="Gradient" id="3"]
colors = PackedColorArray(1, 1, 1, 0.501961, 1, 1, 1, 0)
[sub_resource type="GradientTexture1D" id="4"]
gradient = SubResource("3")
[sub_resource type="Curve" id="5"]
_data = [Vector2(0.00501098, 0.5), 0.0, 0.0, 0, 0, Vector2(0.994989, 0.324), 0.0, 0.0, 0, 0]
point_count = 2
[sub_resource type="CurveTexture" id="6"]
curve = SubResource("5")
[sub_resource type="ParticleProcessMaterial" id="7"]
gravity = Vector3(0, 0, 0)
scale_curve = SubResource("6")
color_ramp = SubResource("4")
[node name="Player" type="Area2D" unique_id=2141725708]
z_index = 10
script = ExtResource("1")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=1437394421]
scale = Vector2(0.5, 0.5)
sprite_frames = SubResource("1")
animation = &"right"
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1954506745]
shape = SubResource("2")
[node name="Trail" type="GPUParticles2D" parent="." unique_id=1747300857]
z_index = -1
amount = 10
texture = ExtResource("2")
speed_scale = 2.0
process_material = SubResource("7")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
# project.godot
; Engine configuration file.
; It's best edited using the editor UI and not directly,
; since the parameters that go here are not all obvious.
;
; Format:
; [section] ; section goes between []
; param=value ; assign values to parameters
config_version=5
[application]
config/name="Dodge the Creeps"
config/description="This is a simple game where your character must move
and avoid the enemies for as long as possible.
This is a finished version of the game featured in the 'Your first 2D game'
tutorial in the documentation. For more details, consider
following the tutorial in the documentation."
config/tags=PackedStringArray("2d", "demo", "official")
run/main_scene="res://main.tscn"
config/features=PackedStringArray("4.6")
config/icon="res://icon.webp"
[display]
window/size/viewport_width=480
window/size/viewport_height=720
window/size/window_width_override=480
window/size/window_height_override=720
window/stretch/mode="canvas_items"
[input]
move_left={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":14,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":-1.0,"script":null)
]
}
move_right={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":15,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":0,"axis_value":1.0,"script":null)
]
}
move_up={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":87,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194320,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":12,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":-1.0,"script":null)
]
}
move_down={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":0,"button_index":13,"pressure":0.0,"pressed":false,"script":null)
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":0,"axis":1,"axis_value":1.0,"script":null)
]
}
start_game={
"deadzone": 0.2,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194309,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
]
}
[rendering]
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
# screenshots/.gdignore
二进制资产不会在原始字节的明文正文中放入,但必须保留在 repository path order 和排除/引用列表中。例如 main.tscn 指向 res://art/gameover.wav,则在 LLM 判断输入中,来自 main.tscn 的块、art/gameover.wav 被引用的路径元数据、Retriever 检索结果、用户提示都会放在同一个请求对象里。二进制原始字节本身不会发送给 Retriever 或 LLM。
文件单位传递示例
从明文块中摘取 # player.gd 块后,会得到如下的一个 analysis_request。
extends Area2D
signal hit
@export var speed = 400 # How fast the player will move (pixels/sec).
var screen_size # Size of the game window.
func _ready():
screen_size = get_viewport_rect().size
hide()
func _process(delta):
var velocity = Vector2.ZERO # The player's movement vector.
if Input.is_action_pressed(&"move_right"):
velocity.x += 1
if Input.is_action_pressed(&"move_left"):
velocity.x -= 1
if Input.is_action_pressed(&"move_down"):
velocity.y += 1
if Input.is_action_pressed(&"move_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite2D.play()
else:
$AnimatedSprite2D.stop()
position += velocity * delta
position = position.clamp(Vector2.ZERO, screen_size)
if velocity.x != 0:
$AnimatedSprite2D.animation = &"right"
$AnimatedSprite2D.flip_v = false
$Trail.rotation = 0
$AnimatedSprite2D.flip_h = velocity.x < 0
elif velocity.y != 0:
$AnimatedSprite2D.animation = &"up"
rotation = PI if velocity.y > 0 else 0
func start(pos):
position = pos
rotation = 0
show()
$CollisionShape2D.disabled = false
func _on_body_entered(_body):
hide() # Player disappears after being hit.
hit.emit()
# Must be deferred as we can't change physics properties on a physics callback.
$CollisionShape2D.set_deferred(&"disabled", true)AST Parser 只传递需要进行源代码分析的字段,而不是整个请求。
ast_parse_input
project_id: "github:godotengine/godot-demo-projects/2d/dodge_the_creeps"
source_file: "player.gd"
source_kind: "gdscript"
source_text: |
extends Area2D
signal hit
@export var speed = 400 # How fast the player will move (pixels/sec).
var screen_size # Size of the game window.
func _ready():
screen_size = get_viewport_rect().size
hide()
func _process(delta):
var velocity = Vector2.ZERO # The player's movement vector.
if Input.is_action_pressed(&"move_right"):
velocity.x += 1
if Input.is_action_pressed(&"move_left"):
velocity.x -= 1
if Input.is_action_pressed(&"move_down"):
velocity.y += 1
if Input.is_action_pressed(&"move_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite2D.play()
else:
$AnimatedSprite2D.stop()
position += velocity * delta
position = position.clamp(Vector2.ZERO, screen_size)
if velocity.x != 0:
$AnimatedSprite2D.animation = &"right"
$AnimatedSprite2D.flip_v = false
$Trail.rotation = 0
$AnimatedSprite2D.flip_h = velocity.x < 0
elif velocity.y != 0:
$AnimatedSprite2D.animation = &"up"
rotation = PI if velocity.y > 0 else 0
func start(pos):
position = pos
rotation = 0
show()
$CollisionShape2D.disabled = false
func _on_body_entered(_body):
hide() # Player disappears after being hit.
hit.emit()
# Must be deferred as we can't change physics properties on a physics callback.
$CollisionShape2D.set_deferred(&"disabled", true)
source_sha256: "87f4fcf7481dba031f74a363475cee75b81c3d42eb1347b318f6b824e37329a6"Parser 将文件划分为片段。在实际实现确定之前,期待下一级的片段。
ast_parse_output
source_file: "player.gd"
chunks:
- node_kind: "class_extends"
code_text: "extends Area2D"
symbol_candidates: ["Area2D"]
- node_kind: "signal"
code_text: "signal hit"
symbol_candidates: ["hit"]
- node_kind: "export_variable"
code_text: "@export var speed = 400"
symbol_candidates: ["@export", "speed"]
- node_kind: "function"
code_text: |
func _process(delta):
var velocity = Vector2.ZERO # The player's movement vector.
if Input.is_action_pressed(&"move_right"):
velocity.x += 1
if Input.is_action_pressed(&"move_left"):
velocity.x -= 1
if Input.is_action_pressed(&"move_down"):
velocity.y += 1
if Input.is_action_pressed(&"move_up"):
velocity.y -= 1
if velocity.length() > 0:
velocity = velocity.normalized() * speed
$AnimatedSprite2D.play()
else:
$AnimatedSprite2D.stop()
position += velocity * delta
position = position.clamp(Vector2.ZERO, screen_size)
if velocity.x != 0:
$AnimatedSprite2D.animation = &"right"
$AnimatedSprite2D.flip_v = false
$Trail.rotation = 0
$AnimatedSprite2D.flip_h = velocity.x < 0
elif velocity.y != 0:
$AnimatedSprite2D.animation = &"up"
rotation = PI if velocity.y > 0 else 0
api_call_candidates: ["Input.is_action_pressed", "Vector2.ZERO", "position.clamp"]
- node_kind: "function"
code_text: |
func _on_body_entered(_body):
hide() # Player disappears after being hit.
hit.emit()
# Must be deferred as we can't change physics properties on a physics callback.
$CollisionShape2D.set_deferred(&"disabled", true)
api_call_candidates: ["hit.emit", "set_deferred"]每个块都会再次转到 Retriever 请求。
retrieval_request
project_id: "github:godotengine/godot-demo-projects/2d/dodge_the_creeps"
source_file: "player.gd"
chunk_id: "player.gd:function:_process"
prompt_intent: "version_check_and_explain"
query_terms:
- "Input.is_action_pressed"
- "Vector2.ZERO"
- "position.clamp"
- "@export"
candidate_tables:
- "docs_chunks"
- "api_mapping"
- "label_prototypes"此流程并非 player.gd 独有的特殊处理。只是根据文件类型,片段生成阶段不同。main.gd、mob.gd、hud.gd 会循环执行 analysis_request -> ast_parse_input -> ast_parse_output.chunks[] -> retrieval_request。而像 project.godot、main.tscn 这类不是 AST Parser 目标的文件,则循环执行 analysis_request -> direct_chunk_output.chunks[] -> retrieval_request。
在此示例项目中需要确认的重复发送流程如下。
- 将项目根目录视为一个
project_id。 - 按相对路径收集与 Godot 相关的文本文件。
- 将每个文件展开为带有
# <relative/path>标题的纯文本块。 - 将每个纯文本块再次构造成文件级别的
analysis_request。 - 在每个
analysis_request中计算source_sha256。 .gd文件由 AST Parser 生成ast_parse_output.chunks[]。- 非 AST Parser 目标的包含文件由直接分块器生成
direct_chunk_output.chunks[]。 - 基于每个 chunk 创建 Retriever 请求。
- 将 Retriever 结果与 chunk 组合,重复进行 LLM 判定请求。
- 所有必要的文件/chunk 请求均得到正常响应后,方可将其作为项目级别的判定候选。
也就是说,一个项目会被拆分为如上多个请求。
dodge_the_creeps/project.godot
-> analysis_request
-> direct_chunk_output.chunks[]
-> retrieval_request per chunk
dodge_the_creeps/main.gd
-> analysis_request
-> ast_parse_output.chunks[]
-> retrieval_request per chunk
dodge_the_creeps/player.gd
-> analysis_request
-> ast_parse_output.chunks[]
-> retrieval_request per chunk
dodge_the_creeps/player.tscn
-> analysis_request
-> direct_chunk_output.chunks[]
-> retrieval_request per chunk
dodge_the_creeps/mob.gd
-> analysis_request
-> ast_parse_output.chunks[]
-> retrieval_request per chunk
dodge_the_creeps/mob.tscn
-> analysis_request
-> direct_chunk_output.chunks[]
-> retrieval_request per chunk
dodge_the_creeps/hud.gd
-> analysis_request
-> ast_parse_output.chunks[]
-> retrieval_request per chunk
dodge_the_creeps/hud.tscn
-> analysis_request
-> direct_chunk_output.chunks[]
-> retrieval_request per chunk此时,即使某个文件或某个块失败,也不会立即确定整个项目。失败的请求会保留为 pending 或 retry 对象,仅累计正常响应的块。项目级别的判断仅在必要的重复请求得到充分响应之后才进行。
重复请求流程
一个项目不会仅凭一次 LLM 请求就作出判定。
项目输入会像下面这样分成多个请求。
project
-> file requests
-> AST chunks or direct chunks
-> retrieval requests
-> LLM judgment requests
-> project-level aggregation各阶段的重复单元如下。
| 阶段 | 重复单元 |
|---|---|
| 文件扫描 | 项目内的文件 |
| AST Parser | 包含的 .gd 文件 |
| 直接碎片化 | 非 AST Parser 目标的包含文件 |
| 排除记录 | .md、二进制等排除目标文件 |
| Retriever | AST chunk 或 direct chunk |
| Qwen 3.6 判断 | AST/direct chunk + 检索依据 |
| 项目分类 | chunk 判断结果整体 |
因此,一个项目并不是以真/假结束,而是项目内的多个文件和多个碎片必须分别正常处理。最终的项目判断只能在所有必要碎片的 Retriever/LLM/Validator 结果汇总后进行。
Qwen 3.6 是按需运行的前提,所以比起一次性的大请求,更适合以 AST chunk 或 direct chunk 为单位多次调用。此时已完成的 chunk 可以复用,只有失败或中断的 chunk 需要重新请求。
传递给 AST Parser 的数据
AST Parser 不直接放入提示。
Parser 的输入应尽可能简化,如下所示。
ast_parse_input
project_id
source_file
source_kind
source_text
source_sha256这样分离的原因如下。
- 可以用相同的源代码在多个提示中重新分析。
- 即使提示更改,AST 解析结果也可以复用。
- 防止 Parser 因“提问意图”而对源结构作出不同的解释。
- 仅在后续的 Retriever/LLM 阶段使用提示来改变判断方向。
AST Parser 输出
Parser 会比直接将整个源代码交给 LLM,更先生成可追踪的片段列表。
ast_parse_output
project_id
source_file
source_sha256
parse_status
chunks[]每个块具有以下信息。
chunk
chunk_id
source_file
span
node_kind
symbol_candidates
api_call_candidates
code_text
surrounding_context| 项目 | 说明 |
|---|---|
chunk_id |
基于项目/文件/范围的确定性 ID |
span |
行/列或字节偏移范围 |
node_kind |
function、class、call、signal、property、scene_node 等 |
symbol_candidates |
类名、类型名、方法名候选 |
api_call_candidates |
Godot API 调用候选 |
code_text |
该片段的原始代码 |
surrounding_context |
判断所需的周边代码。不是整个文件,只保留必要范围。 |
直接片段化输出
不是 AST Parser 目标的包含文件会生成 direct_chunk_output。此输出不是 AST,而是按原始顺序划分的文本/设置/scene 结构结果。
direct_chunk_output
project_id
source_file
source_sha256
chunk_status
chunks[]每个块具有以下信息。
direct_chunk
chunk_id
source_file
chunk_order
span
chunk_kind
chunk_text
reference_candidates例:
direct_chunk
source_file: "main.tscn"
chunk_order: 3
chunk_kind: "ext_resource"
chunk_text: "[ext_resource type=\"Script\" uid=\"uid://c4wt6ace7hycd\" path=\"res://main.gd\" id=\"1_0r6n5\"]"
reference_candidates:
- "res://main.gd".md类似的被排除的文件不创建 direct_chunk_output,而是保留在 excluded_files 中。
提示与片段合并
提示在 Parser 之后再次合并。
analysis_request.prompt
+ ast chunk 或 direct chunk
+ project/file metadata
-> retrieval_request示例:
| 提示意图 | 首选检索器 |
|---|---|
| “这段代码是什么意思?” | docs_chunks |
| “需要转换为 Godot 4 吗?” | api_mapping, label_prototypes |
| “这段代码是 Godot 3 还是 4?” | docs_chunks, api_mapping, label_prototypes 全部是候选 |
即使在此阶段,也不对特定表格进行特殊处理。根据提示和 AST 片段的性质,寻找所需的官方文档 JSONL 依据。
传递给 LLM 的单元
在 Qwen 3.6 中,不会一次性传递整个原始项目。
LLM 调用单元如下组合。
llm_judgment_request
prompt
project_id
source_file
chunk_id
chunk_order
chunk_kind
chunk_text
surrounding_context
retrieved_evidence
judgment_contract这里的 judgment_contract 仍不是最终的 JSONL 架构。当前阶段它是一个告诉 LLM 需要判断什么的请求合约。
retrieved_evidence 仍不是最终的存储架构,而是指代搜索结果集合的抽象字段。后续的存储阶段可以根据证据类型将其拆分为 docs_chunks 证据 ID、api_mapping 证据 ID、label_prototypes 证据 ID 等。本文件中仅将其用作 “检索到的官方文档 JSONL 证据集合” 的含义。
示例:
判断要点:
- 此代码片段是否使用 Godot 3 API
- 是否在 Godot 4 标准下有效
- 是否有迁移依据
- 搜索到的官方文档依据是否与实际代码相关可复用边界
即使是相同的源代码,如果提示不同,Retriever/LLM 的判断也可能不同。
相反,如果是相同的源代码,AST 解析器的结果可以复用。
| 步骤 | 可复用标准 |
|---|---|
| AST 解析 | source_sha256、source_kind、解析器版本 |
| chunk 生成 | source_sha256、分块版本 |
| Retriever 检索 | 提示意图、chunk 符号、检索版本 |
| LLM 判断 | 提示、chunk、证据、模型、提示版本 |
遵守此边界即可避免“源结构分析”和“依据提问意图的判断”相互混杂。
中断/恢复视角
由于分析请求可能会变长,各阶段必须支持恢复。
最小保存单元:
- 文件扫描完成状态
- 每个文件的 AST 解析状态
- chunk 生成状态
- 每个 chunk 的 Retriever 检索状态
- 每个 chunk 的 LLM 判断状态
- Validator 通过状态
如果 RunPod 或本地应用中途停止,只需将正在处理的 chunk 重新置为 pending,已完成的文件和 chunk 可直接复用。
尚未确定的事项
本文档不对以下内容作出确定。
但会记录依赖顺序。
| 顺序 | 项目 | 原因 | 当前追踪位置 |
|---|---|---|---|
| 1 | AST 解析器实现 | 根据使用的解析器不同,chunk 结构和失败恢复方式会有所区别。 | 本文档中的 AST Parser에 넘기는 데이터、AST Parser 출력 |
| 2 | 最终 JSONL 响应模式 | 必须确定用何种 JSONL 验证 LLM 判断结果,才能加入 Validator。 | docs/roadmaps/2026-06-25-source-analysis-scoring-architecture.md |
| 3 | score DB 列 | 在整理 JSONL 响应和 Retriever 依据 ID 后,才能确定存储列。 | docs/retrospectives/2026-06-25-source-analysis-scoring.md |
| 4 | 文件系统分类标签 | 观察 score DB 中累积的判断结果后,再确定项目标签。 | docs/roadmaps/2026-06-25-source-analysis-scoring-architecture.md |
| 5 | SFT/DPO 生成规则 | 在分类的文件系统累积后另行设计。 | docs/roadmaps/2026-06-25-source-analysis-scoring-architecture.md |
当前唯一确定的事项只有一个。
将提示和源代码合并为一次分析请求,但在 AST 解析器中仅传递源代码和文件元数据,提示在解析器之后的 Retriever/LLM 判定阶段使用。