Giter Club home page Giter Club logo

gem.dino.1's Introduction

GemDino

My first RPG game made with java. It was a great experience.

History

// Decompiled by Procyon v0.5.36

Structure

graph TD;
    App-->MenuScreen;
    App-->LoadingScreen;
    App-->ErrorScreen;
    App-->GameScreen;
    App-->KeyboardManager;
    App-->MouseManager;
    GameScreen-->GameWorld;
    GameScreen-->GameCamera;
    GameScreen-->GameMap;
    GameWorld-->EntityManager;

Every children does not have direct access to their parent.
They have access to the App and from the App they have access to their parent.

graph TD;
    Entity-->MovingEntity;
    Entity-->StaticEntity;
    MovingEntity-->Animal;
    MovingEntity-->WeaponOut;
    Animal-->Player;
    Animal-->Enemy;

gem.dino.1's People

Contributors

tuana9a avatar

Stargazers

JS avatar

Watchers

 avatar

gem.dino.1's Issues

Refactor lại luồng flow của app

Vấn đề

  • đang dùng khá nhiều singleton đã lộ vấn đề: do singleton thích gọi chỗ nào thì gọi, nên flow của ứng dụng không thằng, có thể có vòng lặp, rối như mạng nhện, không chia theo layer, đọc code để trace theo stack khá khó -> khó đọc khó maintain, mở rộng
  • luồng gọi không rõ ràng, nhiều đa luồng tưởng tối ưu nhưng việc này làm việc đọc code và debug khó hơn, nếu dùng đa luồng nên chia lại cho dễ maintain hơn

Mọi thứ đều vào action queue

tất cả sự kiện: hit, nhặt đồ, collide, đều được add vào event queue,sau đó sẽ được xử lý tuần tự khi update

Tối ưu việc load asset

Nên code thêm một class, layer dạng database chuyên quản lý việc:

  • load file: chỉ cho phép load file từ đây thui
    • việc class nào load file gì có thể cho ra một file config, có thể lưu static class tạm thời cũng được
  • caching: đã load rồi thì không load lại nữa
  • garbage collector: đếm số lần sử dụng của image đó, nếu số lượng bằng 0 thì có thể lên lịch hẹn xóa
  • giả lập việc loading nên tối ưu và làm đơn giản lại

BufferRing

Triển khai buffer ring cho action queue

  • mảng sẽ có kích thước cố định
  • current index, end index, stop khi current index == end index
  • sử dụng kiểu dữ liệu short ( để tận dụng việc number overflow)

ErrorScreen không yêu cầu load assets

Để error screen có thể hoạt động được kể cả load assets bị lỗi thì bản thân error screen không nên dùng bất cứ hình ảnh nào, đơn giản là các error message thui.

Cải thiện class Weapon

  • đạn có thể swap được
    • đạn có fly method: default là bay thẳng
  • handle
    • vị trị cầm vũ khí
  • cách bắn
    • tap to shoot
    • hold to shoot
    • bắn liên thanh
  • số lượng đạn
  • addon
    • số lượng đạn

Entity.render

không phải entity nào cũng có working area nên đây là một ability hơn là force các entity phải có chức năng này.

TODO

  • Sử dụng strategy pattern, việc render là không bắt buộc, sẽ có render default là không render gì cả, khi bắt event enable thì đơn giản là set lại trường này.
  • Không còn if else, check type của class có phải là enemy hay không.
  • Tốt hơn là mình sẽ để entity tự quyết việc render, việc renderWorking hay gì đi nữa thì đơn giản set opts cho entity đó chẳng hạn, không kiểu apply wide, force cho toàn bộ các node như thế này.

Làm lại gamemap

  • load bằng json
  • định nghĩa các thực thể theo vị trí x, y chứ không dùng mảng với id type của object nữa

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.