UPDATE, sorta
I bring you build 11.5
Whats new :
-Added a console message to inform users to usage of CLIENT and SERVER;
-SoundSystem! This adds audio file support to mod loader, but some changes to loading mod files :
First, when adding files to load in the _load list - it is required to list with extension, ie "ScriptFile.lua" , this includes audio file support, ie "SomeSound.wav"
Currently the audio file formats supported are : WAV, MP3, OGG
How to use the soundsystem :
After loading the sound into registry with modloader :
Code: Select all
assetModule.newAudio(name,channels)
-- name is the audio files name,
-- Channels is the amount of channels you want to create, leave it blank for default 1 channel.
This will RETURN am asset ID, this ID is important if you wish to operate with the audio.
To play an open channel :
Code: Select all
assetModule.getOpenAudio(ID)
--ID is the ID returned by newAudio,
This RETURNS an open audio channel, that is a sound that is not playing currently or paused.
so using :
Code: Select all
assetModule.getOpenAudio(ID):play()
will play the returned sound.
Currently sounds ARE NOT mod specific, this means sounds can overwrite another sound of same name... build 12 should see mod specific sound storage (similar to mod script files)
What else is new? :
LoveFrames added!
Yup thats right, loveFrames is now packaged with the game, this lets gui's be built easily and quickly (provided you know how to work LoveFrames)
As a precaution i suggest a common courtesy system of keeping frames in the clients GUI table, ie :
Code: Select all
function script.newClientGui(clientdata)
clientdata.GUI[script._UniqueID] = {}
local thisModGui = clientdata.GUI[script._UniqueID]
thisModGui["MainMenu"] = loveframes.Create("frame")
thisModGui["MainMenu"]:SetName("MainMenu")
end
Note how i store in the clientdata table USING the mods UniqueID as its key, this is the clientdata the client creates and uses upon creating itself (client Instance)
As needed the event "OnNewClientInstance" is fired upon starting a client instance, its arguments is only the clientdata table of the client.
Suggested that the mod atleast tries to save a reference to this clientData table for GUIs, to access the clientData table INSIDE the client in any other place use the [table] variable '_CLIENT'
The _CLIENT variable ONLY exists on clients, so to send things from it to server you will need to use 'NETclient:send()'
Instead of a universal 'tick' or 'ping' for clients, the Events 'OnPackageRCVServer' and 'OnPackageRCVClient' can now be used by mods for custom packages!.
WARNING :
As another common courtesy please use json to encode your package, example :
First pick a package append, as a preference its best to append your mods UniqueID with this to prevent overlaps :
"ArchMod" -- the mod UniqueID
"ArchMod:PlaySound" -- the ID appended with a package name
Next json encode and append like so :
"$ArchMod:PlaySound$" .. json.encode(something) -- MUST BE encased in "$" for the package name
[something] can be a table/string/etc BUT NOT userdata, ie love.physics objects, it is best to pick out what you need to send of a lp object and send that specifically.
Systems will be put in to enhance package handling, as of now this will suffice.
Lastly id like to mention the previous demo has been somewhat removed, and instead Im working on a more complete demo now using as much features of the engine as possible. Thus build 12 will be this demo/showcase release to show just what can be done using the InsanityEngine.
There is a
primitive demo showing the gui system and SoundSystem.
If you have any requests, suggestions, complaints etc please put them forward!
(I apologize for slow work on this, family visit has put me out of my work space so i am less productive as I would like to be.)