You should be mostly using structures. Unions are a powerful but special case tool.
Structures are a group of variables. They give you a way to use one name to refer to a collection of variables. Each variable get it's own space in memory. All the variables are packed one after another in memory.
So for example:
struct Vec2
{
float x;
float y;
};
Gets a you a block of memory containing space for TWO unique floating point numbers, one for x, one for y.
A union is a group of names that point to the same block of memory. They provide you with a way to access the same memory with different names. This is sometimes useful.
For example:
union Vec1
{
float x;
float y;
};
Gets you a block of memory with space for ONE floating point number. You can refer to the number by either x or y, but it is the SAME memory location and therefore the SAME number.
If you are asking 'why would I ever want to do that?', you're asking the right question! :)
Unions are useful in a handful of case but generally you're going to be using structures to store your data. My advice is to use structures and then one day you'll find yourself thinking 'what I really want to do is access this variable as either two ints or an array of 8 chars'. When that moment happens, you'll have found your use for unions.
it's very interesting. I have an idea for something I'd like to do that would work great in 1bit. But in a way that feels like the easy route. Not that black and white isn't challenge, but it's very interesting to think about how to best make use of just one more color. If it was four colors, you could just go GameBoy and I suppose even with 3 colors you could do a simple grey scale, but what if you wanted some actual color. Which colors would you use and how would you use them? You've definitely got me thinking so however you came up with this idea, it's working! :)
Awesome! 3 colors is a very interesting choice. Definitely got me intrigued! :)
Saturday, May 2, 2020 - 10:47
Is that three colors counting black? or three colors plus black?
so could our palette be Red, Green, Blue and Black. Or is it limite to just two colors and black? so Red, Green, Black, something like that?
By your wording, I'm assuming it's three colors counting black, black being a unique RGB value. But figure it's worth asking to be sure.
is this a game jam or an art contest? if a game jam, is there an itch.io page for it?
Friday, May 1, 2020 - 09:01
Hi!
Just FYI, OGA is not exactly zippy in normal times, but there is currently some issue with the site that's making it extremely slow. The admins are working on it.
Friday, May 1, 2020 - 08:59
it seems a bit better this morning. Any word on what the (most recent) issue was and if anything was done to address it?
You should be mostly using structures. Unions are a powerful but special case tool.
Structures are a group of variables. They give you a way to use one name to refer to a collection of variables. Each variable get it's own space in memory. All the variables are packed one after another in memory.
So for example:
struct Vec2
{
float x;
float y;
};
Gets a you a block of memory containing space for TWO unique floating point numbers, one for x, one for y.
A union is a group of names that point to the same block of memory. They provide you with a way to access the same memory with different names. This is sometimes useful.
For example:
union Vec1
{
float x;
float y;
};
Gets you a block of memory with space for ONE floating point number. You can refer to the number by either x or y, but it is the SAME memory location and therefore the SAME number.
If you are asking 'why would I ever want to do that?', you're asking the right question! :)
Unions are useful in a handful of case but generally you're going to be using structures to store your data. My advice is to use structures and then one day you'll find yourself thinking 'what I really want to do is access this variable as either two ints or an array of 8 chars'. When that moment happens, you'll have found your use for unions.
Maybe he's starting a collection. :)
it's very interesting. I have an idea for something I'd like to do that would work great in 1bit. But in a way that feels like the easy route. Not that black and white isn't challenge, but it's very interesting to think about how to best make use of just one more color. If it was four colors, you could just go GameBoy and I suppose even with 3 colors you could do a simple grey scale, but what if you wanted some actual color. Which colors would you use and how would you use them? You've definitely got me thinking so however you came up with this idea, it's working! :)
Spring might've bern asking in reference to the specific 3-color limit.
It is an odd limit for sure. Doesn't correspond to any historical hardware that I can recall.
Because it's there! :)
Awesome! 3 colors is a very interesting choice. Definitely got me intrigued! :)
Is that three colors counting black? or three colors plus black?
so could our palette be Red, Green, Blue and Black. Or is it limite to just two colors and black? so Red, Green, Black, something like that?
By your wording, I'm assuming it's three colors counting black, black being a unique RGB value. But figure it's worth asking to be sure.
is this a game jam or an art contest? if a game jam, is there an itch.io page for it?
Hi!
Just FYI, OGA is not exactly zippy in normal times, but there is currently some issue with the site that's making it extremely slow. The admins are working on it.
it seems a bit better this morning. Any word on what the (most recent) issue was and if anything was done to address it?
@Basto: No specific time zone. As long as it's in by the end of the day in your local time zone it's fine.
Pages