diff options
Diffstat (limited to 'doc/file.README.html')
| -rw-r--r-- | doc/file.README.html | 359 |
1 files changed, 359 insertions, 0 deletions
diff --git a/doc/file.README.html b/doc/file.README.html new file mode 100644 index 0000000..f9d58fe --- /dev/null +++ b/doc/file.README.html @@ -0,0 +1,359 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="UTF-8"> +<meta name="viewport" content="width=device-width, initial-scale=1.0"> +<title> + File: README + + — Documentation by YARD 0.9.26 + +</title> + + <link rel="stylesheet" href="css/style.css" type="text/css" /> + + <link rel="stylesheet" href="css/common.css" type="text/css" /> + +<script type="text/javascript"> + pathId = "README"; + relpath = ''; +</script> + + + <script type="text/javascript" charset="utf-8" src="js/jquery.js"></script> + + <script type="text/javascript" charset="utf-8" src="js/app.js"></script> + + + </head> + <body> + <div class="nav_wrap"> + <iframe id="nav" src="file_list.html?1"></iframe> + <div id="resizer"></div> + </div> + + <div id="main" tabindex="-1"> + <div id="header"> + <div id="menu"> + + <a href="_index.html">Index</a> » + <span class="title">File: README</span> + +</div> + + <div id="search"> + + <a class="full_list_link" id="class_list_link" + href="class_list.html"> + + <svg width="24" height="24"> + <rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect> + <rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect> + <rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect> + </svg> + </a> + +</div> + <div class="clear"></div> + </div> + + <div id="content"><div id='filecontents'> +<p><img src="https://filestorage.catgirls.rodeo/images/felflame-logo-full.png" alt="FelFlame" /></p> + +<p><a href="https://codeclimate.com/github/realtradam/FelFlame/maintainability"><img src="https://api.codeclimate.com/v1/badges/56d425d9078e98efb74b/maintainability" alt="Maintainability" /></a> +<a href="https://codeclimate.com/github/realtradam/FelFlame/test_coverage"><img src="https://api.codeclimate.com/v1/badges/56d425d9078e98efb74b/test_coverage" alt="Test Coverage" /></a> +<a href=""><img src="https://img.shields.io/badge/Documentation-100%25-br" alt="Documentation Coverage" /></a></p> + +<h1 id="what-is-this">What is this?</h1> + +<p>This is a Ruby ECS Framework for developing games. It is still a work in progress in the early stages, is not fit for use, and does not work. +It is designed to be platform agnostic, this means it should be able to work by plugging it into any ruby game engine/library/toolkit with minimal modifications.</p> + +<p>I wanted a reusable framework so I could quickly and effectively develop games. I also want it to be more complete, as opposed to barebones or boilerplate. +I plan to eventually add functionality outside of just ECS such as loading tilesets, a camera system, etc. that are built into the framework to work seamlessly.</p> + +<h1 id="what-is-currently-implemented">What is currently implemented?</h1> + +<p>Entities and Components are mostly implemented, with only a few non-critical functions missing.</p> + +<p>Systems, Scenes, and the Stage still needs to be implemented</p> + +<h1 id="specification">Specification</h1> + +<p>Below are the specifications I have imagined for this framework and have been written out. They are subject to change as FelFlame is developed and used.</p> + +<h2 id="aliases">Aliases:</h2> +<p><code>ruby +FF = FelFlame +FF::Ent = FelFlame::Entities +FF::Cmp = FelFlame::Components +FF::Sys = FelFlame::Systems +FF::Sce = FelFlame::Scenes +FF::Stg = FelFlame::Stage +</code> +## Classes:</p> + +<h3 id="ffentities">FF::Entities</h3> +<p>```ruby +FF::Ent.new(@component1, @component2) +@entity = FF::Ent.get(entity_id) +FF::Ent.delete(entity_id) [email protected] # => unique entity id</p> + +<p>@entity.add @component [email protected] @component [email protected] # => [:id, :scenes, :components] +FF::Ent.load @entity_dump +```</p> + +<h3 id="ffcomponents">FF::Components</h3> +<p>```ruby +FF::Cmp.new(‘Name’, ‘param1’, param2: ‘default’) +FF::Cmp::Name.new(param1: value1) +@component = FF::Cmp::Name.get(component_id) +FF::Cmp::Name.get_by_entity(entity_id) # gets array of components [email protected](param2: ‘not default’) [email protected] = ‘different not default’ +FF::Cmp::Name.detach(entity_id: ent_id, component_id: cmp_id) +FF::Cmp::Name.remove_entity(entity_id) # Removes entity from any components +FF::Cmp::Name.delete_component(component_id) # deletes component and removes from all relevant entities [email protected] # returns hash of all variables!(and the id) +FF::Cmp::Name.load @component_dump</p> + +<p>FF::Cmp::Health.added # => returns values for sys to setup +FF::Cmp::Health.removed # => returns values for sys to setup +FF::Cmp::Health.is_set(‘var’) # => returns values for sys to setup +```</p> + +<h3 id="ffsystems">FF::Systems</h3> +<p><code>ruby +FF::Sys.new(name: 'Render', position: 5, frame: 1) do + @component.each do + # functionality + end +end +FF::Sys::Render.trigger_when FF::Cmp::Health.added +FF::Sys::Render.trigger_when FF::Cmp::Health.removed +FF::Sys::Render.trigger_when FF::Cmp::Health.is_set('var') +</code></p> + +<h3 id="ffscenes">FF::Scenes</h3> +<p><code>ruby +FF::Scn.new(name: 'Scene1', position: 1) +FF::Scn::Scene1.add @entity +FF::Scn::Scene1.add FF::Sys::Render +FF::Scn::Scene1.entities # => [id_1, id_7, etc] +FF::Scn::Scene1.systems # => [:Render, :Damage, etc] +FF::Scn::Scene1.dump # => [:name, :entities, :systems] +FF::Scn::Scene1.load @scene_dump +</code></p> + +<h3 id="ffstage">FF::Stage</h3> +<p><code>ruby +FF::Stg.add FF::Scn::Scene1 +FF::Stg.remove FF::Scn::Scene1 +FF::Stg.scene # => [:Scene1, :Scene2, etc] +FF::Stg.dump # => [:Scene1, :Scene2, etc] +FF::Stg.load @stage_dump +FF::Stg.clear +</code></p> + +<h3 id="felflame">FelFlame</h3> +<p><code>ruby +FF.dump # => all data +FF.load @felflame_dump +</code> +— +<img src="https://filestorage.catgirls.rodeo/images/whitespace.png" alt="blank" /><br /> +<img src="https://filestorage.catgirls.rodeo/images/whitespace.png" alt="blank" /><br /> +<img src="https://filestorage.catgirls.rodeo/images/whitespace.png" alt="blank" /><br /> +— +# Ramblings: +Was my originally written up specs. Rewrote it as what is written above to be more clear. +The below are more verbose but not as helpful for me for implementation. Once the framework is +complete I will use a more verbose explanation as below to help users of the framework.</p> + +<hr /> + +<p>Creating Entities:</p> + +<p>```ruby +# Plain: +@my_entity = FF:Ent.new</p> + +<h1 id="with-components">With components:</h1> +<p>FF::Ent.new(FF::Cmp::Position.new(var1: ‘val’, var3: ‘change_default’), + FF::Cmp::Health.new(hp: 20), + FF::Cmp::Poison.new(dps: 3), + FF::Cmp::Poison.new(dps: 2), # This entity has 2 of the same component in it! + FF::Cmp::Selection.get(component_id)) # Components can belong to multiple entities, this component already existed elsewhere! +```</p> + +<p>Adding and Removing Components from Entities: +```ruby +@my_entity = FF::Ent.get(entity_id)</p> + +<p>@my_entity.remove(component_id) +# Remove the specific component with that id</p> + +<p>@my_entity.remove(FF::Cmp::Poison) +# Removes all components of that type</p> + +<p>@my_entity.add(FF::Cmp::Selection.new) +# Adds a new Component +```</p> + +<p>Creating Component Class:</p> + +<p><code>ruby +# Creating a component 'factory': +FF::Cmp.new('Name', 'var1', 'var2', var3: 'default') # Name, *no_default, **with_default +</code></p> + +<p>And then using those components: +<code>ruby +@new_cmp = FF::Cmp::Name.new(var1: 'oke') # var3 will be 'default', var2 will be nil +@new_cmp.var2 = 3 # now var2 is set +@new_cmp.set(var1: 'nope', var3: 'different') # var1 and var3 are now changed! +@new_cmp.to_hash # returns the hash of all variables! +</code></p> + +<p>Referencing Components: +<code>ruby +FF::Cmp::Name.get(component_id) # gets component by their unique id +FF::Cmp::Name.get_by_entity(entity_id) # gets component that is attached to the entitry +# will return array of components if there is multiple of same component +# if it returns array, see the `dump` section. Need to add custom method to the array +</code></p> + +<p>Creating Systems: +<code>ruby +FF::Sys.new(name: 'Render', position: 5, frame: 1) do +# position is the order in which systems get executed, can be overlapping but then order is unexpected between same positions +# frame is on which frame the system will be called. 0 is never, 1 is on each frame, 2 is every other frame, etc + FF::Cmp::Position.each do + #render your sprite + end +end +</code></p> + +<p>Enabling Systems: +```ruby +# By default systems are not enabled. You need to add them to a scene +FF::Scn::Scene1.add FF::Sys::Render</p> + +<h1 id="they-can-also-be-disabled-by-removing-them">They can also be disabled by removing them</h1> +<p>FF::Scn::Scene1.remove FF::Sys::Render +```</p> + +<p>Custom Hooks: +```ruby +# Systems can be configured to be called whenever a certain component is added, removed or set +FF::Sys::Damage.trigger_when FF::Cmp::Health.added +FF::Sys::Revive.trigger_when FF::Cmp::Health.removed +FF::Sys::Healup.trigger_when FF::Cmp::Health.is_set</p> + +<h1 id="systems-can-also-be-manually-called-so-you-can-code-custom-hooks">Systems can also be manually called so you can code custom hooks!</h1> +<p>FF::Sys::Restore.run +```</p> + +<p>Scenes contain Entities and Systems +```ruby +FF::Scn.new(name: ‘Scene1’, position: 1) +# Multiple scenes could be ran at once, if they do then they will run according +# to their positions as explained above</p> + +<p>FF::Scn::Scene1.add FF::Entity.get(entity_id) +# You can also just pass the id on its own => FF::Scn::Scene1.add entity_id +FF::Scn::Scene1.add FF::Entity.new</p> + +<p>FF::Scn::Scene1.add FF::Sys::Render +```</p> + +<p>To List Systems and Enties +<code>ruby +FF::Scn::Scene1.get_entities # => [id_1, id_7, etc] +FF::Scn::Scene1.get_systems # => [:Render, :Damage, etc] +</code></p> + +<p>To run a Scene it must be added to the Stage +<code>ruby +FF::Stg.add FF::Scn::Scene1 +</code></p> + +<p>Or remove it: +<code>ruby +FF::Stg.remove FF::Scn::Scene1 +</code></p> + +<p>Show all Scenes on the Stage: +<code>ruby +FF::Stg.scenes # => [:Scene1, :Scene2, etc] +</code></p> + +<p>Remove all Scenes from the Stage: +<code>ruby +FF::Stg.clear +</code></p> + +<p>You can save the current game state: +<code>ruby +@json_save_data = FF.dump +</code></p> + +<p>You can also specifically choose what you want to save: +```ruby +@hash_entity = FF::Ent.get(entity_id).dump +# to save all components related to a player</p> + +<p>@hash_component_single = FF::Cmp::Health.get(component_id).dump +# save all data in the single component(needs to handle arrays of components)</p> + +<p>@hash_component = FF::Cmp::Health.dump +# save all components of a certain component type</p> + +<p>@hash_components_all = FF::Cmp.dump +# save all components</p> + +<p>@hash_scene = FF::Scn::Scene1.dump +# save all entities, components, and activated systems in a given scene +```</p> + +<p>And then they can be loaded back in: +<code>ruby +FF::Ent.load(@hash_entity) +FF::Cmp::Health.load(@hash_component) +FF::Cmp.load(@hash_component) +FF::Cmp.load(@hash_components_all) +FF::Scn.load(@Hash_scene) +</code></p> + +<h3 id="to-do-listold">To Do List(old)</h3> + +<hr /> + +<ul> + <li>[ ] Some level of hierarchical support?</li> + <li>[ ] One Component to many entities.</li> + <li>[ ] Multiple of same component to one entity</li> + <li>[ ] State Machine?</li> + <li>[ ] Systems execute code on an event + <ul> + <li>[ ] Adding/removing/setting component is event</li> + <li>[ ] Frame is an event</li> + </ul> + </li> + <li>[ ] System Execution Order</li> + <li>[ ] Save Dump/Load</li> +</ul> +</div></div> + + <div id="footer"> + Generated on Thu Jun 10 12:03:05 2021 by + <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a> + 0.9.26 (ruby-2.7.2). +</div> + + </div> + </body> +</html>
\ No newline at end of file |
