Hey, i wonder if you can make the output of the display using NPC, lol
idk just for fun? like in this video
Hey, i wonder if you can make the output of the display using NPC, lol
idk just for fun? like in this video
then why roblox moderate my anime girl instead the anime boy isnât moderated
Iâm slowly getting there https://gyazo.com/37fb4f7f3fdd50fb49688eac25726332
This uses a web server tho so it might be a little more difficult to setup.
ayyyy niceeee
I donât mind how hard is it to set up as long I learn new thing with this, then it going to be good
Update! Iâve managed to encode an entire video without uploading each frame/image into roblox itself.
Hereâs an example:
It isnât exactly synced, but there is an option to do so.
Keep in mind that this only works locally. This means that this project can only run in roblox studio, not the roblox player. Roblox has a HTTP get request limitation that Iâve not found a way around. Please inform me of any other way I can get past this. (Other than sending requests in chunks and enforcing a cooldown).
Anyways, onto the setup.
Things you need:
Get the code and roblox place file from this GitHub repository. In it, you should find a folder named âResourcesâ.
Any Integrated Development Environment (IDE). I use Visual Studio.
Install the Flask python library
Setup:
Open up the âResourcesâ folder with your IDE
Place the video (.mp4) you want to encode into the âVideosâ folder
Create an empty text (.txt) file in the âPixelDataâ folder and name it whatever you want. Iâd suggest naming it somthing similar or the same as the video title for convenience.
In the âPixelDataEncoderâ python file (.py), you should find this line of code near the bottom.
There are 3 commas separating the 4 information/arguments that you need to input into here.
Arguments:
i) Video file location, just change âBadAppleâ to whatever you named your video.
ii) Resolution multiplier. Values less than 1 will decrease the resolution while values more than 1 will cause unnecessary lag. Stick to values 1 and below which is a positive number.
iii) Frames Per Second. Pretty self explanatory. You can check your videoâs frame per second by right clicking the .mp4 file in your file explorer, selecting âPropertiesâ and going to the âDetailsâ tab.
iv) Colour. Put âTrueâ if youâd like your video in colour and âFalseâ if youâd like it to be a grey scale. File sizes with grey scale will be smaller (Remember this option).
Find this line of code and change it to the location of the empty text file youâve created.
If all inputs are properly inserted, run the code and this should pop up.
Ensure that âEncryption Completedâ pops up before closing the console. Otherwise, the encoded data will not save.
IMPORTANT NOTE: DO NOT OPEN THE TEXT FILE, YOU WILL FREEZE OR MAYBE EVEN CRASH YOUR IDE. You can try to, but thatâs your call.You have now encoded your video into pixels. Weâll work on the web server next.
- Open up the python file named âWebServerâ.
Find this line and change the file path to your encoded text fileâs path. After changing, run the code and leave it running whenever you need to play a video. (Remember, this version only runs locally. This means that itâll only work if the web server and roblox is using the same IP address)(I might be wrong)
The web server should be done. Finally, letâs set everything up in roblox studio.
- In the roblox place file (.rbxl), open up the data module script which is at âServerScriptServiceâ > âFilmHandlerPixelsâ > âPixelFilmDataâ.
Find this section of code, change the configurations accordingly.
Things to note:
i) Remember what you put for âTitleâ as the code will use this to find the correct set of data.
ii) If you have disabled colour during the encoding process in python, you should disable it here too.
iii) If you have a sound id, âFPSâ is not required and vice versa. Put SoundId as nil if you do not have a sound id. The FPS option didnât work properly the last time I tested it, but who knows what will happen. Using a sound id is the preferred method.
iv) PlaybackSpeed will affect the playback speed of the entire video (audio and display).
v) A positive sound offset will drag the audio (play it later), while a negative sound offset will play the audio ahead (play it earlier). This is in seconds.
Open up the âFilmHandlerPixelsâ script, scroll all the way down and find this line
There are 2 arguments for you to configure here.
Arguments:
i) Film title. This is the same âTitleâ youâve inserted into the module script.
ii) Monitor name. This can be found in a folder named âMonitorsâ under workspace. Change the name if you wish.
Run roblox studio. Give it some time to get and decode the data. The output should look like this.
External Credits
Web Server Code by @WhosThatGuy_Guys
After all that, everything should be good to go! Feel free to let me know if anything is missing or if you have any questions.
Iâve tried using replit to host the code online and UptimeRobot to ping replit every few minutes to keep it running. But robloxâs request limit is still an issue sooooo
Iâve decided to move on from Roblox and Roblox development. It has been a fun few years and this platform has really shaped me into who I am today. Iâll definitely come back someday, just not anytime soon. Iâll still be active on the dev forums tho. Really, thank you all for being so supportive!
This is not going to be performant at all (trust me, Iâve made a roblox screenshare which runs at a whopping 128x72 2fps. Any higher resolution and your ping skyrockets to 200k)
Still cool though!
Though if it only works locally anyway you should probably use Pillow and pythoncv and import rbxtemp images, that would make this more performant and give it a higher resolution.
it CAN be performant if you make it binary, which is what i did and it can run fast enough
the biggest problem right now is updating pixels without lag
ping is also very stable
i also capped fps to 8 because of the request limit, but i thought of a solution (will add soon)
Updating pixels without lag was my problem too.
Though I do wonder - howâd you make it pure binary? From what I know Roblox requests only parse text
no thats a lie, it can return bytes too (they are all on a string)
get them with string.byte
itâs possible to run on client (gui) ? (using image methode)
It should be possible, you just have to change the surface gui to a screen gui, and youâll have to make some (or all) aspects local.
Can you please teach me how using binary can be done? Iâve done a lot of research and tried to implement it in a lot of ways but Iâm not sure how.
to be honest that deserves a tutorial on its own but here are the basics
so you probably know that a bit is either 0 or 1
now imagine you got 8 bits which are 256 possible combinations (2^8 = 256)
you can convert these 8 bits into an integer depending on which combination itâs on
an integer is a number that cannot have decimals (for example 0.5 are impossible for integers)
there are unsigned and signed integers:
so an unsigned 8-bit integer will range from 0 to 255 (notice how there are 256 combinations and they are used to make numbers)
and a signed 8-bit integer will range from -128 to 127
now that you know all of that lets make a script
bytes in lua are stored in strings
there are 2 functions in lua that are very useful for these things
string.byte and string.char
basically string.char will convert any number ranging from 0 to 255 into an unsigned 8-bit integer
and string.byte will retrieve unsigned 8-bit integer(s) from a string
EXAMPLE
in this script i will convert a number (which will be 214) into an unsigned 8-bit integer
and then i will retrieve the number from the integer
local uint8=string.char(214); -- uint8 is short for unsigned 8-bit integer
print(type(uint8)) -- it is indeed a string and 214 is stored in there as an unsigned 8-bit integer
local fromUInt8=string.byte(uint8); -- retrieving the number from the string (which contains an uint8)
print(fromUInt8); -- 214
for now im too lazy to continue typing this but i might do it soon (or never)
are the pixels pre-set or do they get set every frame?
They get set every frame. I was thought that Iâd be too laggy to have more than one set of pixels.
i was able to get 60fps on my 200x200 rasterizer by when creating the frames saving their instance in a table and updating it from there. itâs important not to do some string search up as it would make it drastically slower.
how?
ive done everything i could to optimize my code yet the game still runs low on fps for resolutions higher than 240x135
just by removing this line the game runs at 60 fps (even on high resolutions)
pixel.Color=rgb(R,G,B)
i told him how in my reply, you reference it in a table on start up. how do you reference pixel
i have already done that
all the pixels are in an array
this is how it loops
for i,pixel in ipairs(pixels) do