Jump to content

Sound device controlled via lua


Whalekit

Recommended Posts

 

Suggestion to add sound devices

In DU you can present visuals using html, svg, widgets, but when it comes to audio, things are not so bright. 
Sound is important if you want players to be able to make games. Sound can play role in interfaces, used for alarms and, of cource, playing music!
So I propose adding to the game lua-controlled "SPUs"/"sound devices"/"sound units", that will allow players to do all kinds of stuff - from simply playing sound on notification in theyr programs to implementing sound effects in the game, or even creating sound trackers and sequencers (to then create music in it).

 

m-lOJ1gUD-jGJxWq3Y1IZkFYHl-geesJzBNjQpu2nqNTnygpFU8QBU6sFyaywRujZ0D3jF9KFQvgvGzUrQi-t7AUgFxMwJElNWopWf1pgFp2CzPW_-papcKJ6kCAEPaeCZ3TPrV4

 

sound device:
  -has sound memory consisting of, say 44100*8 bytes (number depends on sound device tier), which that can be read as integers using get_sample, set_sample. 
  -has 8 channels (also depends on sound device tier). each channel can be set to play samples from area in audio memory or use oscillator. Each channel can have 1 siimple filter on it.

 

uHQ8qaB8hDmaiTZax95G67SQ74Rorq9rG0RB6aDWUnqdKZ7gsA6Da_6ogAX0USnULgPK4zJE8GmxkUdijIE-7s5juEFRTWjMfAjvXtI66Nw86dMWrjuNCh8K3w3ornckkLEhUMXk

 

sound device api: 
sound memory manipulation functions:
   samples_count(sample_depth)
      - returns how much integer values of size sample_depth in bytes sound memory can hold
   get_sample(sample_depth, sample_index)
      - interpreting sound memory as array of signed integer numbers consisting of sample_depth bytes return sample_index'th integer number from this array.
         sample_depth can have value 1, 2, 4, 8. On any other value get_sample returns nil
         sample_index wraps around if higher than number of integers in array
   set_sample(sample_depth, sample_index, new_value) 
      - interpreting sound memory as array of signed integer numbers consisting of sample_depth bytes set sample_index'th integer number to new_value.
   getNSamples(sample_depth, sample_index, N)
      - same as get_sample, but instead of getting 1 integer value it returns table consisting of N values from audio memory starting from position sample_index. Can be merged with get_sample
   setNSamples(sample_depth, sample_index, new_value)
      - same as set_sample, but instead of setting 1 integer value, it sets #new_value samples to values from new_value table starting at position sample_index

channel control fuctions:
   channels_count()
      -returns number of channels sound device has
   channel_set_sound_source_memory(channel_num, sample_depth, sample_rate, start, end, loop)
      -set channel to play sound from sound memory
   channel_set_sound_source_osc(channel_num, type, frequency, osc_param)
      -type is string - "noise", "sin", "tri", "square". triangular and rectangular waveforms take 1 more paramenter for rate
   channel_set_volume(channel_num, new_volume, time, delay)
      - sets channel volume to new_volume. If time arg is provided, volume will be changed gradually in time milliseonds (if not interrupted by another set_volume command). If delay arg is provided, volume change start will start in delay milliseconds after this command called.
   channel_set_pan(channel_num, new_pan, time, delay)
      - sets channel pan to new_pan. 0 is left, 1 is rigth, 0.5 is center
   channel_set_pitch(channel_num, new_pitch, time, delay)
   channel_start_note(channel_num, delay)
      - starts note on channel. start is delayed for delay milliseonds, if delay parameter provided. If other note was playing on this channel, it ends.
   channel_end_note(channel_num, delay)
   channel_set_filter_type(channel_num, type, delay)
      - filter types are "none", "highpass", "lowpass", "comb", "bandpass"
   channel_set_filter_base_frequency(channel_num, freq, time, delay)
   channel_set_filter_gain(channel_num, gain, time, delay)
      - in dB, if applicable to filter
   channel_set_filter_param(channel_num, param_num, param_amount, time, delay)
      - filter-specific params, such as resonance for "highpass" or "lowpass", bandwidth for "bandpass"

 

Link to comment
Share on other sites

Maybe not yet? Because radio will be something in game for real i wonder, i think NQ will add something like it soon but not now ( just still Pre- Alpha or Alpha yet ?) be patient we still have almost a year to improve the game :)

Link to comment
Share on other sites

23 hours ago, ShioriStein said:

NQ will add something like it soon

I'm sure they will ad some way to play sound. But will it be note blocks, that can play one predetermined sound, midi player with predermined instrument sounds, or powerful API that allows you to create and play something like tracker music or even better right in the game?

On 03.01.2018 at 7:46 PM, ShioriStein said:

be patient

It's not about my impatience, I just don't want game to end up with poor soud API (like music block from minecraft or midi player with predermined sounds), and seeing how rich player's capabilities are to create visual content (svg, html) gave me hope that devs could consider making something just as good for audio. 

Link to comment
Share on other sites

Yeah i hope to, cant wait to see how sound will be use inside the game. It very important like Festival, Music Concern, Propaganda of course :)

Link to comment
Share on other sites

Our questions pretty much align on this part though because if something like this is implemented, I can actually program/build an ingame jukebox. People pop in a few credits and a song starts playing, or genre. Song/genre only starts playing after the current playing song is finished.

 

something along the lines of checking current play status, then proceed to queue a marker at the end of the song that refers to purchased song. Having a jukebox like that can be implemented in all manner of social locations, a.e. bars, saloons, recreation halls aboard large ships or stations.

Link to comment
Share on other sites

29 minutes ago, Omfgreenhair said:

Our questions pretty much align on this part though because if something like this is implemented, I can actually program/build an ingame jukebox. People pop in a few credits and a song starts playing, or genre. Song/genre only starts playing after the current playing song is finished.

 

something along the lines of checking current play status, then proceed to queue a marker at the end of the song that refers to purchased song. Having a jukebox like that can be implemented in all manner of social locations, a.e. bars, saloons, recreation halls aboard large ships or stations.

Thatr's not so simple.

That what you said, invovles servr-side languages, which Lua in DU, will pobably, not cover, as I don't think NQ will implement SQL libraries for Lua - for obvious security reasons.

However, if NQ was to add "widgets" as in Apps inm the Android store, so one can link their Spotify in-game, then who knows, maybe it will be good business for NQ to genrate ad revenue or for playing ads in the game.

Pick your poison :P Most likely, it's going to fall under "fair use" and NQ will just allow the HTML5 to do its job.

Link to comment
Share on other sites

Well since HTML is already a thing in the game, if it allows gifs and videos, I would assume it can also allow audio if NQ decides to code that into the game. Setting up audio to play from the monitor that has HTML for an audio player on it shouldn't be hard to code.

However, then in order to get your music to play in the game, you would have to be hosting it outside of the game in a playable format (wav, mp3, etc.) as opposed to doing something like what Archeage did where you would make the music in the game using MML (https://en.wikipedia.org/wiki/Music_Macro_Language), or rather make the music outside of the game using a program, convert it to MML, then paste it into a music sheet in the game.

 

imo they should just let HTML do it's thing and make the sound play from the monitor. Maybe they can add a "speaker" module that you can hook up to the monitor as a sound output.

Link to comment
Share on other sites

53 minutes ago, Vellnn said:

Well since HTML is already a thing in the game, if it allows gifs and videos, I would assume it can also allow audio if NQ decides to code that into the game. Setting up audio to play from the monitor that has HTML for an audio player on it shouldn't be hard to code.

However, then in order to get your music to play in the game, you would have to be hosting it outside of the game in a playable format (wav, mp3, etc.) as opposed to doing something like what Archeage did where you would make the music in the game using MML (https://en.wikipedia.org/wiki/Music_Macro_Language), or rather make the music outside of the game using a program, convert it to MML, then paste it into a music sheet in the game.

 

imo they should just let HTML do it's thing and make the sound play from the monitor. Maybe they can add a "speaker" module that you can hook up to the monitor as a sound output.

Well, Soundcloud is a good idea for hosting most music, as you can link just the widget's ID and have a music station play non-stop, or hey, make your own playlist, and literally control the music from your browser. good for in-game Radio Stations as well, for anyone who knows how to set up such things.

The reason I think they will eventually make sound a different element in-game altogether, is for possible use of Unigine's sound technology, that can make sound gradient - something not as simple as it may sound on paper - or so for modular speaker spreading.

You could mount four speakers aiming at the centere of a room from all its ceiling corners, getting a "surround" soiund, something you can't achieve with stereo sound from one source, or direction.

I mean, 7:1 beats Stereo. And who knows, maybe Tier-2 Sound Systems unlock the Woofer, with +10% on Bass.  :P 

Link to comment
Share on other sites

On 11.01.2018 at 12:22 AM, CaptainTwerkmotor said:

Thatr's not so simple.

That what you said, invovles servr-side languages, which Lua in DU, will pobably, not cover, as I don't think NQ will implement SQL libraries for Lua - for obvious security reasons.

Why do you think so? All you need for that is Lua code in the jukebox.

Link to comment
Share on other sites

4 hours ago, Whalekit said:

Why do you think so? All you need for that is Lua code in the jukebox.

Lua is not SQL or PHP. It's limited to its library - whivh by default consists only of ANSI C. Unless NQ adds a library for making playlists happen, you better input every song manually in HTML and don't really expect autoplay like on youtube.

 

 

Cheers.

Link to comment
Share on other sites

53 minutes ago, CaptainTwerkmotor said:

Lua is not SQL or PHP. It's limited to its library - whivh by default consists only of ANSI C. Unless NQ adds a library for making playlists happen, you better input every song manually in HTML and don't really expect autoplay like on youtube.

In the first post here I described sound device and it's API allows you to create music entirely in game, with just it and some scripting. Using it's API you can create audio player program, with tracks, playlists, and all of that. No need for any external databases or servers - all just using sound device (for playing music) and display (for audio player GUI) connected to Distibuted Processing Unit with right Lua script in it.

Link to comment
Share on other sites

24 minutes ago, Whalekit said:

In the first post here I described sound device and it's API allows you to create music entirely in game, with just it and some scripting. Using it's API you can create audio player program, with tracks, playlists, and all of that. No need for any external databases or servers - all just using sound device (for playing music) and display (for audio player GUI) connected to Distibuted Processing Unit with right Lua script in it.

https://www.w3schools.com/html/html5_audio.asp

 

That was the HTML5 part.

This is its DOM :


https://www.w3schools.com/tags/ref_av_dom.asp

 

So, unless NovaQuark turns Lua into Javascript - cause they won't allow players to use javascripts for certain - I can't see your thing happening without actually treating an object like a Jukebox, pressing a button, playign a song, then pressing another button, to play another song.

 

You can't just "will" Lua to do what you want it to do, it has its limits.

Link to comment
Share on other sites

3 hours ago, CaptainTwerkmotor said:

That was the HTML5 part.

I am not talking about using HTML (or any other web technology) to play audio in any way. I don't know what gave you idea that I do.

 

I am suggesting to add an element - sound device - that can be connected to control unit, just like some engine, or door, or lamp or etc.

And just like other elements it has actions - in it's case they are not to turn light on and off, but to read/write it internal audio memory, play sounds on it's channels, etc. 

By populating sound memory of sound device with samples and then consecutively calling actions (probably using system timer event) to change pitch, sound source (sample from auio memory or oscillator), filters of a channels and play theese samples on them it you can play music. So, as you can see, no need for html5 or web audio api or anything like that to play music.

3 hours ago, CaptainTwerkmotor said:

You can't just "will" Lua to do what you want it to do, it has its limits.

This does not require any change in Lua, besides exposing sound device's "actions"/functions into it, just like actions of ligh (such as activate, deactivate, toggle) are exposed. It's just new element with actions, which can be called from Lua, that is capable of playing sound . (light.activate() switches on the light, soundDevice.channel_start_note(1) plays sound (which you previously set channel 1 at).) Nothing that is undoable with Lua, after having just this element (sound device) and it's actions available from Lua script of control unit.

 

 

Have I explained my idea clearly now? I really tried, maybe too hard, but I don't know what is eactly not clear in my previous messages, so I tried to clarify everything.

Link to comment
Share on other sites

43 minutes ago, Whalekit said:

I am not talking about using HTML (or any other web technology) to play audio in any way. I don't know what gave you idea that I do.

 

I am suggesting to add an element - sound device - that can be connected to control unit, just like some engine, or door, or lamp or etc.

And just like other elements it has actions - in it's case they are not to turn light on and off, but to read/write it internal audio memory, play sounds on it's channels, etc. 

By populating sound memory of sound device with samples and then consecutively calling actions (probably using system timer event) to change pitch, sound source (sample from auio memory or oscillator), filters of a channels and play theese samples on them it you can play music. So, as you can see, no need for html5 or web audio api or anything like that to play music.

This does not require any change in Lua, besides exposing sound device's "actions"/functions into it, just like actions of ligh (such as activate, deactivate, toggle) are exposed. It's just new element with actions, which can be called from Lua, that is capable of playing sound . (light.activate() switches on the light, soundDevice.channel_start_note(1) plays sound (which you previously set channel 1 at).) Nothing that is undoable with Lua, after having just this element (sound device) and it's actions available from Lua script of control unit.

 

 

Have I explained my idea clearly now? I really tried, maybe too hard, but I don't know what is eactly not clear in my previous messages, so I tried to clarify everything.

You previous described a jukebox, now you describe a synthesizer. Those two things are not the same.- even if you can save a sequence to be played on a synth as a sample.

And again, Lua is limited to its library and the methods that the developers allow for you to use it with. Even if they were to add predefined 8-bit music notes, sound editing would be off the books, cause the would not want trolls to make White Noise generators that would make it a hell-hole of a game.

What you ask for, is a synthesizer. And, on top of that, you ask NQ to save up songs you make on their servers - which is where the "SPU memory " is located at, theirr servers.

See why they went with HTML5 now? HTML5 works with urls, NQ only has to stream the song onto a screen or possible speakers, they don't got the save anything on their servers.

In-fact, you can download a midi-keyboard,  make a song, upload it on G-Drive and copy paste its URL into the game on a screen.

Link to comment
Share on other sites

55 minutes ago, CaptainTwerkmotor said:

You previous described a jukebox, now you describe a synthesizer. Those two things are not the same.- even if you can save a sequence to be played on a synth as a sample.

It was inspired more by old sound cards, like this one, but eah, you can call it a synthesizer.

Actually, what I was saying is that you can build jukebox with this thing and some control unit.

 

2 hours ago, CaptainTwerkmotor said:

And again, Lua is limited to its library and the methods that the developers allow for you to use it with.

It's enought to send commands to the devices - that what is important. You could also use it to populate sound memory with procedurally generated sound, though that would requre doing it in many little steps using system clock (one continuous script that would try to put thousands of values would run out of time).

 

1 hour ago, CaptainTwerkmotor said:

Even if they were to add predefined 8-bit music notes, sound editing would be off the books, cause the would not want trolls to make White Noise generators that would make it a hell-hole of a game.

Sound editing should not be off-the book - it's essential. And audiotrolling can also be used through the voice chat and html5 music - and just as easily solved - by muting the source using game menu.

The entire point of having audio memory is to be able to use your own samples and not predetermined ones, which expands creator's possibilities greately.

 

1 hour ago, CaptainTwerkmotor said:

What you ask for, is a synthesizer. And, on top of that, you ask NQ to save up songs you make on their servers - which is where the "SPU memory " is located at, theirr servers.

this synthesizer is simple and requires very little CPU (less than 1% of my 8-years old CPU).

Now, about memory:

In my example I said that audio device has 44100*8 bytes. That is 345 kilobytes. For the reference - 2 images in first post have size of 271 KB, and are on the NQ servers. Dropbox free account allows you to to store up to 2 GB of data on it's servers.

In the game, to create sound device you will need resources and not every player wil create unique sound devices - most of them buy/create using blueprint a copy from a musician and never edit it, so you can do copy-on-write optimization (have 2 or more sound devices share the same physical server memory until one of them changed).

But even if each player created 100 unique sound devices (and the wouldn't, because that's just waste of resources) with 400 kylobytes of audio memory it would be just 40MB per player. I think game with monthly subscription fee can afford to store 40MB of data per player. But even if players will be creating sound devices uncotrollably, like 100 unique sound devices per month, taking up more and more server space - NQ can make it so, that after some time without energy/maintaining memory of sound device is wiped and thus server space is freed. (But that is neither going to happen, speaking realistically)

So, as you can see, server space is not a concern here. In fact, one of the main reasons I suggested this concept is because it's so compact - you only store instrument's samples and sequencing data for music.

Having said all that I now think players can have sound devices with entire 2 MB of audio memory in them - but for higher resource cost ofc - that would be just enought for almost any track.

 

4 hours ago, CaptainTwerkmotor said:

See why they went with HTML5 now? HTML5 works with urls, NQ only has to stream the song onto a screen or possible speakers

Is there official confirmation that you will be able to embed frames and data from The Internet into the in-game displays? That sound interesting, but I never heard of that.

 

 

BTW, do I understand correctly, that with HTML5 you can only cover playing single static music track. Not even editing playlists. What about sound effects for your Lua application or game? 

My suggested thing covers not just the case of playing static music - it also allows you to create Lua game or program with sound effects, jukeboxes where players can queue tracks they want, etc. It gives you so much control, that you can even make dynamic music (like you can hear in some game soundtracks). And all that right in the game, programable with Lua.

Link to comment
Share on other sites

1 hour ago, Whalekit said:

It was inspired more by old sound cards, like this one, but eah, you can call it a synthesizer.

Actually, what I was saying is that you can build jukebox with this thing and some control unit.

 

It's enought to send commands to the devices - that what is important. You could also use it to populate sound memory with procedurally generated sound, though that would requre doing it in many little steps using system clock (one continuous script that would try to put thousands of values would run out of time).

 

Sound editing should not be off-the book - it's essential. And audiotrolling can also be used through the voice chat and html5 music - and just as easily solved - by muting the source using game menu.

The entire point of having audio memory is to be able to use your own samples and not predetermined ones, which expands creator's possibilities greately.

 

this synthesizer is simple and requires very little CPU (less than 1% of my 8-years old CPU).

Now, about memory:

In my example I said that audio device has 44100*8 bytes. That is 345 kilobytes. For the reference - 2 images in first post have size of 271 KB, and are on the NQ servers. Dropbox free account allows you to to store up to 2 GB of data on it's servers.

In the game, to create sound device you will need resources and not every player wil create unique sound devices - most of them buy/create using blueprint a copy from a musician and never edit it, so you can do copy-on-write optimization (have 2 or more sound devices share the same physical server memory until one of them changed).

But even if each player created 100 unique sound devices (and the wouldn't, because that's just waste of resources) with 400 kylobytes of audio memory it would be just 40MB per player. I think game with monthly subscription fee can afford to store 40MB of data per player. But even if players will be creating sound devices uncotrollably, like 100 unique sound devices per month, taking up more and more server space - NQ can make it so, that after some time without energy/maintaining memory of sound device is wiped and thus server space is freed. (But that is neither going to happen, speaking realistically)

So, as you can see, server space is not a concern here. In fact, one of the main reasons I suggested this concept is because it's so compact - you only store instrument's samples and sequencing data for music.

Having said all that I now think players can have sound devices with entire 2 MB of audio memory in them - but for higher resource cost ofc - that would be just enought for almost any track.

 

Is there official confirmation that you will be able to embed frames and data from The Internet into the in-game displays? That sound interesting, but I never heard of that.

 

 

BTW, do I understand correctly, that with HTML5 you can only cover playing single static music track. Not even editing playlists. What about sound effects for your Lua application or game? 

My suggested thing covers not just the case of playing static music - it also allows you to create Lua game or program with sound effects, jukeboxes where players can queue tracks they want, etc. It gives you so much control, that you can even make dynamic music (like you can hear in some game soundtracks). And all that right in the game, programable with Lua.

1) Synthesizers are the predeccessors to Midi Keyboards.

2) Jukeboxes are easy to make. And again, without the proper library, Lua is not able to do anything - that goes for any language / script.If NQ implements SOME of the Lua libraries available for Front-End Lua scripts, the same effect as that of JS for playli9sts and the such can be achieved in the DOM.

3) Sound Editing is not essential. Good physics, no broken netcode, Customer Service, developmenet, those are essentia;l. Sound eiditing is something you can do off the game and import it via HTML - which again, them sound units in-game would simply use the Audio element from HTML, cause it's easy and it's something they foresaw, that's why they went with CoherentGT for their in-game dispalys.

4) You assume you'll be the only one using the Sound Unit. 10000 players, with 271KB stored, that's 2.7 GB. And that's assuming only 1 SPU per person. Or people who just want to troll.


There is no reason to reinvent the wheel in DU when it comes to making music, you can make music offline and you can have Lua in-game have a Media library for the Media in HTML. Only thing missing then, is you calling the stored song and playing via stream - which is how it's done for obvious reasons.

Sure, NQ can even add a "serverClock()" function for people to synchronise the radio across the whole server - yes, there is such a thing as 24hours playlist science :P, math can solve any problem.

But no matter what, NQ would be shooting themselves on the foot if they were to allow people to make CANCER nosies, like Brownian sounds or White Noises to annoy people. 

I'd much rather have them optimise CPU usage for VoIP.

VoIP > In-game Synthesisers :P 

Link to comment
Share on other sites

21 hours ago, CaptainTwerkmotor said:

1) Synthesizers are the predeccessors to Midi Keyboards.

I wasn't talking about midi keyboards. Why are you bringing them up? I was talking about sound cards for computers, that allowed them to play sound effects and tracker music (which was created without midi keyboards).

I think sound card/SPU is better name for what I'm suggesting here than synthetyzer, because when you say "synthesizer" people usually think about something, that is connected to keyboard (including embeded one) and you which should play on and SPU is a thing that controlled programmatically, with commands sent from the code.

21 hours ago, CaptainTwerkmotor said:

2) Jukeboxes are easy to make. And again, without the proper library, Lua is not able to do anything - that goes for any language / script.If NQ implements SOME of the Lua libraries available for Front-End Lua scripts, the same effect as that of JS for playli9sts and the such can be achieved in the DOM.

With sound device, system clock and built-in functions (not even standart library needed), Lua can do that, no problem. And if you think there is some problem I'm missing, that won't allow me to create jukebox with sound device and Lua, please elaborate, what is exactly the limitation you're talking about.

But you right about the fact that with "sound emeded in html5 screen" approach you can't do much through Lua scripting.

 

21 hours ago, CaptainTwerkmotor said:

4) You assume you'll be the only one using the Sound Unit. 10000 players, with 271KB stored, that's 2.7 GB. And that's assuming only 1 SPU per person. Or people who just want to troll.

I do not. I assume low tier sound devices with little to no sound memory will be used by about all lua scripters to add sound effects in theyr applications and hight tier (with more channels and sound memory) will be used by composers to create music. And also everyone else will be using them, not as a developers, but as a user of applications of Lua scripters and listeners of music. Since they are not likely to change anything after buying (building from a blueprint) a copy of thing made by scripter/composer, you can employ copy-on-write opimisation - so all audio devices that are copies of one, and have same audio memory content will have it stored in the shared physical space on the server (for example, if you've got 1000 (or any number) 1MB audio devices with same audio memory content (because they were created using the same blueprint and wasn't changed after creation), they all take just 1 MB space on NQ servers).

 

If you are serious about storage size - look... Say, each player has created (let's crank it up all the way to eleven) 1000 sound devices with 1MB of sound memory in it and each is unique (so you can't do copy-on-write optimisation i described above). Let's say monthly subscription fee is 10$. So, you've got 1 GB per player. Now, lets see here, here and here. As you can see, storing data have a price of 2.6-1.8 cents per GB per month in frequent-acces/hot storage and 0.7-0.2 cents for rarely-access/cold storage.  So, if a player somehow uses all his 1000 sound devices on a regular basis, storing their audio data will cost 2.6 cents at worst and if player puts them in the container and never uses again, you can move their audio data to cold storage, making cost of keeping them 0.7 cents at worst (and if you also compress it with FLAC, you will get at least 20% compression, making it 0.6 cents). 3 cents from 10$. As you can see, game with monthly subscription fee can afford storing a bit of audio data easily. Storage space is cheap, that is why you can upload pictures on this forum, that is why dropbox gives you 2 GB of storage for free for indefinite amount of time.

And that was a worst-case scenaario - in reality players won't be creating 1000 of those things each, because that is waste of resources and money since not every player is scripter/composer. And most of sound devices will be copies, so you can do copy-on-write optimization. Also, old ones are likely to be reused, instead of piling up, but if they are not, you can make it so theyr memory gets wiped (freeing space os servers) after few month without using them or something, solving the issue of audio data piling up with time.

So, storage space is not a problem.

 

21 hours ago, CaptainTwerkmotor said:

There is no reason to reinvent the wheel in DU when it comes to making music, you can make music offline and you can have Lua in-game have a Media library for the Media in HTML.

There is no reasons to reinvent the wheel when it comes to ship building - You can make 3d models of you construct offline and import them into the game and have special device print it. Also, There is no reasons to reinvent the wheel when it comes to scripting - you can put script on your web server and have it connect to NQ servers and use NQ web API co control in-game constructs. So you don't need to store Lua code on NQ servers and no need to run theese scripts on game clients. The more of the game is outside of the game the better! /S 

 

21 hours ago, CaptainTwerkmotor said:

which is how it's done for obvious reasons.

Could you link me to the official source that states that this is how it's done in the game, please? Or it just your guess?

 

21 hours ago, CaptainTwerkmotor said:

But no matter what, NQ would be shooting themselves on the foot if they were to allow people to make CANCER nosies, like Brownian sounds or White Noises to annoy people. 

You do know you can also play CANCER noises with HTML5 based player, right? Using the same reasoning one could also say that there shouldn't be voice chat - someone could transmit annoying sound through it. But, as I already said, this is not a problem in any of the cases, becase you can give player an option to mute person who is making annoying noises through the VoIP, mute device that has HTML element that plays annuying sound and mute audio device that is making annoying sound.

 

21 hours ago, CaptainTwerkmotor said:

VoIP > In-game Synthesisers

sorry what? VoIP is a thing you use to talk to players, and sound devices I'm suggesting to add is a thing you can use to create sound effects to Lua applications and in-game music creation&playing.

 

 

Your idea seems to be: in order to play a sound you need to call screen.setRawHTML/setContent, and pass the something like 

<audio src="URL/of/sound.ogg" autoplay=true> </audio>

as "HTML"  argument. That gives you ability to start playing sound. You can also probably stop it by calling screen.deleteContent(id of this html elelment) (see lua tutorial video for screen functions).

But it won't let you pause and resume sound, rewind or change it's volume from Lua, you can't get notified when it sound ends, you can't even be sure it's playing - for some players it might be loading while it's already playinig for other players because each game client loads it by itself from the internet. If you want to play several sounds consecutevly (i.e. multiple songs from playlist), you could start first sound, and then stop it and to start next after (duration of first sound) seconds, BUT because first sound might have started later because of it took few seconds to load after you put "audio" html element on the screen, it should have ended later - but your program don't know that, so it stops sound abruptly aerlier than it should have ended. So, you can have jukebox, but it has problems.

In summary: you can start sound, but you can't conltol it's playback, you have no information about playback, and your ability to parametrize it limited to it's URL and this lack. Also, it exists completely outside of the game, somewhere in the internet. Your suggested approach is better than nothing, but is very limited.

 

My approach, in the other hand, gives programmer a lot of control over sound right in the game - for example, I think you could easily create even primitive TTS with sound device, by populating it's audio memory with phones and and playing them consecutively. And task of creating audio player with playlist/compositions queue aka jukebox is trivial.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...