Jump to content




CraftOS 2.0 - Dan's Secret Project

computer help

  • You cannot reply to this topic
798 replies to this topic

#422 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 07 November 2015 - 02:05 AM

I've been doing experiments with putting photos in Silica, I won't be posting screenshots of it or the OS anymore until release just to keep the surprise level high, but I'll say they're better that you'd think.

However, there is one small (maybe small isn't the right word here) issue. If the files are use the paintutils image format they're not exactly light weight... at all. One 320 x 200 (the size of the screen) image was 64kB (as you'd actually expect when you think about it). Given that the OS already uses about 700kB without any images, this isn't exactly great.

I'd propose a bit of discussion about a suitable image format; ideally it'd also include the palette data. I was thinking squishing two pixels in to one (one pixel uses 4 bits, half a byte) but even then a single image would be 32kB. Compression would naturally be the next stage, but I know very little about that.

This might not turn out to be a massive issue, hopefully Dan will increase the storage limit to at least 10 - 20MB, and if that's the case then a couple of 64kB image won't be a huge issue, as it would've been in regular CC.

Edited by oeed, 07 November 2015 - 02:05 AM.


#423 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 07 November 2015 - 02:14 AM

I doubt there'll be a storage limit, but I guess we'll see.

You could probably get a fair bit of reduction by simply implementing basic RLE. Depends on the complexity of the images. Going down to 4bit storage certainly makes sense given that it'd match what you can output; simply make a function that can convert to paintutils format later if need be.

Re-saving the images through package.open() would allow for an easy reduction in size, though at the cost of a bit of processing overhead (edit: though come to think of it, if you're going down that path then you might as well just use my GIF API to load / save everything). You'd be best off implementing multiple techniques, in any case.

Edited by Bomb Bloke, 07 November 2015 - 02:18 AM.


#424 Cranium

    Ninja Scripter

  • Moderators
  • 4,031 posts
  • LocationLincoln, Nebraska

Posted 07 November 2015 - 06:12 PM

Well there's a nice explanation of how old games did their wizardry with their memory limits. Series starts here.

#425 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 07 November 2015 - 10:03 PM

Heh. I used to number my sprite columns using powers of two (as opposed to the exponents), made 'em easier to tally up.

He was a bit off in that he was talking in terms of Manufacturer's Megabytes; though I've no doubt he understood the error and just didn't want to complicate his explanation by elaborating on it. Long story short the C64's RAM (like every other device I've ever been aware of) isn't measured that way, and a full screen 4bit image doesn't quite add up to 32KB.

Even colour depth within palettes (which also consume RAM, by the way) was packed down in those days; you might assume each index would consume 24bits, but it was often less. The same technique still sees use today in some image file formats.

Hardware-controlled sprites were fun; they made it very very simple to move multiple images around a screen without worrying about how they might interfere with each other. I've got a hunch Dan may've built something along their lines into COS2.

#426 COOLGAMETUBE

  • Members
  • 49 posts
  • LocationGermany

Posted 12 November 2015 - 08:01 PM

I want Bling Bling Lamps on the front (I opened a post)

#427 CaosTECH

  • Members
  • 131 posts
  • LocationIn your closet

Posted 13 November 2015 - 12:44 AM

Dan, I played Redirection (The Real Version Not Computercraft Version) And It Was Awesome, But I have a question, why did it raise from 2 - 5 dollars?

┈┈┈┈╱▔╲▂▂╱▔╲┈┈┈┈
┈┈┈▕╮╱▔╲╱▔╲╭▏┈┈┈
┈┈┈╱╋▏┊▕┊┊▕╋╲┈┈┈
┈┈▕╋▕━▅━━▅━▏╋▏┈┈
┈┈▕╱▔╲▔╭╮▔╱▔╲▏┈┈
┈┈▕┊┳┊▔╰╯▔┊┳┊▏┈┈
┈┈┈╲╰━━╯╰━━╯╱┈┈┈
┈┈┈╱▔╭┈┈┈┈╮▔╲┈┈┈
┈┈╱▕┊┊┈┈┈┈┊┊▏╲┈┈
┈┈╲╱┊┊┈┈┈┈┊┊╲╱┈┈
┈┈┈▏╋┊┈┈┈┈┊╋▕┈┈┈
┈┈┈╲╋╰┈┈┈┈╯╋╱┈┈┈
╱▔╲┈╲╋╭▂▂╮╋╱┈┈┈┈
▏╋▕▂╱▏┊▏▕┊▕┈┈┈┈┈
╲▂▂▂╱▏┊▏▕┊▕┈┈┈┈┈
┈┈╱▔▔┈╯╲╱╰┈▔▔╲┈┈
┈┈╲▂▂▂▂╱╲▂▂▂▂╱ֆɨ.┈

#428 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 13 November 2015 - 06:26 AM

View PostArchTyler, on 13 November 2015 - 12:44 AM, said:

Why did it raise from 2 - 5 dollars?

Because it's his main (I think?) source of income... If anything $5 is waaaay too low.

#429 dan200

  • Administrators
  • 542 posts
  • LocationCambridge, England

Posted 13 November 2015 - 12:16 PM

View PostArchTyler, on 13 November 2015 - 12:44 AM, said:

Dan, I played Redirection (The Real Version Not Computercraft Version) And It Was Awesome, But I have a question, why did it raise from 2 - 5 dollars?

┈┈┈┈╱▔╲▂▂╱▔╲┈┈┈┈
┈┈┈▕╮╱▔╲╱▔╲╭▏┈┈┈
┈┈┈╱╋▏┊▕┊┊▕╋╲┈┈┈
┈┈▕╋▕━▅━━▅━▏╋▏┈┈
┈┈▕╱▔╲▔╭╮▔╱▔╲▏┈┈
┈┈▕┊┳┊▔╰╯▔┊┳┊▏┈┈
┈┈┈╲╰━━╯╰━━╯╱┈┈┈
┈┈┈╱▔╭┈┈┈┈╮▔╲┈┈┈
┈┈╱▕┊┊┈┈┈┈┊┊▏╲┈┈
┈┈╲╱┊┊┈┈┈┈┊┊╲╱┈┈
┈┈┈▏╋┊┈┈┈┈┊╋▕┈┈┈
┈┈┈╲╋╰┈┈┈┈╯╋╱┈┈┈
╱▔╲┈╲╋╭▂▂╮╋╱┈┈┈┈
▏╋▕▂╱▏┊▏▕┊▕┈┈┈┈┈
╲▂▂▂╱▏┊▏▕┊▕┈┈┈┈┈
┈┈╱▔▔┈╯╲╱╰┈▔▔╲┈┈
┈┈╲▂▂▂▂╱╲▂▂▂▂╱ֆɨ.┈

This is a weird way to contact me... but Redirection was never $2. The lowest it has been is $4 on sale.

#430 CaosTECH

  • Members
  • 131 posts
  • LocationIn your closet

Posted 13 November 2015 - 12:34 PM

View PostArchTyler, on 14 October 2015 - 08:49 PM, said:

Whats that supposed to be? From the code it looked like a spaceship, but now it just looks plain creepy

View Postoeed, on 14 October 2015 - 08:42 PM, said:

Not as good, although very understandable news:

"Ok, focus for the time being is back to @redirectiongame. Finances are such that I can't have two projects in development limbo at a time!"

I have been waiting to ask this question... why does redirection cost money? If we can play it for free on CC?

Before I asked this I looked at the website and it said 2$

#431 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 14 November 2015 - 12:04 PM

I had a go at writing a 3D engine using the Silica emulator, though it is far from perfect:

Posted Image

As you can see there are several glitches with rendering. It does however implement depth testing, so you don't need to sort triangles before drawing. The weird colours are due to the fact that I tried to implement colour blending, which looks much better in Love:

Posted Image

I've also tried to massively optimise it, but it still runs like a snail in CC (but is fine in Love which is even odder). If you want to have a look through the source, it lives on GitHub but is kinda ugly in places. It uses quite a lot of code generation - the matrix, buffer and graphics library are generated by the build file. This should mean the matrix library is slightly quicker, and also means I can generate triangle rendering code that blends z values, colours or whatever you specify - it would be easy to generate a triangle drawer using texture coordinates instead. This also means I can provide triangles with and without colour blending to speed up triangle rasterisation a bit more. This isn't really a "serious" project though, more of a way for me to learn the basics about 3D graphics.

That being said, I'm happy for people to take this and improve it - it is still pretty buggy. Also alpha blending is a thing, though I see no point of it in CC (also it is very buggy due to overlapping triangles - though I'm not sure where all of those lines have come from).

Posted Image

Update:
A couple of minor optimisations later and this can render a spinning cube at about 30fps - though this isn't really practical for anything advanced. Blitting to the screen is still the slowest part of this: drawing to the buffer (and calculating matricies, etc... ) takes 0.00065 seconds, compared with 0.02793 to draw to the screen.

For those interested, you can see a video here. I don't know why it looks so jumpy - my calculations show it is running at 30fps, but it doesn't look like it is. There is also a pastebin here if people fancy a play (the code is really ugly - see above). I guess my next goal will be to get some sort of maze game working.

Another update:
I messed up some stuff and so started the next-frame timer after rendering not before hand, and so ended up running at 15fps instead (though seeing as CC's refresh rate is 20fps it doesn't really matter).

Edited by SquidDev, 14 November 2015 - 04:34 PM.


#432 CraftedCart

  • Members
  • 67 posts
  • LocationUnited Kingdom, Earth

Posted 14 November 2015 - 03:38 PM

Oooh... Pretty startup screen
https://vine.co/v/iB1EiEBpFOw
https://twitter.com/...552046213505025

Good job on the 3D engine SquidDev - I wouldn't even know where to start coding that.

Edited by CraftedCart, 14 November 2015 - 03:43 PM.


#433 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 14 November 2015 - 03:49 PM

View PostCraftedCart, on 14 November 2015 - 03:38 PM, said:


Ohhh, that looks nice. Wonder if it just an animation or if that is being calculated (so static frames or if the text position, pixels, etc... are being set through code).

View PostCraftedCart, on 14 November 2015 - 03:38 PM, said:

Good job on the 3D engine SquidDev - I wouldn't even know where to start coding that.

Thanks! It is just matrices, lots and lots of them (well like 5).

#434 LeDark Lua

  • Members
  • 369 posts
  • LocationLeLua

Posted 14 November 2015 - 03:54 PM

aren't there are like 3 matrices? Or I'm wrong....

#435 Lignum

  • Members
  • 558 posts

Posted 14 November 2015 - 04:03 PM

View PostLeDark Lua, on 14 November 2015 - 03:54 PM, said:

aren't there are like 3 matrices? Or I'm wrong....
Yes, usually it's the model, view and projection matrix. I'm not sure about how his 3D engine works, so I guess the other two are implementation details or something?

#436 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 14 November 2015 - 04:32 PM

View PostLignum, on 14 November 2015 - 04:03 PM, said:

View PostLeDark Lua, on 14 November 2015 - 03:54 PM, said:

aren't there are like 3 matrices? Or I'm wrong....
Yes, usually it's the model, view and projection matrix. I'm not sure about how his 3D engine works, so I guess the other two are implementation details or something?

Normally this is the case, but there is only one important matrix - which is the one every vertex is multiplied by. This example is so simple it doesn't need both a view and model matrix, instead the final matrix is made up of 4 view matrices (translate , rotate in x and y and scale) and one projection. However there is nothing stopping you changing the order: projecting the vertices into 3D space and then scaling them: such as rendering a scene upside down.

#437 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 15 November 2015 - 12:25 AM

View PostSquidDev, on 14 November 2015 - 12:04 PM, said:

I had a go at writing a 3D engine using the Silica emulator, though it is far from perfect:
--snip--

Wow. That's really impressive! I'm really looking forward to all the things people are going to make.

#438 Waitdev_

  • Members
  • 432 posts
  • LocationAdelaide

Posted 15 November 2015 - 01:12 AM

thinking about it, its kind of obvious when you realise it. this is most likely going to be in minecraft, because why call it "CraftOS 2.0" if it wouldn't be in minecraft?
and for that startup video, why is that fullscreen? maybe it is gonna be a real OS.

#439 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 15 November 2015 - 01:42 AM

View PostWait_, on 15 November 2015 - 01:12 AM, said:

thinking about it, its kind of obvious when you realise it. this is most likely going to be in minecraft, because why call it "CraftOS 2.0" if it wouldn't be in minecraft?
and for that startup video, why is that fullscreen? maybe it is gonna be a real OS.
We've covered this numerous times, we're about 90% certain that it's not in Minecraft. Now, it could be, but there's been a ton of evidence suggesting it isn't, including a screenshot of it as a standalone program with the Mac desktop in the background.

#440 Creeper9207

  • Members
  • 211 posts

Posted 15 November 2015 - 02:16 AM

#StarFoxCC
Is that engine actually running at like 15-30fps? if so how many polygons can it handle at that rate

Edited by Creeper9207, 15 November 2015 - 02:20 AM.


#441 Creator

    Mad Dash Victor

  • Members
  • 2,168 posts
  • LocationYou will never find me, muhahahahahaha

Posted 15 November 2015 - 06:10 AM

The question is, is it faster than Love2d?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users