YolkfolkThe Dizzy Fansite
Community discussion

delta's forthcoming Games

Started by delta on 18 April 2008 • 97,558 views

287 posts
#62969
i've just coded something in IID the way i SHOULD have coded it when i did it in RRD (but didn't think to do so at the time).

i haven't tested it yet tho, gonna do that when i get back. fingers crossed it will work.... it'll be another 'complex' bit of coding out the way if it does.

and it will also make doing that type of thing an absolute cinch in future...


EDIT:: bah. it doesn't work. this will be harder to do than i thought...
👍 0
#62970
Alex, using MaterialRead(x,y,w,h), what would be output if it found material number 11, or material number 0 (air) or both 0 and 11 together?
👍 0
#62971
how on earth does this function work?

all i want is a simple little function to read the material in a small pre-defined box in the room, then act accordingly if it finds material 11 in that box!

The material is VOID density, and i need to distinguish between material 11 and Material 0 (air - also VOID density)

i simply cannot get it to 'find' material 11.
👍 0
#62972
I think this is what your asking for.

MAT BIT OUTPUT
===================================
AIR 0 1
WATER 1 2
HURT 2 4
KILL 3 8
CLOUD 4 16
CLIMB 5 32
WIND 6 64
BLOCK 7 128
JUMPFIX 8 256
JUMPPRO 9 512
USER MAT 10 1024
USER MAT 11 2048
USER MAT 12 4096

If the area contains material 11 only then 2048 will be returned. if it contains material 11 and air then 2049 is returned (2048 + 1).
If you have circumstances where plenty more materials can be in the box then you will need to check if bit 11 is set in the ouput. I don't know if the GS language allows you to check a particular bit but if not it can be done with mathematics. To do this logical and the output with 2048 and if the answer is 2048 then material 11 is present.

In script this is
output = MaterialRead(x,y,w,h);
output = output & 2048;
if (output == 2048) // material 11 is present regardless of what else is
etc
👍 0
#62976

hmm thanks for that. i think the code is still only finding air tho:

y = ObjGet(idx,O_Y);
x = ObjGet(idx,O_ X) ;

bumpls_x1 = x+3;
bumpls_y1 = y+25;

if(MaterialRead(bumpls_x1,bumpls_y1,2,2)>=2048)
{
	lsmat=1;
}
else
{
	lsmat=0;
}

unfortunately it always returns 0. i have a feeling i haven't got the positioning of the MaterialRead(x,y,w,h) correct, but i tried them as a percentage of room size and it didn't work either. {yolkfolk}:scratch:

👍 0
#62978
You're checking game co-ordinates I think? It works for current room co-ordinates.

0 to GameGet(G_ROOMW) - 1
0 to GameGet(G_ROOMH) - 1
👍 0
#62982
yeah, i'm not sure the way i was using to work out the current room co-ords was working correctly.
👍 0
#62987
right, i've done it, got it working etc. apart from one thing.

it's reading *the whole brush* when looking at the material, instead of just using the actual pixels. This means that it can't tell if there is a slope there or not. hmmmm.

i'm wondering whether to just change the whole lot to block material at the start of the coding, use that (like i did with the goat in MSD), and then change it all back to air material at the end of the coding.

anyone know if user defined classes work with brushes too? or if you can have B_CLASS?

hmmm....
👍 0
#62989
bah it's STILL not working.

seems that MaterialCheckFree also only checks the whole tile, rather than just the visible elements of it. i.e. if part of the tile is block and part of it is free, the whole tile will still be classed as block.

  :sad:
👍 0
#62997
i've left that for a moment and am now coding the most complex part of the game - no, the most complex part of any game i've ever coded - and i think i've covered just about everything...

the time may soon come to 'switch it on' as it were, and see how well it actually works.... {yolkfolk}:crazy:

as a little side note, there will be three small 'mini games' included with IID, that you can get to play once you've got a certain way through the game.... These are Coin Drop Dizzy, Ghost Bash Dizzy, and Dizzy Bros. :wink:
👍 0
#62998
{dizzy}:biggrin:

Pulling out all the tricks with this game i see.
👍 0
#62999
[quote data-userid="55" data-postid="62998"]

{dizzy}:biggrin:

Pulling out all the tricks with this game i see.

[/quote]

ohhh like you wouldn't believe.... trust me.

and i've actually got it working! :surprise: i'm actually stunned!! there was no major problems with it, just a few small issues that i've now sorted, and a few other small issues that i'll sort tomorrow, as i'm waaay too tired now to think clearly.
i'm rather chuffed! {yolkfolk}:delight:
👍 0
#63000

About the material function, the DizzyAGE Book saids:

int MaterialRead( x, y, w, h )
IN int x horizontal coordinate in room [0..GameGet(G_ROOMW)-1]
IN int y vertical coordinate in room [0..GameGet(G_ROOMH)-1]
IN int w width
IN int h height
OUT int found materials, on bits

So, as macon said, you have to give the coordinates relative to the room, because they are tested in the material map, and that has the room's size (in fact it's a little bigger, but that's handled internally, so you can test a small outer border too - like when Dizzy stays half outside the room).

Converting the coordinates is easy: just use object_x %room_width (the rest of the division of the world coordinate by the room's size)

The output info is set on bits.

So if material 11 is found inside the specified box, the bit 11 of the returned value will be set. If only that material is inside the returned value is ( 1 < < 11 ) that is 2048. If air is also in the box (air=0) bit 0 will also be set. So for both materials we'll have ( 1 < < 11 ) | ( 1 < < 0 ) that is 2048 + 1. Check the GS9 book for bit operations.

To test if the bit for a certain material was set, do like this:

mask = (1&lt;&lt;11); 
if( (ret_value &amp; mask) != 0 ) .... material found.
// or for more materials (11 and 4)
mask = (1&lt;&lt;11) | (1&lt;&lt;4)
mask = (1<<11); if( (ret_value & mask) != 0 ) .... material found. // or for more materials (11 and 4)
mask = (1<<11) | (1<<4) 

Don't test with >=2048 because it will be true for material 12, even if 11 is not present.

Now, about these material testing functions, they are tricky to use. You must test specific bounds, not necessarily the whole bound of the brush. The movement code, for example, tests a small area below the player to see if solid is there. Also water material is tested only on the pixel that corresponds to the player's mouth. The MaterialGetFreeDist can tell you the distance until a solid material is reached. You must check the movement script to better understand them.

------

There's no B_CLASS defined because usually static brushes don't need to act like dynamic objects. But if you want, you can declare it (with the same value as O_CLASS) and use it in your code. Though you have to check if this property is saved in the map by the editor (for static brushes) - In the first DizzyAGE I had some map size optimization, but I think all properties are saved now.

Alex

👍 0
#63001
Thanks alex. i did eventually get it work - kind of.

i am testing specific 'bounds' rather than the whole brush. the problem i still have is that if you have a tile that is diagonal (eg sloping ground), MaterialRead seems to class the *whole tile* as material 11 (or whatever), rather than just the part that is visible (the sloping part). this is causing me a few problems when attempting to work out whether the item is above that material or not, as even if the specific 'bound' is in thin air, it is still within the tile, so still returns the material that the tile is.
👍 0
#63002
[quote data-userid="23" data-postid="62999"]

ohhh like you wouldn’t believe…. trust me.

and i’ve actually got it working! :surprise:  i’m actually stunned!! there was no major problems with it, just a few small issues that i’ve now sorted, and a few other small issues that i’ll sort tomorrow, as i’m waaay too tired now to think clearly.
i’m rather chuffed! {yolkfolk}:delight:

[/quote]

you should be chuffed jamie - it all sound techie and very hard work to me - can't wait for the release of this one i'm sure we'll all appreciate and enjoy it {yolkfolk}:clap:

👍 0
#63005
Cool, I LOVE LOVE LOVE IT. I really can't wait for this game {yolkfolk}:clap:
👍 0
#63006
thank you! but you'll be waiting a while...! i've almost coded half the puzzles now, and there's still loads and loads and loads of things to do, even before i start to think about coin positions, baddies, room names and stuff like that.

i'm aiming to get it in beta by the end of march, which will allow a month for testing.

it is probably gonna be released *just* before the deadline for the competition. probably.
👍 0
#63010
as a little side note, there will be three small 'mini games' included with IID, that you can get to play once you've got a certain way through the game.... These are Coin Drop Dizzy, Ghost Bash Dizzy, and Dizzy Bros. :wink: as another little side note, there is no way that 'Pirate Ship Dizzy' (see first post) is going to be released by the time of the compo (i've not even started it), however, if i have enough time, i *may* include it in IID as a little bonus game.

maybe.
👍 0
#63012
does anyone play the DizzyAGE games in the smallest possible game window (scale of 1)?

i'm just wondering because for various technical reasons, you won't be allowed to play IID in that scale.
👍 0