(i had to repost this cuz it was burried in the algorithim or smth)
it sounds scary, but hear me out!
This new feature would add a new service,
game:GetService("DeviceInfoService")
this would add all sorts of “SAFE” device features (by safe i mean, cant be used to hack or doxx users,
All features that have to do with devices will be here! Even existing ones could be put here to make a more generalized and consistent area to appropriately fetch all device info
for example. Checking for battery percentage
could be used for,
- optimizing games to save battery like, making Graphix lower
- have special badges and events depending on your battery.
- making a visible battery counter on a GUI so you can actually see your battery in game on mobile (or you could just add that in)
how you would actually retrieve that info! / events
local deviceBattery = game:GetService("DeviceInfoService"):GetDeviceBatteryPercentage()
game:GetService("DeviceInfoService"):AttachBatteryPercentScript([battery percent], [function name])
another example, checking what device the player is actually on
this is way better then defining device from input method due to computers that have both keyboard input and screen touch input (chrome book
)
it could be fetched with:
local currDevice = game:GetService("DeviceInfoService"):GetDeviceType()
it either could return a string ex:
"phone"
"computer"
"console"
or it could return numbers, it would only use 4 bits MAX so its not expensive at all:
0 --phone
1 -- computer
2 -- console
3 -- another device in the future?
with the phone checks we could check the device’s rotation!
it would be checked with this code:
local phoneRotation = game:GetService("DeviceInfoService"):GetPhoneRotation()
game:GetService("DeviceInfoService"):AttachPhoneRotationScript([vector 3 value], [function name])
this could be used for gravity based on phones orientation,
like if there’s a ball that you want to fall towards the gravity in REAL LIFE it would fall to where the ground is in real life (really cool) and maybe make the client’s gravity or make workspace gravity physics/water physics or whatever
we could also have a native FPS counter!
it could be fetched with:
local deviceFPS = game:GetService("DeviceInfoService"):GetDeviceFPS()
this would be a straight forward way to detect FPS!
we could also add midframe interrupts,
for the roblox engine programmers, you could use the device’s refresh rate to calculate an estimate to which (whatever is a modern version of a scanline called) the device is in!
this could be used to make waving water effect while saving on data by not having to make multiple frames by changing the position of the image midframe!
here’s where you would fetch that info!
game:GetService("DeviceInfoService"):AttachEventToScanlinePositionAsync([scanlineNumb], [event name])
it could also be used for some INSANE and cool effects like:
- desert heat effects
- water waves
- make parts of the screen display different things/locations on the world map without using these pesky 3d Ui frames
- make a screen shaking effect
- and aid on games that emulate retro consoles (very cool)
we could also have a way to detect general (none harmful) device information! to make cool “Device inspection” games to see your specs or something like that.
This type of thing would bring more people to roblox by being able to easily watch ur device specs by using specific games.
HERE IS ALL OF THE CODE IN ACTION
local client = game.Players.LocalPlayer
local dIS = game:GetService("DeviceInfoService")
local frame = script.parent.splitImgExample
local fpsTxt = script.parent.fpsLabel
local rotateWarn = script.parent.fpsLabel
local badgeServ = game:GetService("BadgeService")
local optMod = require(game.ReplicatedStorage.OptimizationModule)
local loadDeviceInfEvent = game.ReplicatedStorage.UpdtDeviceForOthers
local devLabel = script.Parent.DeviceLabel
function uiPosShift(scan)
if scan == 0 then
frame.Position = uimd2.new(0,0,0,0)
else
frame.Position = uimd2.new(0,0,0,100)
end
end
function rotateWarn ()
rotateWarn.Visible = true
wait(3)
rotateWarn.Visible = false
end
function batterySixSeven ()
badgeServ:AwardBadgeAsync(client.UserId,2139141313) -- random badge
end
dIS:AttachEventToScanlinePositionAsync(0,uiPosShift(0))
dIS:AttachEventToScanlinePositionAsync(100,uiPosShift(100))
dIS:AttachScriptToPhoneRotation(vector3.new(0,100,0),rotateWarn())
dIS:AttachFunctonToBatteryPercent(67,batterySixSeven())
if dIS:GetDeviceBatteryPercentage() <= 20 then
optMod.OptimizeForLowPower()
end
local deviceIndx = {
"Phone",
"Computer",
"Console",
}
devLabel.Text = deviceIndx[dIS:GetDeviceType()]
loadDeviceInfEvent:FireServer(dIS:GetDeviceType())