LuanVan.vnLuận Văn
Gửi thư

DESIGN AND IMPLEMENTATION OF A TCBSCRIPT COMPILER FOR THE THECELLBEYOND GAME ENGINE - PART A: COMPILER CORE

Khoá luận tốt nghiệp · Đại học · năm 2026 · đề tài tham khảo

Loại tài liệuKhoá luận tốt nghiệp
Bậc họcĐại học
NgànhCông nghệ thông tin
Tác giảLê Nguyên Bảo
Người hướng dẫnNguyễn Công Danh
Cơ sở đào tạoTrường Đại học Cần Thơ
Năm2026
NguồnThư viện số Trường Đại học Cần Thơ · trang gốc

Tóm tắt

Context: TheCellBeyond is an open-source 2D game engine written entirely in Java. Architecturally it is complete - a GameObject–Component object model, a 2D physics loop, a resource system, and a graphical editor - but adding gameplay logic to it still requires the user to write Java, to invoke Gradle by hand from a terminal to produce a jar, and to wait for ScriptLoader to pick that jar up. Those three manual steps raise the entry barrier for anyone without a Java background and lengthen the write–run loop that game development depends on. Embedding an existing scripting language such as Python or Lua is not the answer either, because the very thing that makes those languages valuable - their own runtimes and library ecosystems - cannot cross to the JVM, and bridging to them costs a marshalling layer on every single API call. Purpose: This thesis designs and implements TCBScript, a Python- and GDScriptflavored scripting language that is transpiled to Java source and fed into the engine's existing build-and-load pipeline. The report covers Part A, the compiler core: refactoring the engine's lifecycle API so that generated code never needs a super call; generating an API manifest at build time; an indentation-aware lexer base class and an ANTLR4 grammar; a dedicated abstract syntax tree; a two-pass semantic analyzer that resolves and translates every identifier against that manifest; a code generator written from scratch; and five language expansions, EX0 through EX4. Method: Collect, analyze and study the literature on compiler construction and on scripting in game engines; survey the four models of scripting integration and the available Java code-generation libraries in order to reduce the technology stack to what is genuinely needed; design the language and the compiler architecture; then implement and verify the result through sequential milestones (M1–M5, EX0–EX4), each shipping with a JUnit 5 suite that is required to stay green when a later milestone extends the same code. Findings: The compiler takes a .tcbs file and produces valid .java that compiles and loads directly into the running engine. Pushing all identifier lookup into a static manifest and all name collisions into a fail-fast semantic pass makes sophisticated codegeneration libraries redundant: a hand-written primitive of about fifty lines is sufficient, which leaves ANTLR4 as the compiler's only third-party dependency. The compiler core is validated by a suite of 178 unit tests (216 across the whole project), whose codegeneration cases compile the emitted Java with an in-memory javac rather than merely 5 matching strings; the generated code contains no super call anywhere and is byteidentical across repeated runs. Conclusion: The transpile-to-Java approach has been implemented successfully for TheCellBeyond. Because the generated code is plain Java compiled to bytecode like any other engine class, the runtime cost is essentially zero, and the entire JVM toolchain is reused for free. The editor integration and the demonstration game are the work of Le Huynh Nhat Nam, presented in the companion Part B thesis and summarized in Section 3.6 here. Keywords: compiler, transpiler, ANTLR4, generative grammar, abstract syntax tree, semantic analysis, code generation, game engine scripting, domain-specific language, TCBScript, TheCellBeyond. Bối cảnh: TheCellBeyond là một game engine 2D mã nguồn mở viết hoàn toàn bằng Java, đã hoàn thiện về kiến trúc với hệ thống GameObject – Component, vòng lặp vật lý 2D, hệ thống tài nguyên và một editor đồ hoạ. Tuy vậy, để tạo logic gameplay người dùng vẫn phải viết script bằng Java, tự mở terminal gọi Gradle để biên dịch thành tệp jar, rồi chờ ScriptLoader nạp vào engine. Ba bước thủ công này đặt ngưỡng tiếp cận rất cao đối với người không có nền tảng Java, đồng thời kéo dài vòng lặp "viết script - chạy thử" vốn cần càng ngắn càng tốt trong phát triển game. Nhúng một ngôn ngữ scripting sẵn có như Python hay Lua cũng không phải lời
Bản toàn văn lưu tại thư viện Trường Đại học Cần Thơ

Thông tin và tóm tắt ở trên lấy từ kho số mở của thư viện trường. Bản toàn văn do thư viện trường quản lý — có nơi cho đọc trực tuyến, có nơi cần tài khoản bạn đọc của trường.

Mở tại thư viện trường ↗
Dùng tài liệu tham khảo cho đúng
  • Đọc để hiểu cách người trước đặt câu hỏi, chọn phương pháp, trình bày số liệu — rồi tự làm với dữ liệu và bối cảnh của bạn.
  • Ý, số liệu, bảng biểu lấy từ tài liệu này phải trích dẫn (tác giả, năm, tên đề tài, cơ sở đào tạo).
  • Đề tài trùng tên vẫn làm được nếu khác đơn vị khảo sát, thời gian hoặc cách tiếp cận — nêu rõ điểm khác trong phần mở đầu.

Hướng dẫn chọn đề tài, cấu trúc và số liệu cho ngành này: Luận văn công nghệ thông tin · Hỏi đáp từng chương với người hướng dẫn số: Học Giả Số · Công cụ số: Luận Văn Số.

Đề tài cùng ngành

Tác giả muốn gỡ, sửa thông tin hoặc bổ sung bản toàn văn: gửi yêu cầu qua trang Liên hệ, kèm đường dẫn trang này.