Code Monkey home page Code Monkey logo

ludobits's Introduction

Ludobits

Utilities for game development using the Defold engine.

Travis-CI

Modules

ludobits.m.io.file

File name and path utilities

ludobits.m.io.savefile

Read/write files

ludobits.m.io.savetable

Read/write Lua tables

ludobits.m.app

Wrap engine callbacks from iac, iap, push and window. Refer to app.md for usage details.

ludobits.m.bezier

Create bezier curves

ludobits.m.broadcast

Broadcast Defold messages (using msg.post) and set up optional function callbacks when messages are received. Refer to broadcast.md for usage details.

ludobits.m.flow

Simplifies asynchronous flows of execution where your code needs to wait for one asynchronous operation to finish before starting with the next one.

ludobits.m.json

JSON encode (using rxi.json)

ludobits.m.listener

Listener implementation where listeners are added as either urls or functions and notified when any or specific messages are received. Refer to listener.md for usage details.

ludobits.m.logger

The Logger module provides a simple logging framework to log application events of different severities to standard out. The module supports simple filtering based on severity. Refer to logger.md for usage details.

ludobits.m.settings

Store user settings to disk. Refer to settings.md for usage details.

ludobits.m.signal

Signal system where named signals can be created, listened to and triggered. Inspired by as3-signals. Refer to signal.md for usage details.

ludobits's People

Contributors

astrochili avatar blackmatov avatar britzl avatar cytherabbit avatar vbif avatar vbif1 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ludobits's Issues

Flow API suggestion

"Fork-join" model fits pretty well for several async animations (you can spawn a lot of flow in parallel), but there is no "wait for flow" api in module. I came up with code like this, but there is probably better way to implement such functionality.

local function flow_wait_others(flows)
	assert(flows)

	-- single coroutine
	if flow.co then
		flow.until_true(function(args)
			return coroutine.status(flow.co) == "dead"
		end)
		return
	end

	-- several coroutines
	for k, v in pairs(flows) do
		flow.until_true(function(args)
			return coroutine.status(v.co) == "dead"
		end)
	end
end

Flow order of execution

In debugging, I found the order of execution when using Flow was a little unexpected. It might be worth documenting.

For example, in an Update function (not real code):

  • print("testA")
  • flow( print("testB") ) -- no delay before calling print
  • print("testC")

I was expecting it to print testA, testB, testC. Instead it's testA, testC, testB. They're all executed on the same frame, but Flow executes later.

This is totally fine but might be worth noting somewhere.

Also, thanks for the great toolset, and all your assets really.

Mistake in logger usage description

In example written:
log1.level(logger.WARN)
But must be
logger.level(logger.WARN)
Because created log instance have no level function. This function is only available in the entire module.
Links:
logger.lua
logger.md - mistake is here

Can flow receive messages without waiting for new frame?

I have two scripts that post messages each other. Scripts' on_message functions look ugly and unreadable so I decided to rework them using flow.

My old code usually posts and receives a few dozens messages in a single frame.

I found that flow.until_message waits for next frame after receiving the message. Therefore my new code requires a few dozens frames to complete --- this is too long for my game.

Is it a flaw by design? Can it be fixed? flow makes code look so much readable...

Need for unregisterAll method in ludobits.m.simple_input.lua

If we reload collection with gui elements and use simple_input lib in scripts we got an error:

ERROR:SCRIPT: /ludobits/m/simple_input.lua:65: Node used in the wrong scene
stack traceback:

It just because local registered_nodes = {} is local table and not cleaning after closing the old collection. Elements in this table has the same url but not correct node.
So we need call unregister for all registered element in final method or what is better need to method unregisterAll.

flow gui_animate in defold 151

After update, flow.gui_animate was broken
You can only access gui.* functions and values from a gui script instance (.gui_script file)
Is it issue from instance remove from 151 update?

Increasing time gap in flow module

In flow module while creating new instance of timer you use 0.016 delay.

After a little test:

init function:

timer.delay(0.016, true, function(self, handler, dt)
  timer_time = timer_time + dt
  print('timer: ' .. timer_time)
end)

update function:

update_time = update_time + dt
print('update: ' .. update_time)

The difference between timer_time and update_time keeps growing:
image

In other modules you using timer.delay(0... and in this case the gap is gone:
image

Flow collection factory

flow.load can be used for collection proxy.

Does this work with collection factory too?

Thanks.

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.