Regal Modules

Monkey Programming Forums/User Modules/Regal Modules

ImmutableOctet(SKNG)(Posted 2014) [#1]
This forum post was originally made on May 17th, 2014.

For those who are interested, I've written a number of open source modules. All of which (As of 10/27/2015) have been released under the MIT license.

I originally wrote this forum post when I made it to ~16 modules. I'm currently at quite a few more, so I think it's time for an update.

Here's a list of stable and experimental modules, and what they do:

Stable Modules:
* 'argumentloader': A basic application-argument parser.
* 'autofit': A refactored version of DruggedBunny's original module, with added support for sub-displays. This version also supports Mojo 2 for backward compatibility. (Enabled with 'AUTOFIT_MOJO2')
* 'autostream': Automated stream creation based on the target. (Used internally)
* 'boxutil': A support library for Monkey's "box" classes; see 'monkey.boxes'. (Used internally)
* 'byteorder': Cross-platform byte-swapping functionality. The API may change at some point, but compatibility should be assumed.
* 'deltatime': A configurable delta-timing module, used to help keep game logic consistent at inconsistent framerates.
* 'eternity': Date/time routines and conversion commands.
* 'hash': A memory-stringent MD5 implementation, and a Monkey version of Java's 'hashCode' command.
* 'imagedimensions': This module allows you to read the dimensions of a GIF, JPEG, or PNG file. Useful for debugging purposes, but it's mainly a support-module.
* 'imageencoder': A (PNG) image encoding module, for supported C++ based targets. This module requires a bit of work to get running.
* 'inputmanager': A user-input management module, useful for device agnostic input, and device configurations. (Pending a rewrite; use at your own risk)
* 'ioelement': A custom-file-format framework. I use this heavily for my own projects, but it's probably not very useful for most people. It's really just a way for me to separate serialized objects.
* 'ioutil': A number of useful I/O components, including 'stdio', 'chainstream', 'repeater', and several other modules.
* 'matrix2d': A 2D matrix implementation based on NoOdle's old Monkey Code post.
* 'mojoemulator': A bare-bones Mojo "simulator" of sorts. Used for a few of my personal projects, but not very useful anymore.
* 'networking': Basic networking functionality; custom protocol. (TCP, reliable UDP)
* 'polygon': An object-oriented wrapper for raw 2D polygons (Float arrays); includes several overlap routines for those who are interested. For something more complicated, view 'collision'.
* 'preprocessor': A module I personally use for my projects; provides target-independent configuration. (Use at your own risk; hasn't been maintained in a while)
* 'resources': A semi-experimental resource management module for Mojo and Mojo 2. (Mojo 2 support is enabled with 'RESOURCES_MOJO2') - May be refactored at a later date.
* 'retrostrings': Classic BlitzBasic String commands; similar to BlitzMax's 'BRL.Retro' module.
* 'screen': An older, but still functional screen/display management module. (Legacy; may be refactored)
* 'sizeof': A somewhat useful module for future-proofing. This provides the sizes of the primitive types in Monkey. This is mainly used internally, but you're welcome to use it yourself. This was a lot more useful when dealing with my own, no longer maintained, private forks of Monkey.
* 'stringutil': A set of utilities for manipulating 'Strings'. This provides a number of macros for symbols, debug commands, and search routines. Credit to Pharmhaus for his original wild-card implementation.
* 'time': This module is provided for compatibility purposes. That, and useful debugging. Basically, this was created before 'brl.process', which has a 'Sleep' command. (Legacy; use at your own risk)
* 'typetool': Primitive-type aliases. (Used internally)
* 'util': General purpose utilities for Monkey. (Variable support; use at your own risk)
* 'vector': Multiple vector classes, supporting multiple primitives, and box-objects. (May be refactored internally; long-term support assumed)

Experimental Modules:
* 'xinput': An XInput wrapper-module that dynamically links with the system's newest DLL. (Windows-only, obviously)
* 'collision': A simple SAT implementation, with a basic collision-resolution routine. (Work-in-progress)
* 'quadtree': Experimental bounds-based quadtree implementation.
* 'mojoinmojo2': Heavily untested wrapper-module for Mojo 1 using Mojo 2. Performance has been completely thrown out the window for this; optimizations needed. (Used for those who want basic shader access from Mojo 1)

Discontinued / Reorganized Modules:
* 'regalnet': Succeeded by 'networking'.
* 'queue': Succeeded by 'monkey.deque'.
* 'publicdatastream': Refactored, and migrated into 'ioutil' as a sub-module.
* 'chainstream': Migrated into 'ioutil' as a sub-module.

To install the stable modules, follow the installation guide here. Installation can be to wherever you want, but the module-folder must be named "regal" (As of October 27th, 2015). Module dependencies are not currently stated. Some are optional imports, but the experimental modules are not required to use the stable modules. This does not always apply the other way. Some modules ('ioutil' for example) have experimental sub-modules, these are not default imports.


ImmutableOctet(SKNG)(Posted 2014) [#2]
I have now added a module called 'hash', which provides a fully functional MD5 implementation. I think it's reasonably efficient, if I do say so myself, and it's not the slowest thing in the world. It supports a number of inputs, and should get the job done. Though, the default method of interfacing with it is a bit weird to work with for some. So, because of this, I've added some functions as wrappers. Simply call 'MD5', and give it one of the following input types: 'Int[]', 'String', 'DataBuffer', or any kind of 'Stream'. The output will be a hexadecimal string representing the hash.

On HTML5 with the current stable version of Chrome, I get around 400ms for 100,000 iterations of the string "Hello world.", which isn't bad by my standards. On any of the standard C++ targets, it's pretty damn fast, and specifically on my Raspberry Pi (With the latest version of GCC, running on Raspbian), I got around 10,000 iterations of a 128x128 block of integers in 10 seconds.

I hope people will look to this instead of some of the implementations available currently. Don't get me wrong, they aren't bad; they get the job done well enough, but this is a lot cleaner if you ask me.

And to be perfectly honest, this was written a while ago, I just never cleaned it up and uploaded it. As usual, use at your own risk, and if there's a prerequisite I'm not aware of, please let me know. You should just need 'retrostrings', and obviously, the module itself.

This may change in the future, all that's used from 'retrostrings' are the hex commands.


DruggedBunny(Posted 2014) [#3]
This looks like some good stuff, not sure why it hasn't been noticed! Thanks for posting!


Skn3(Posted 2014) [#4]
Very nice stuff here :D


ImmutableOctet(SKNG)(Posted 2015) [#5]
The post below was made several months ago. For an up-to-date module list, view the main post.

For those who are interested, I've made quite a few updates to my modules, and I've added several more.

Most notably, there's:
* 'imageencoder': Currently provides PNG image-encoding for C++ based targets. (Currently libpng based)
* argumentloader: Provides a basic frame work for parsing application-arguments.
* 'inputmanager': A framework for device-agnostic input handling; this framework may change at a later date.
* 'autofit': A refactored version of the original 'autofit' module with extra functionality, and support for existing programs using the original module.
* 'stringutil': Basically, this is an evolution from what I started with 'retrostrings', this module provides some of the small functionality that was specific to 'retrostrings', as well as a number of other useful routines.
* 'boxutil': A small module (Mainly used by 'vector') which provides useful functionality for dealing with Monkey's "box" classes.
* My 'vector' module has been heavily updated.
* My 'hash' module has been optimized.
* My 'util' module has had a number of additions, including clipboard support on the new GLFW3 target ('SetClipboard' and 'GetClipboard'), and support for getting the number of cores available on a system ('CPUCount'; Likely more useful later down the road).

There's also been a large number of small fixes, and probably a few bigger additions I'm forgetting. These modules make my life easier when using Monkey, so if you find any use from them, go nuts. Virtually every module at this time is under the MIT license.

A full list of my modules can be found here.


sereschkin(Posted 2015) [#6]
Great stuff. Thank you.


DruggedBunny(Posted 2015) [#7]
Good stuff, as always, thanks!


Duke87(Posted 2015) [#8]
Very Nice Job! Thank you for publishing it.


ImmutableOctet(SKNG)(Posted 2015) [#9]
Just updated the main post for those who are interested. I've created a lot of modules since I first made this thread. They're all listed in the first post. If nothing else, there pretty good references.

And since I've heard it brought up on the forums before, I wrote an XInput wrapper. Currently need to add rumble, but it's basically just a wrapper-layer for the C API.


Skn3(Posted 2015) [#10]
Nice!


Amon(Posted 2015) [#11]
Some really good stuff here, Thank you for the contribution.


MikeHart(Posted 2015) [#12]
Thanks for your contribution. And for free. That is the spirit with an open source language. Good job.


ImmutableOctet(SKNG)(Posted 2015) [#13]
For those who are interested, I just finished writing the initial documentation for my 'networking' module. The module itself has a few hiccups here and there, and still needs a few stability fixes, but it's pretty stable. I also added experimental multi-part packets, made some API adjustments, and added some solid demos. To use the docs, rebuild your documentation, or view the generated files online.

I've also tweaked a few of my other modules, but the main one I've been working on is 'networking'.


ImmutableOctet(SKNG)(Posted 2015) [#14]
** UPDATE (October 31st, 2015) **

* These modules officially have a name; "regal". Every module, experimental or stable, will have this as a prefix. Any legacy code assuming global placement can easily be supported for compatibility purposes. The installation guide reflects this now, including legacy support.
* Added experimental SHA1 support to 'hash'; requires 'HASH_EXPERIMENTAL' to be enabled with the preprocessor. Still need to make it into a proper generic routine like 'MD5'.
* Added Base64 support to 'hash' (Based loosely on Diddy's implementation; uses 'Streams', doesn't use a table to map values, etc).
* Small fixes to 'mojoinmojo2', and (Threaded) asynchronous image loading was added. As usual, use at your own risk.
* It hasn't gone anywhere yet, but I've done some tests with 'networking', and I was able to make a connection with WebSockets to a host 'NetworkEngine'. Ideally, WebSocket support on the HTML5 side will be added, and support for the protocol and handshake will be an option for 'NetworkEngines'. This is still a little while away, but it's definitely on the road-map.
* As stated last week, full documentation is available for 'networking'. Build it yourself, or view it online here.

Other than that, there have been a number of bug fixes. To update everything, "Update_Submodules_Pull.bat" should work.


ImmutableOctet(SKNG)(Posted 2015) [#15]
-