323 posts
Location
Boston, MA
Posted 01 July 2016 - 05:45 AM
Run the installer! pastebin run h5h4fm3t If you're feeling adventurous, pastebin run h5h4fm3t beta to get the beta version!
The installer prompts you to install other packages, such as Cobalt-UI. You also need HTTP and/or HTTPS enabled. If not, download the ZIP from github.
Cobalt aims to make programming in ComputerCraft easier and more centralized. If you've ever programmed in Love2d you will recognize and understand how this works. Rather than having ComputerCraft be event based, and have sprawling programs, Cobalt wraps that into a callback form. This project was originally for CCJam 2016!If you already have Cobalt installed (and have HTTP/HTTPS enabled), type cobalt version to get a version check. If it reports that you are out of date, type cobalt update.Cobalt's installer is also available on DannySMC's AppStore!Example:
Spoiler
local cobalt = dofile( "cobalt" )
local player = {
x = 0,
y = 0,
colour = colours.blue,
}
function cobalt.draw()
cobalt.graphics.reset()
cobalt.graphics.rect( "fill", player.x, player.y, 3, 2, player.colour )
end
function cobalt.update( dt )
if cobalt.keyboard.isDown( "a" ) then
player.x = player.x - 1
elseif cobalt.keyboard.isDown( "d" ) then
player.x = player.x + 1
end
if cobalt.keyboard.isDown( "w" ) then
player.y = player.y - 1
elseif cobalt.keyboard.isDown( "s" ) then
player.y = player.y + 1
end
end
cobalt.initLoop()
Result:
Another example (PONG!)
Spoiler
Since Cobalt is callback based, rather than event based, code is much simpler and more compact. For more (and I mean MUCH more) information, check out
the documentation.
The current version is 1.1_3, and most of the coolness and effort has gone into
Cobalt-UI. You should give it a spin!This is my first project on CC since LimeFyre 2. I think I've stepped up the quality and stuff like that. If you have things you'd like to see, post it here!
Edited on 26 August 2017 - 03:29 AM
389 posts
Posted 01 July 2016 - 11:56 AM
I didn't notice this at first, but it is actually rather nice to use, +1. :)/>
546 posts
Location
Wageningen, The Netherlands
Posted 01 July 2016 - 02:10 PM
Very nice, good job!
You will get a good position on the CCJam2016 ranks :)/>
100 posts
Location
Sublime Text 2
Posted 07 July 2016 - 10:37 PM
damn, well made! This looks a lot like Löve as far as graphics go ;)/>
323 posts
Location
Boston, MA
Posted 07 July 2016 - 11:22 PM
damn, well made! This looks a lot like Löve as far as graphics go ;)/>
Thanks! The next version acutally moves away from paintutils and draws to a surface (from CrazedProgrammer's Surface API) rather than to term. It works a million times better, and you can write software that runs at like 120fps with no screen tear.
60 posts
Posted 19 July 2016 - 12:56 AM
damn, well made! This looks a lot like Löve as far as graphics go ;)/>
Thanks! The next version acutally moves away from paintutils and draws to a surface (from CrazedProgrammer's Surface API) rather than to term. It works a million times better, and you can write software that runs at like 120fps with no screen tear.
1) The max FPS in ComputerCraft is 20.
2) "no screen tear" can easily be done by calling
term.current().setVisible(false);
before rendering and then
term.current().setVisible(true);
after it renders.
323 posts
Location
Boston, MA
Posted 19 July 2016 - 01:04 AM
damn, well made! This looks a lot like Löve as far as graphics go ;)/>
Thanks! The next version acutally moves away from paintutils and draws to a surface (from CrazedProgrammer's Surface API) rather than to term. It works a million times better, and you can write software that runs at like 120fps with no screen tear.
1) The max FPS in ComputerCraft is 20.
2) "no screen tear" can easily be done by calling
term.current().setVisible(false);
before rendering and then
term.current().setVisible(true);
after it renders.
However, I don't know if that fixes the issues of screen flicker. Cobalt's new graphics system (nyi since CCJam judging is still active) fixes that as well.
60 posts
Posted 19 July 2016 - 03:39 AM
damn, well made! This looks a lot like Löve as far as graphics go ;)/>
Thanks! The next version acutally moves away from paintutils and draws to a surface (from CrazedProgrammer's Surface API) rather than to term. It works a million times better, and you can write software that runs at like 120fps with no screen tear.
1) The max FPS in ComputerCraft is 20.
2) "no screen tear" can easily be done by calling
term.current().setVisible(false);
before rendering and then
term.current().setVisible(true);
after it renders.
However, I don't know if that fixes the issues of screen flicker. Cobalt's new graphics system (nyi since CCJam judging is still active) fixes that as well.
it fixes screen flicker.
98 posts
Location
yes
Posted 19 July 2016 - 11:00 AM
1) The max FPS in ComputerCraft is 20.
this the max Frame Per Second that Computer Craft can display. it can render a much higher even though it will not display but all of the program code that render will still run
218 posts
Location
tmpim
Posted 19 July 2016 - 05:55 PM
From what I understand, computercraft Lua code can run and perform render operations in the sense of storing information in a buffer as fast as it can (up to 120 fps even (and beyond)) however due to the minecraft tickrate being 20, the computer's monitor can only refresh 20 times a second, which brings up the topic of things like vsync. Like, do you really even need 120fps if it only can ever be rendered at 20fps. At that point we're just wasting cpu power that could be spent to doing more usefull things, like performing physics calculations or whatever.
1140 posts
Location
Kaunas, Lithuania
Posted 19 July 2016 - 06:41 PM
1) The max FPS in ComputerCraft is 20.
…it can render a much higher even though it will not display but all of the program code that render will still run
…up to 120 fps even (and beyond)) however due to the minecraft tickrate being 20, the computer's monitor can only refresh 20 times a second, which brings up the topic of things like vsync. Like, do you really even need 120fps if it only can ever be rendered at 20fps…
False. The computer can render as fast as the server (the actual real-life computer) can process the statements
and the computer's screen/monitor will refresh as fast as possible. Probably the only point where tickrate matters are timers (which accepts 0.05 as the lowest possible value). Actually, that's where the "myth" comes from: you cannot make a timer lower than 0.05 thus getting only 20FPS. But you can kind of overcome this issue by constantly yielding and pulling events until the computer waits the amount of time you want. Although, this solution isn't an ideal one anyway.
218 posts
Location
tmpim
Posted 20 July 2016 - 01:31 AM
1) The max FPS in ComputerCraft is 20.
…it can render a much higher even though it will not display but all of the program code that render will still run
…up to 120 fps even (and beyond)) however due to the minecraft tickrate being 20, the computer's monitor can only refresh 20 times a second, which brings up the topic of things like vsync. Like, do you really even need 120fps if it only can ever be rendered at 20fps…
False. The computer can render as fast as the server (the actual real-life computer) can process the statements
and the computer's screen/monitor will refresh as fast as possible. Probably the only point where tickrate matters are timers (which accepts 0.05 as the lowest possible value). Actually, that's where the "myth" comes from: you cannot make a timer lower than 0.05 thus getting only 20FPS. But you can kind of overcome this issue by constantly yielding and pulling events until the computer waits the amount of time you want. Although, this solution isn't an ideal one anyway.
This is true… until you realize that the server only sends packets X times a second, so even if on the server (real-life) it updates and refreshes faster, the client will only get updates X times a second. (From what I've seen X is usually around 30)
1140 posts
Location
Kaunas, Lithuania
Posted 20 July 2016 - 08:04 AM
This is true… until you realize that the server only sends packets X times a second, so even if on the server (real-life) it updates and refreshes faster, the client will only get updates X times a second. (From what I've seen X is usually around 30)
If this were true writing each pixel individually would take you about 32 seconds, which is not true at all.Oh, misinterpreted that. Yes, there's a limit to how fast the server can send packets.
Edited on 20 July 2016 - 06:08 AM
67 posts
Posted 28 July 2016 - 04:05 AM
Amazing program! It makes it super easy for the graphically challenged (which I am) and lazy (which I also am) to focus on functionality instead of nice graphics. With that said, there are a few notes that I have.
1.) The key event doesn't support the fn key and the command key, not on my mac anyway. It was an easy fix though. I just added a check in the event handling part of the cobalt program.
2.) It would be nice to have each object have a "visible" attribute that would allow me to hide and show an object without changing cobalt.state
3.) While the graphics are impressive, it is really only useful for creating basic things like menus and log in screens. Now don't get me wrong, those things are useful, it would just be nice for it to be able to handle more challenging graphical problems. For example, if you could remove buttons from a panel, or draw them directly to the screen.
I really do like the callback feature though. I think that's the best thing about cobalt. Not only does it makes graphics super easy, it makes the actual programming easier too. It's less typing and less headaches for me XD. Overall, well done. I don't download programs from the forums that often, let alone use them, let alone take the time to give feedback (I usually prefer to build all of my own tools). So again, good job!
323 posts
Location
Boston, MA
Posted 07 August 2016 - 05:30 PM
–snip–
Thanks so much! I will add a visible feature - I actually think they have that value already, just isn't utilized.
Also, I'm here to let you know that…
COBALT v1.1_0 has been released!This update fixes many of the issues present in the original release, as well as add many new features. If you're looking for the updates to Cobalt-UI, go to the Cobalt-UI thread. ADDITIONS
- Ported to CrazedProgammer's Surface API. All drawing is handled by "cobalt.application.view" and completely eliminates screen flicker
- New module: cobalt.mouse
- cobalt.mouse.isDown(button)
- cobalt.math.clamp(value, lower, upper)
MODIFICATIONS
- cobalt.graphics.center now wraps text, so no need for \n characters to make sure it fits.
- cobalt.keyboard.isDown(key), if key is left empty, returns true or false if ANY key is down.
REMOVALS
- cobalt.graphics.centerInArea()
Happy coding! Any issues you have, please put them in the github issue tracker.
323 posts
Location
Boston, MA
Posted 14 August 2016 - 09:03 AM
I am currently working on an update. Are there any features you guys would like to see in Cobalt or Cobalt-UI? Let me know!
323 posts
Location
Boston, MA
Posted 15 August 2016 - 07:30 PM
Cobalt v1.1_3 is out!
This update provides bugfixes and a new feature - custom error handling. In v1.1_4 (or whatever the next major update is) it will be customizeable, but if you encounter an error within a cobalt function (i.e., nothing outside of a callback) will save the error to the .err-logs/ directory.
If you have cobalt installed, run "cobalt update" to update!
Happy coding! If you have any issues, please put them on the github issue tracker.
323 posts
Location
Boston, MA
Posted 04 September 2016 - 04:58 AM
Currently working on a new version, which is coming along pretty well. Are there any features you'd like to see?
323 posts
Location
Boston, MA
Posted 25 September 2016 - 09:57 PM
Cobalt now has a discord!
https://discord.gg/ZdhMJJ5You can chat about the programs you make with it, get help from me directly, or suggest features.