Status update on this thing: With ComputerCraftEdu out of the way, my current focus is on finishing the Steam release of Redirection. When that is done, this new project gets 100% of my attention />/>
Redirection has been released, and another grain of sand fell.
The hype is real!
I've just finished documenting the Robot Arcade part of Redirection, which as you probably know my now, serves as a preview of the CraftOS 2.0 project: http://steamcommunit...s/?id=788101089
I can't think of any reason not to use the GPU for rendering, but yes: one gpu.drawImage call is much faster than hundreds of gpu.drawPixel calls. Calling image:write with a string argument is the faster way to upload pixels into an image en masse also.
Edit by Dan: **snip** Please don't reverse engineer or decompile my code. Redirection is a commercial game, and the code is copyrighted. I don't mind you documenting the undocumented Lua APIs, but recompiling my code or creating other code that links to it crosses a line. I put a lot of trust in the community by deciding not to obfuscate the code, please don't make me regret this.
Technical Details
Changes
`fs.open` is the same as `io.open`.
Binary file handles are now equivalent to normal ones, just without corruption of non-UTF-8 data.
Entirely new graphics system.
Sound support.
Memory limit, set at 1MB (not 1MiB) in the arcade, this applies to Lua and any native objects you create such as images or palettes.
Now using Lua 5.3.
All standard Lua APIs are available and unchanged.
getPowerStatus() : string, int - `powerStatus, chargeLevel`, `powerStatus` is either `'unpowered'`, `'charged'`, `'charging'`, `'discharging'` or `'fixed'`
newImage(width, height : int, fill : int = 0) : image
loadTGA(str : string) : image, palette?
loadTGA(handle : handle) : image, palette?
saveTGA(img : image, pal : palette) : string
saveTGA(img : image, pal : palette, handle : handle)
setTarget(target : image?)
getTarget() : image?
getTargetSize() : int, int
getTargetWidth() : int
getTargetHeight() : int
setColorMapping(map : {[int] = int})
setColorMapping(key, val : int)
getColorMapping() : [int]
getColorMapping(color : int) : int
resetColorMapping()
resetColorMapping(color : int)
setTransparentColor(color : int?)
getTransparentColor() : int?
setOffset(x, y : int)
getOffset() : int, int
getPixel(x, y : int) : int
newPalette(size : int) : palette
reset()
Class: Image
blit(x, y : int, img : image) - blit `img` onto `self` at `(x, y)`
copy() : image
fill(color : int)
fill(color, x, y, width, height : int)
flipX()
flipY()
getSize() : int
getHeight() : int
getWidth() : int
read(x, y : int) : int
read(x, y, length : int) : string
write(x, y, colour : int)
write(x, y : int, value : string)
replace(find, replace : int)
rotate90()
rotate180()
rotate270()
sub(x, y, width, height : int) : image
translate(x, y : int, fill : int = 0)
Class: Font
getCharacterImage(chars : string) : image*
getCharacters() : string
getImage() : image
measureText(text : string) : int, int
Class: Palette
These are only used for TGA loading/saving currently, though `DisplayDevice` has some fields for it, there aren't any Lua methods for accessing it.
copy() : palette
getSize() : int
getColor(index : int) : float, float, float
setColor(index : int, color : string) - set from a hex color (e.g. #F2B2CC)
setColor(index : int, r, g, b : float)
Device: Hard Drive
getMount() : mount
getCapacity() : int
Device: Disk Drive
eject()
getMount() : mount?
hasDisk() : bool
Device: Lua CPU
getROM() : mount
boot(path : string) - this errors if the CPU is already booted
getStatus() : string - `'halted'` or `'running'`
halt() - this errors is the CPU is already halted
It might be possible to use `boot` and `halt` to boot an arbitrary file:
cpu.halt()
cpu.boot('whatever.lua')
Device: Speaker
getChannelState(chan : int) : string - `'playing'` or `'stopped'`
getNumChannels() : int
play(sound : sound, chan : int?)
queue(sound : sound, chan : int)
stop() - stop all channels
stop(chan : int)
Sound:
waveform : string = 'square'
volume : float = 1
duration : float
attack : float = 0
decay : float = 0
frequency : float
slide : float = 0
vibrato_depth : float = 0
vibrato_frequency : float = 0
loop : bool = true
oeed, on 28 October 2016 - 04:20 AM, said:
Awesome!
For things like Silica which will need to manually draw their pixels, rather than using the GPU, what is the fastest way to draw the entire screen?
Is using drawImage faster than repeatedly calling drawPixel, or does drawImage just call drawPixel itself (like paintuils)?
Canvas/Image/Mask should probably be reimplemented using images, from a quick look through master I can think of ways of implementing everything efficiently.
dan200, on 27 October 2016 - 11:50 PM, said:
Hey all,
I've just finished documenting the Robot Arcade part of Redirection, which as you probably know my now, serves as a preview of the CraftOS 2.0 project: http://steamcommunit...s/?id=788101089
There have already been several Arcade games posted to the workshop, on top of the 3 built into the game: http://steamcommunit...5D=Arcade+Games
If you want to get in on the action, Redirection is currently 15% off on Steam />/>/> http://store.steampo....com/app/305760
On top of the CraftOS 2.0 preview, you also get a great puzzle game with 100% positive Steam reviews, and help me to pay my rent />/>/>
There are quite a few methods missing from the guide, is that intentional?
I can't really see any benefit to the UTF-8 file modes, they just parse as UTF-8 then convert back to an array of bytes which just corrupts non-UTF-8 data.
I also found at least one bug I can remember right now: in `Image.Fill` `x + height` is compared to `Height`, that should be `y + height`.
I take it that's memory, not storage. Could be a fun challenge, the Luo compiler is definitely surpassing 2MB at the moment...
Quote
Now using Lua 5.3.
rip jit
Quote
getModifiedTime, getNameWithoutExtension, mount
Awwww yeahhhhhhh!
Quote
getPowerStatus() : string, int - `powerStatus, chargeLevel`, `powerStatus` is either `'unpowered'`, `'charged'`, `'charging'`, `'discharging'` or `'fixed'`
Interesting... seems to hint that Dan has some cool plans for the future!
Quote
getTime() : float - time as seconds since 12:00:00 January 1 0001 (0001-01-01T12:00:00.00) resetTime() - reset the time to UTC
Glad to see we have access to the real world time now, can you explain what is meant by resetTime though? There doesn't seem to be anything to set it. Can you change the timezone?
Interested to see what's possible with the speaker. I haven't done much stuff with sound, but I take it that it's fairly basic?
getTime() : float - time as seconds since 12:00:00 January 1 0001 (0001-01-01T12:00:00.00) resetTime() - reset the time to UTC
Glad to see we have access to the real world time now, can you explain what is meant by resetTime though? There doesn't seem to be anything to set it. Can you change the timezone?
Right below `resetTime` is `setTime`.
oeed, on 28 October 2016 - 08:42 PM, said:
Interested to see what's possible with the speaker. I haven't done much stuff with sound, but I take it that it's fairly basic?
So with this Arcade mode, are there any restrictions with it as opposed to standard ComputerCraft, or can you make anything with it? (ie missing features, such as maybe certain inputs)
If this is basically CraftOS 2.0 unrestricted within Redirection I'm definitely interested in it.
This is merely a preview of CraftOS2.0, intended for the creation of minigames. The display is 64x64 and monochrome (text characters take 4x6px each, including padding). Keyboard input seems to be limited to arrows + Z + X. I don't believe mouse input is accepted. io.open() throws access denied errors when attempting to use write mode, though there's a scoreboard API (that Dan hasn't documented for whatever reason) which can be used to retain a high score between loads.
It isn't event-driven in the manner ComputerCraft is. I'm quite tempted to create a compatibility layer to replicate that old behaviour.
It offers sound (nothing too complex), and a few nifty drawing functions. You can load a picture file and render it where ever you like for eg. Another undocumented function, gpu.setTransparentColor(), is handy for this.
I was able to port across a stripped-down version of my old Tetris script with minimal effort. Debugging can be a little tricky at times, though, given that it often omits line numbers from its errors - though manually adding breakpoints into a script isn't "hard", per se, simply annoying.
ALREADY someone has posted an "OS" for it. It has four menu options - half of them are redundant and the other half non-functional.
It isn't event-driven in the manner ComputerCraft is. I'm quite tempted to create a compatibility layer to replicate that old behaviour.
It is, `system.sleep` is implemented as:
function system.sleep( nSeconds )
expect( nSeconds, "number", 1 )
local clock = system_getDevice( "clock" )
if not clock then
error( "No clock present" )
end
local nTimer = clock.startTimer( nSeconds )
while true do
local sEvent, p1 = system_pullEvent( "timer" )
if p1 == nTimer then
break
end
end
end
Yeah they're a few bugs in there (at least, last I checked). Some of them are caused by incorrect calls on your part and really just need a better error message attached to them, others are a bit more dubious. Having some of the drawing functions attempt to plot stuff outside of the visible area can sometimes crash Redirection completely for eg.
Yeah they're a few bugs in there (at least, last I checked). Some of them are caused by incorrect calls on your part and really just need a better error message attached to them, others are a bit more dubious. Having some of the drawing functions attempt to plot stuff outside of the visible area can sometimes crash Redirection completely for eg.
Hey all! Can you report all instances of calls which crash Redirection, causes a C# stacktrace to be printed, or otherwise error when they shouldn't here please: https://github.com/d...irection/issues
As always, minimal reproduction code is best!
Dan promised that after Redirection release,he will start working again on CC2.0 but dan gave no news about CC2.0 so i think CC2.0 is dead for good.
Its been almost 3 months since redirection and we hadnt any news about CC2.0 Progresa
Dan promised that after Redirection release,he will start working again on CC2.0 but dan gave no news about CC2.0 so i think CC2.0 is dead for good.
Its been almost 3 months since redirection and we hadnt any news about CC2.0 Progresa
Don't think that's really fair to say. He has added some new features to the Redirection arcade, so he might still be working on it. Also keep in mind that he might've simply not been working on anything if he's off on holiday or taking a break.