Re: attempting an actual game...




"Gerry Quinn" <gerryq@xxxxxxxxxxxxxxxxxxx> wrote in message
news:MPG.1e0257b354c11d1c98a823@xxxxxxxxxxxxxxxxxxx
> In article <414dc$4396eec6$ca83a645$23792@xxxxxxxxxx>, cr88192
> @NOSPAM.hotmail.com says...
>> "Gerry Quinn" <gerryq@xxxxxxxxxxxxxxxxxxx> wrote in message
>
>> > It was what you posted in order to show how your coding abilities were
>> > too great to be wasted on Tetris. And yet it was made utterly crippled
>> > and inflexible by the absurd decision to use a bit array for square
>> > colours, probably in furtherance of some half-baked idea of efficiency
>> > (like your re-inventions of the zip file etc.).
>
>> no, I figured one would use a bit array as that would probably be
>> convinient
>> for this sort of use. yeah, in retrospect, bytes would probably make more
>> sense, as then one has 8 bits in which to store a color and a few flags
>> or
>> similar.
>>
>> or is this missing the point?...
>
> Yes, it is TOTALLY missing the point. If you want to store just a
> colour, bytes will do though ints are the natural choice when space is
> not as a premium. Bytes are theoretically adequate, but invite integer
> promotion errors.
>
ok.


mostly I had just imagined bytes as, really, one probably does not need the
full color anyways, it is easy enough to regenerate a color from a few bits.

gl notion (where i is whatever value holds the color):
glColor4f((i&1)?1:0, (i&2)?1:0, (i&4)?1:0, 1);

or somesuch...

of ammusing note, the above, along with passing the output of sin to gl, eg,
something like:
glColor4f(0.5+sin(x)*0.5, 0.5+sin(y)*0.5, 0.5+sin(z)*0.5, 1);
and similar are used as ways of conviniently generating colors and similar
within some of my code.

this image:
http://bgb-sys.sourceforge.net/shots/bsde_shot1.jpg

shows my use of these tequniques in the frontend for my physics engine...


for the rest of the state in something tetris-like, 5 bits remains in each
byte. I don't figure there is probably enough state to require much more.

one could use ints if they wanted I guess.


> If you want to store flags as well, putting them in the same memory
> address is simply poor practice, creating extra complication and
> obscurity for no gain whatsoever.
>
hmm, I am not sure why it would make that much difference in terms of these.

but, then again, it comes up as a thought that I frequently do far worse
(using pointers to store integer values on the grounds of saving memory,
....). so, who am I probably to argue about good vs bad practice?...

> As Philippa says, you should abstract it. However, I would not tell
> anyone exactly how to start off a Tetris in detail, either in prototype
> or for evolution into a final version. Using a 2D int (or, if you
> must, byte or short array) is okay. Sticking to a GetCol(x,y) function
> is fine. Creating a Cell class that currently has just a colour is
> fine, but it's easy to get over-elaborate. I would actually settle for
> an int array, on the basis that if I want to change it, it will happen
> before the program gets too complicated for this to be difficult.
> (Obviously only the game logic class will have direct access to this
> array.)
>
> (I once started with typedef int Cell, with a view to making a Cell
> class later. That was definitely overelaborate, though it did no harm,
> as it could revert to the int array option.)
>

ok.
yeah, I am not sure what one would need to store in each cell that would
require a class though...


>> if anything, I will probably continue in the current direction and see
>> what
>> I can do, regardless of what others think.
>
> With all due respect, it's obvious to everyone what you can do if you
> comtinue in the current direction. I.E. diddley squat.
>
> Change direction and you may eventually complete a game.
>
> Of course you could prove us wrong by delivering a working Tetris by
> tomorrow.
>
maybe, probably not.

the difference this time was partly deciding that I will actually try to do
the game, rather than being like "I will write this backend code and maybe
someone else will turn it into a game", or "the game will form itself out of
the accumulation of code".

this has shown itself not to be the case, I have to actively persue making
one for one to form, otherwise, all is just code.

over the past year or so I was focusing on purely backend code, and calling
my previous project a "3d engine" rather than a "game".


then again, I can't say anything has changed. if you don't believe I will
achieve anything, you are quite likely right.

I was saying I would change direction in this minor way, rather than stating
that I expect to succeed.

then again, if you don't believe me (or think I am wavering in the wind),
that is ok as well...

> - Gerry Quinn


.



Relevant Pages

  • Re: read keyboard input and storing in an array?
    ... > I'm trying to store user input in an array, ... You have the beginnings of that logic already since your prompt tells the ... 201st value since the array only has room for 200 values. ... This will force you to store the int values as Integer ('Integer' ...
    (comp.lang.java.help)
  • Re: attempting an actual game...
    ... > be used to store a colour definition rather than an index? ... if I were you and wanted to get to a finished game I ... ugly bitmasking teqniques and similar can sometimes save effort over more ... >>> (I once started with typedef int Cell, with a view to making a Cell ...
    (comp.games.development.programming.misc)
  • Re: Adding large numbers in C
    ... one of the numbers - or perhaps the result - is too big to store in an int. ... you have bitstrings longer than 8 bits, simply use an array of unsigned ... Incidentally, the subtraction routine does similar juggling, so if M and N ...
    (comp.lang.c)
  • Re: attempting an actual game...
    ... be used to store a colour definition rather than an index? ... if I were you and wanted to get to a finished game I ... >> (I once started with typedef int Cell, with a view to making a Cell ... (Conceivably the game logic class will have colour index data separate ...
    (comp.games.development.programming.misc)
  • Re: Reading a Text file
    ... int main ... In any case, you said earlier you want to store the data in an array, ... don't store its result in a char. ...
    (comp.lang.c)