Sign in to follow this  
  • entries
    156
  • comments
    253
  • views
    85240

Drilling, Learning, Coding

Sign in to follow this  
ildave1

139 views

=============================================================================================================
Nothing Good Today
=============================================================================================================
Aside from getting 3 hours of sleep last night and heading to the dentist at 7am to get all of my soda cavities filled up, I had a pretty boring day.

They hooked me up with laughing gas though... That stuff rocks, its nice to be that relaxed/tingly! LOL!

Had classes tonight and I found out that I need a 28% on my final to get a C in that class. SCORE!

=============================================================================================================
Code, Code, Code [v.0001]
=============================================================================================================
Well, I didn't get to read/learn a lot today.

Covered:
? Iterators
- const_iterator, Iterator Arithmetic
? bitset
- Absolutely nothing! >CONFUSING<
? Array Refresher
- Basic arrays
? [LATE >yawn<] Pointers


#include

Now.. The introduction to this part notes,

"Some programs deal with ordered collections of bits. Each bit can contain either a 0(off) or a 1(on) value. Using bits is a compaq way to keep yes/no information (sometimes called flags) about a set of items or conditions."

Now, this personally confuses me a bit. Anybody reading that has some spare time, could you elaborate any further on this? Like, why and when you would want to use this in the development of a game (or perhaps a good article you know off that discribes it well). I'll snoop around online tomorrow if nobody has the time, I just thought I would say something here. Thanks in advanced if anyone helps.

=============================================================================================================
return 0;
=============================================================================================================
I hope to have entertained atleast 5 minutes of your time! :)

Have a great night/day everyone and until next time!
Sign in to follow this  


4 Comments


Recommended Comments

I always want to use bitsets but I have problems with all the binary logic :D

Basically if you had, say a tile game, instead of having:


bool passable
bool grass
bool stone
bool water
bool slippery
bool occupied
etc


you'd used a enum

enum [passable = 0, ... the rest]

Then you could create a new tile

createTile(passable | grass)

and it would set up your bitset so it looked like

110000...

This is pretty easy to save and takes less memory than bools.

... there's something important I've forgotten about the number of the enum I think it has to go up in 2s or powers of 2 or something :D as I said I don't actually use them :D

Share this comment


Link to comment
Quote:
createTile(passable | grass)
and it would set up your bitset so it looked like

110000...


Very interesting. I understood you perfectly until you got to this point.

When you summon createTile(passable | grass), is that generating a bitset -> 110000 or does the programmer calculate the bitset? I can see where your coming from when you note that it takes less memory.

I really appreciate the reply/help! Rate++

Share this comment


Link to comment
Oh man, this is why I don't deal with tile based games yet... my sidescroller engine is without tiles, so you all want to buy it!

So anyhow, here's my take on the whole book thing.

Lets just say one of my little patrolling entities have a bunch of bools managing it's status. There would be one for if he's moving left, right, if he's alive, on screen, walking, shooting, whatever. I would need an enumerator or function to keep track of it all for purposes of things like how to draw him and what his next action is. See?

Lookin good... more entries I say!

-IV

Share this comment


Link to comment
I haven't fiddled with them for a long time but the computer does it all for you.

one pipe is a logical or so it logically or the binary values together.

I'm probably the least informed person to attempt to explain this. ... I think I may have written something down when I was fiddling with them a month or so back.

Ah looking back I read an article here about them. I was looking for C# stuff but I don't think the syntax is all that different to C.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now