GithubHelp home page GithubHelp logo

damarindra / dolanan Goto Github PK

View Code? Open in Web Editor NEW
4.0 3.0 1.0 651 KB

Is a MonoGame extension contains basic function for creating game, such as sprite, camera, collision etc.

License: MIT License

C# 100.00%

dolanan's Introduction

Dolanan is still far away for Production!

Dolanan

Is a MonoGame extension contains basic function for creating game, such as sprite, camera, collision etc. Dolanan will focus on usability and simplicity for creating 2D game.

How to use it?

Dolanan is just a library project, it is separated from your main project. There is many way to using Dolanan Library, so do whatever you comfortable with it. This is just an example how to do it, you can follow it if you want.

  1. Clone this project.

  2. Create new MonoGame project, detailed step by step read here

  3. Create sln

    • Visual Studio -> open your MonoGameProject.csproj, it will automatically create sln

    • Rider -> Create a new sln, after sln created -> right click MyProject solution -> Add -> Add Existing Project -> MonoGameProject.csproj

  4. Add Dolanan.csproj as reference

    • Visual Studio -> right click MyProject solution -> Add -> Existing Project -> Dolanan.csproj

    • Rider -> right click MyProject solution -> Add -> Add Existing Project -> Dolanan.csproj

  5. [Optional] Create a new SharedProject for your main Game code. Right click MonoGameProject.csproj, Add reference and select the MainGame.shproj.

  6. Happy coding! Remember, if you don't doing step 5, you can just code inside your MonoGameProject.csproj.

What you need to do before start coding

Nuget Library

Dolanan uses 2 nuget library, ImGUI.Net and Sigil. What you need to do is install the package using nuget.

Content.mgcb

Dolanan shared project using the Content.mgcb, so you need to include the Content.mgcb into your MonoGameProject.csproj, edit by hand the MonoGameProject.csproj and add this line code

<Project>
  <!-- Other Line Code -->

  <ItemGroup>
  
    <!-- ADD ALL MGCB HERE -->
    
    <MonoGameContentReference Include="..\Dolanan\Content\Content.mgcb">
      <Link>Content\DolananContent.mgcb</Link>
    </MonoGameContentReference>
    
    <!-- If you used another Shared Project for your Main Game Code -->
    <MonoGameContentReference Include="..\MainGame\Content\Content.mgcb">
      <Link>Content\Content.mgcb</Link>
    </MonoGameContentReference>
    
  </ItemGroup>
</Project>

Unsafe Code

Also, you might get error about unsafe code. This error is caused by ImGuiRenderer. Dolanan only allowed ImGui on Debug mode only, so add this code to the MonoGameProject.csproj

  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DefineConstants>TRACE</DefineConstants>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>

Project Details

Projects Desc
Dolanan is the main library shared project
Sample Main Game code
WinDX Windows DX platform, it uses Sample as the sample of the game
DesktopGL Open GL platform, it uses Sample as the sample of the game
PipelineReader Reader for all custom pipeline type, including aseprite
AsepritePipeline AsepritePipeline, read the json produced by Aseprite

Documentation

Dependency

"ImGui.NET" Version="1.75.0"

"Sigil" Version="5.0.0"

Related tools

dolanan's People

Contributors

damarindra avatar

Stargazers

Zaki Nadhif avatar Haris Praba Aditya avatar Endar avatar  avatar

Watchers

James Cloos avatar  avatar Zaki Nadhif avatar

Forkers

harispraba

dolanan's Issues

Aseprite

Using a library is okay, but sometimes the API is not enough. We are human right?

Joblist

Content Pipeline (Read ogmo implementation - https://github.com/damarindra/Monogame-Ogmo)

Dolanan.Aseprite Animation (requirement, AnimationPlayer)

  • Reader
  • Transfer to AnimationSequence
  • Transfer to AnimationPlayer

Dolanan.Aseprite Body Collider (requirement, Body Collider)

  • Reader
  • Transfer to Body

Dolanan.Aseprite Slice Texture

  • Reader
  • Transfer Texture2DArray

Dolanan.Aseprite 9 Slice (requirement, 9 Slice)

  • Reader
  • Transfer to 9 Slice Texture

Projection

Convert a position to different space

  • Screen To World Position
  • Viewport To World Position
  • World Position to Screen
  • World Position to Viewport

Animation Player

Container for AnimationSequence, provide action to Play(string animationName)

Joblist

Properties

  • GetCurrentAnimationSequence
  • GetCurrentAnimationName
  • IsPlaying

Methods

  • Play(string name)
  • PlayAt(string name, float position)
  • Stop
  • SetSpeed (speed for all animation inside the player)

Collision System

This is Todo list that I'm still missing

  • OnCollisionEnter gives info velocity and remainder, this allow to calculate push velocity

Documentation

Overview

  • Overal System, Intialize, Start, Update, LateUpdate, Draw, BackDraw
  • EC, WITHOUT S. Only EC
  • Collision
  • ``

Important Game Framework

  • GameMgr
  • GameSettings
  • Input
  • ResourceBox (might be delete (?))

Actor

  • Actor
  • Camera
  • World
  • Layer
  • UILayer
  • UIActor

Component

  • Component
  • Transform2D
  • Renderer
  • Sprite
  • UIComponent

Collision

  • AABB
  • Body
  • Response (move)
  • Hit
  • World Collision (not a component, the whole game but collision handle)

UI Component

  • Image
  • comming soon

Animation

  • AnimationPlayer
  • AnimationSequence (resource type)
  • Track

Third Party

  • Aseprite

Change collection to List instead of HashSet

As further research, List is better when saving not many items. Dolanan system has a separate collections to save Actor, Component, and other stuff.
For example, the World contains Layer, which is just small amount. Each Layer will hold Actors, this depends on how big your Layer, but I think List is a lot better. Also, each Actor has components that are not that many, this absolutely better with List.

cons Need to check if Object already added on the collection (but, who the f add the same Object 2 times?)

Command feature

Like in Unreal, 'command' is the feature killer in Unreal. We can add custom command to do an action

How

  • Attribute to mark a function as a Command
  • Button to invoke command text input

User Interface

User Interface is mostly being used when creating a game. Step by step implementation

User InterFACE!

Rect Transform

  • Rectangle
  • Anchor

UICanvas

  • A component Type

Text

  • Text
  • Align
  • Vertical Align
  • Autowrap

Image

  • Texture
  • Auto Fit

9 Slice Image

  • 9 Slice
  • Tile
  • Stretch

Button

  • Image / nineslice
  • Hover & Pressed Tint (Image != null)
  • Callback button (OnHoverEnter, OnHoverExit, OnPressedDown, OnPressedUp)

Bar (After 9 Slice done)

  • Background 9Sliced
  • Foreground 9Sliced
  • Min, Max
  • Value

Vertical Container

  • Done

Horizontal Container

  • Done

Scroll Bar

Animation Sequence

AnimationSquence is a single animation, not a controller! Currently can't be edited at runtime, setup only at constructor.
Example of animation : Idle, Walk, Jump, etc

Track : Contains all keyframe, Object that current recorded
Key : Contains TimeInMilisec and the Value

NOTES

Setter AnimationData

Animation data contains current position of the animation being played and animation length. If we allow this to be edited in runtime, it will mess up all the UpdateAnimation currently running.
Such as Seek function, seek will jump the position of animation currently playing, so we need update All Track inside the animation, such as _nextKeyIndex

Track

TryGetNewKey is a function that trying to get the next key. We need to passing the positionBeforeUpdate and the currentPosition, this value will be used for trapping the nextKey. Trapping => Is the nextKey.TimeInMilisec between the positionBeforeUpdate and currentPosition

Joblist

Static class

  • Save all setter to a dictionary, whenever we create a new track, try search the dictionary first, if any use it, otherwise create new

Animation

  • Getter for AnimationData variable
  • Setter for Animation Data variable (setter at runtime need to update all data such as tracks)
  • Seek
  • Play
  • UpdateAnimation
  • Reverse
  • Loop
  • Stop / Pause
  • Resume

Animation Data

  • Update Animation Data
  • Delegate OnUpdateProperty

Track

  • BaseTrack
  • Track<'T>
  • ValueTrack <'T> (int, float, etc)
  • MethodTrack (Untested)
  • BezierTrack
  • PositionTrack
  • RotationTrack
  • ScaleTrack
  • TryGetNewKey (getting the next key, if passing the key time)
  • AddKey
  • Delegate OnUpdateProperty

Keyframe

  • Key
  • Key<'T>

Runtime Loader & Better Pipeline

While creating a level, looks are important. So we refine our assets and want to reload at runtime. This is important to implement, we don't want to stop game, refine art, start the game, it needs a lot of time!

Joblist

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.