Jump to content




CraftOS 2.0 - Dan's Secret Project

computer help

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

#563 dan200

  • Administrators
  • 542 posts
  • LocationCambridge, England

Posted 15 January 2016 - 01:37 AM

I may go back on this later, but right now, the filesystem is a shared resource which all devices can access (as is the main memory). A benefit of this is it allows the Lua CPU to be "just another device" without any special privileges.

#564 oeed

    Oversimplifier

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

Posted 15 January 2016 - 02:29 AM

View PostFUNCTION MAN!, on 15 January 2016 - 01:11 AM, said:

I'm less concerned with image formats and more concerned with the fact that the GPU can access the file system.

I don't really see what's wrong with that. I mean, sure, from a 'real life' perspective it seems odd; but if it makes things simpler I don't see the issue.

#565 oeed

    Oversimplifier

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

Posted 15 January 2016 - 11:11 PM

Oh Dan you sneaky bugger ;)

Posted Image

Given that the CC for 1.8 has been released we're one step closer, although Redirection is probably still top of the list.

Edited by oeed, 15 January 2016 - 11:16 PM.


#566 cyanisaac

  • Members
  • 369 posts
  • LocationSan Diego, CA

Posted 17 January 2016 - 02:54 AM

View Postoeed, on 15 January 2016 - 11:11 PM, said:

Oh Dan you sneaky bugger ;)

Posted Image

Given that the CC for 1.8 has been released we're one step closer, although Redirection is probably still top of the list.

I think he's probably counting down the release to Redirection, then CraftOS 2.0 will probably get more attention.

If I had to guess. Maybe he's switched gears and that's a countdown to CraftOS 2.0. Who knows?

#567 Justy

  • Members
  • 210 posts
  • LocationCLGD

Posted 17 January 2016 - 04:50 AM

View Postcyanisaac, on 17 January 2016 - 02:54 AM, said:

If I had to guess. Maybe he's switched gears and that's a countdown to CraftOS 2.0. Who knows?

What if CraftOS is a part of Redirection this whole time?

#568 Waitdev_

  • Members
  • 432 posts
  • LocationAdelaide

Posted 17 January 2016 - 09:49 AM

View Postjustync7, on 17 January 2016 - 04:50 AM, said:

View Postcyanisaac, on 17 January 2016 - 02:54 AM, said:

If I had to guess. Maybe he's switched gears and that's a countdown to CraftOS 2.0. Who knows?

What if CraftOS is a part of Redirection this whole time?

ooo

#569 oeed

    Oversimplifier

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

Posted 17 January 2016 - 11:56 AM

View Postcyanisaac, on 17 January 2016 - 02:54 AM, said:

I think he's probably counting down the release to Redirection, then CraftOS 2.0 will probably get more attention.

Hmm actually that's probably more correct.

Also, sorry for the massive screenshot, OS X doesn't like scaling retina screenshots :angry:

#570 cyanisaac

  • Members
  • 369 posts
  • LocationSan Diego, CA

Posted 17 January 2016 - 08:56 PM

View Postoeed, on 17 January 2016 - 11:56 AM, said:

View Postcyanisaac, on 17 January 2016 - 02:54 AM, said:

I think he's probably counting down the release to Redirection, then CraftOS 2.0 will probably get more attention.

Hmm actually that's probably more correct.

Also, sorry for the massive screenshot, OS X doesn't like scaling retina screenshots :angry:

// offtopic I'm jealous I'm on a nonretina macbook the display is so low res help me

#571 Creator

    Mad Dash Victor

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

Posted 20 January 2016 - 02:05 PM

Will the coordinate system start at 0 or at 1? 0 is better.

#572 Wojbie

  • Members
  • 631 posts
  • LocationKinda lost

Posted 20 January 2016 - 02:24 PM

View PostCreator, on 20 January 2016 - 02:05 PM, said:

Will the coordinate system start at 0 or at 1? 0 is better.
Well it is Lua based and Lua stuff starts from 1 so if you wanted it to stay logical...

#573 Creator

    Mad Dash Victor

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

Posted 20 January 2016 - 03:13 PM

View PostWojbie, on 20 January 2016 - 02:24 PM, said:

View PostCreator, on 20 January 2016 - 02:05 PM, said:

Will the coordinate system start at 0 or at 1? 0 is better.
Well it is Lua based and Lua stuff starts from 1 so if you wanted it to stay logical...

Love2D starts at 0. And it is easier for the graphics math to have it be 0.

#574 dan200

  • Administrators
  • 542 posts
  • LocationCambridge, England

Posted 20 January 2016 - 08:24 PM

View PostCreator, on 20 January 2016 - 02:05 PM, said:

Will the coordinate system start at 0 or at 1? 0 is better.

Pixel coords start at 0,0. I initially had them start at 1,1 to be more "lua-like", but it resulted in a lot of code ugly like "tilex = ((pixelx - 1)/tilewidth) + 1". One of the benefits of developing this in private is I can go back on bad API decisions :)

#575 Creator

    Mad Dash Victor

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

Posted 20 January 2016 - 08:25 PM

View Postdan200, on 20 January 2016 - 08:24 PM, said:

View PostCreator, on 20 January 2016 - 02:05 PM, said:

Will the coordinate system start at 0 or at 1? 0 is better.

Pixel coords start at 0,0. I initially had them start at 1,1 to be more "lua-like", but it resulted in a lot of code ugly like "tilex = ((pixelx - 1)/tilewidth) + 1". One of the benefits of developing this in private is I can go back on bad API decisions :)

Thank you!

Edited by Creator, 20 January 2016 - 09:40 PM.


#576 oeed

    Oversimplifier

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

Posted 21 January 2016 - 12:02 AM

View Postdan200, on 20 January 2016 - 08:24 PM, said:

Pixel coords start at 0,0. I initially had them start at 1,1 to be more "lua-like", but it resulted in a lot of code ugly like "tilex = ((pixelx - 1)/tilewidth) + 1". One of the benefits of developing this in private is I can go back on bad API decisions :)

Oh dear. Not that that's a bad thing, I think it's good.

...it's just the 19 thousand lines I've gotta update to use a zero based coordinate system :P

#577 Waitdev_

  • Members
  • 432 posts
  • LocationAdelaide

Posted 21 January 2016 - 02:01 AM

View Postoeed, on 21 January 2016 - 12:02 AM, said:

View Postdan200, on 20 January 2016 - 08:24 PM, said:

Pixel coords start at 0,0. I initially had them start at 1,1 to be more "lua-like", but it resulted in a lot of code ugly like "tilex = ((pixelx - 1)/tilewidth) + 1". One of the benefits of developing this in private is I can go back on bad API decisions :)

Oh dear. Not that that's a bad thing, I think it's good.

...it's just the 19 thousand lines I've gotta update to use a zero based coordinate system :P
well, you could use yer' favourite text editor and sniff out that little "find" tool

Edited by Waitdev_, 21 January 2016 - 02:02 AM.


#578 apemanzilla

  • Members
  • 1,421 posts

Posted 21 January 2016 - 02:08 AM

View PostWaitdev_, on 21 January 2016 - 02:01 AM, said:

View Postoeed, on 21 January 2016 - 12:02 AM, said:

View Postdan200, on 20 January 2016 - 08:24 PM, said:

Pixel coords start at 0,0. I initially had them start at 1,1 to be more "lua-like", but it resulted in a lot of code ugly like "tilex = ((pixelx - 1)/tilewidth) + 1". One of the benefits of developing this in private is I can go back on bad API decisions :)

Oh dear. Not that that's a bad thing, I think it's good.

...it's just the 19 thousand lines I've gotta update to use a zero based coordinate system :P
well, you could use yer' favourite text editor and sniff out that little "find" tool

That won't work too well. A lot of basic UI calculations, like text centering, are different depending on whether the pixels start at 0 or 1, for example.

#579 oeed

    Oversimplifier

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

Posted 22 January 2016 - 03:21 AM

View Postdan200, on 15 January 2016 - 01:37 AM, said:

I may go back on this later, but right now, the filesystem is a shared resource which all devices can access (as is the main memory). A benefit of this is it allows the Lua CPU to be "just another device" without any special privileges.

Another thing on the file system, what is the speed like? I noticed a few things slowing down and realised that it was the file system reading files.

Essentially, when you have binary images files that are 24+ kilobytes the fastest I could possibly get it reading was about 0.05 seconds (average of 100 trials) in Minecraft (i.e. not an emulator). It mightn't sound terrible, but that simply isn't viable. If you're trying to display just a handful of those the system will freeze for a noticeable amount of time, especially when the user is used to 60ish FPS.

Here's the code I was using to test it. Note, I'm not actually doing anything with the data. I'm literally just reading the bytes.

local s = os.clock()
local n = 100
for i = 1, n do
  local handle = fs.open( "Arc de Triomphe.ucg", "rb" )
  if handle then
	local read = handle.read
	local lastByte
	repeat
	 lastByte = read()
	until not lastByte
	handle.close()
  end
end
print( "Total time: "..( os.clock() - s ) / n )

Given the likely increase in fairly large binary files, I'd be good if this could be improved upon.

We don't really know much about how the file system works, but if it's fairly similar to the CC method I'd suggest creating a .readAll function for binary files that returns a table of all the bytes (as numbers).

Edited by oeed, 22 January 2016 - 03:22 AM.


#580 dan200

  • Administrators
  • 542 posts
  • LocationCambridge, England

Posted 22 January 2016 - 03:42 PM

In CraftOS 2 the API matches the Lua standard: you don't have to read binary files one byte at a time anymore.

#581 Konlab

  • Members
  • 595 posts
  • LocationKerbin

Posted 22 January 2016 - 06:07 PM

View Postoeed, on 21 January 2016 - 12:02 AM, said:

View Postdan200, on 20 January 2016 - 08:24 PM, said:

Pixel coords start at 0,0. I initially had them start at 1,1 to be more "lua-like", but it resulted in a lot of code ugly like "tilex = ((pixelx - 1)/tilewidth) + 1". One of the benefits of developing this in private is I can go back on bad API decisions :)/>

Oh dear. Not that that's a bad thing, I think it's good.

...it's just the 19 thousand lines I've gotta update to use a zero based coordinate system :P/>
Or just write a term redirect that changes every position to position - 1

#582 Creator

    Mad Dash Victor

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

Posted 22 January 2016 - 06:12 PM

View PostKonlab, on 22 January 2016 - 06:07 PM, said:

View Postoeed, on 21 January 2016 - 12:02 AM, said:

View Postdan200, on 20 January 2016 - 08:24 PM, said:

Pixel coords start at 0,0. I initially had them start at 1,1 to be more "lua-like", but it resulted in a lot of code ugly like "tilex = ((pixelx - 1)/tilewidth) + 1". One of the benefits of developing this in private is I can go back on bad API decisions :)/>

Oh dear. Not that that's a bad thing, I think it's good.

...it's just the 19 thousand lines I've gotta update to use a zero based coordinate system :P/>
Or just write a term redirect that changes every position to position - 1

It adds an extra layer of operations significantly slowing everything down.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users