Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, dr_panther), 1,100 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rating: 3
Page 3 of 4 1 2 3 4
Re: 'Structured' programming in Lite-C [Re: Pappenheimer] #281259
07/26/09 13:44
07/26/09 13:44
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline OP
Expert
Joozey  Offline OP
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
The advantage is code overview, more logical division of responsibilities and doesn't waste unused resources. This stuff with skills has always bugged me in c-script. What does an entity object do with an inventory value of the player? That's not making sense. Instead, the player should keep track of the fishes (entities), and manage their index position in the array, because the player has the fishes. The fishes shouldn't care whether or not they're in an array. They should just do their own thing.

So you lay the responsibility of the fish management to the swarm object, and the fish behaviour to the fish itself. The player tells the fish where to swim, and the fish will do the rest. You probably don't want to make an entity object for the swarm just to have the skills available. Instead, you can make your own structure with only the data you need. An entity has more data than just the skills that are then unused. Would be confusing and wastes resources.

I hope it's a bit clear.
After re-reading my first post I have doubts that everyone can understand it grin.

Regards,
Joozey

Last edited by Joozey; 07/26/09 13:45.

Click and join the 3dgs irc community!
Room: #3dgs
Re: 'Structured' programming in Lite-C [Re: Joozey] #281403
07/27/09 05:27
07/27/09 05:27
Joined: Jul 2007
Posts: 424
EUROPE
maslone1 Offline
Senior Member
maslone1  Offline
Senior Member

Joined: Jul 2007
Posts: 424
EUROPE
Very clear!

Thanx for your cool thread, and detailed explaining how to use "structured programming".

Have a nice day joozey!

cheers
Marcel


A8c, Blender, FlStudio, Unity3d
Re: 'Structured' programming in Lite-C [Re: maslone1] #285388
08/18/09 11:02
08/18/09 11:02
Joined: Jan 2004
Posts: 3,023
The Netherlands
Helghast Offline
Expert
Helghast  Offline
Expert

Joined: Jan 2004
Posts: 3,023
The Netherlands
best thread ever! make it a sticky or add this to AUM!!

thanks Joozey, you explained (several times) over MSN how structs work, so I got a head start tongue the array and multi dimensional array structs still are a bit over my head, I'll have to look a bit more into that I guess...

I decided to re-program/structure my game using these methods.
Might wanna go as far and convert my ragdoll code using this... hmmmmm...

anyway, thanks! keep up the good job!

regards,


Formerly known as dennis_fantasy
Portfolio - http://www.designorhea.com/
Project - http://randomchance.cherrygames.org/
Re: 'Structured' programming in Lite-C [Re: Joozey] #286131
08/23/09 10:47
08/23/09 10:47
Joined: Aug 2009
Posts: 11
A
alwaysblack Offline
Newbie
alwaysblack  Offline
Newbie
A

Joined: Aug 2009
Posts: 11
Hello, and thank you for making this thread, it's very interesting.

I'm trying to learn about the topic you've raised here, but I'm struggling to get my code to compile. Can you tell me what is wrong with these lines that would prompt a syntax error?

Click to reveal..

//a function to visualize an item on a panel
void item_visualize( Inventory *inventory, Panel *panel ) {
panel->bmap = inventory->image;
}


Re: 'Structured' programming in Lite-C [Re: alwaysblack] #287055
08/29/09 16:37
08/29/09 16:37
Joined: Oct 2004
Posts: 4,134
Netherlands
Joozey Offline OP
Expert
Joozey  Offline OP
Expert

Joined: Oct 2004
Posts: 4,134
Netherlands
@alwaysblack:
Not from that piece right away, I experience no trouble in assigning a bitmap to a panel. It would be helpful if you can paste the message and some more relevant code.

Regards,
Joozey


Click and join the 3dgs irc community!
Room: #3dgs
Re: 'Structured' programming in Lite-C [Re: Joozey] #317770
04/02/10 13:34
04/02/10 13:34
Joined: Feb 2009
Posts: 3
France
W
WapiAchak Offline
Guest
WapiAchak  Offline
Guest
W

Joined: Feb 2009
Posts: 3
France
hi Joozey, great thread ! I can see structs more clearly now.

I understood how you deal with structs, but I have a little prob with this part :

void item_visualize( Inventory *inventory, PANEL *panel ) {

panel->bmap = inventory->image;

}

when I try to compile the code I've the message : 'image': is not a member of 'Inventory'


so I can't call the function like this : item_visualize( inventory->item1, inventory->panel );


I modified the part like this :


void item_visualize( Inventory *inventory, PANEL *panel ) {

panel->bmap = inventory->item1->image;

}

But it's not a good way for me. Can you tell me what's wrong ?

Regards,
WapiAchak

Re: 'Structured' programming in Lite-C [Re: WapiAchak] #317783
04/02/10 14:46
04/02/10 14:46
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Oh, haven't seen this thread...


Very many thanks, this can will make things much easier laugh

Re: 'Structured' programming in Lite-C [Re: Rei_Ayanami] #317787
04/02/10 15:22
04/02/10 15:22
Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Nidhogg Offline
Serious User
Nidhogg  Offline
Serious User

Joined: Dec 2006
Posts: 1,086
Queensland - Australia
Great explanation Joozey. Will defanitly find this usefull.


Windows XP SP3
Intel Dual Core CPU: E5200 @ 2.5GHz
4.00GB DDR3 Ram
ASUS P5G41T-M LX
PCIE x16 GeForce GTS 450 1Gb
SB Audigy 4
Spyware Doctor with AntiVirus
Re: 'Structured' programming in Lite-C [Re: Nidhogg] #317802
04/02/10 16:16
04/02/10 16:16
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
I don't get it...
Code:
typedef struct
{
	var    koor_x_abs;
	var    koor_y_abs;
	var    koor_x;
	var    koor_y;
	var    btype;
	PANEL* pnl;
} BLOCK;


/////////////////////////////////////////Actions//////////////////////////////////////////
//noch nicht Benötigt
////////////////////////////////////////Functions/////////////////////////////////////////
function create_new_level(var height, var lenght)
{
	var i, j;
	BLOCK **block = malloc( sizeof( BLOCK* ) * height );

	for( i=0; i<lenght; i++ ) {
		block[i] = malloc( sizeof( BLOCK ) );
	}
	
	for(i = 0; i<=height; i++)
	{
		for(j = 0; j<=1; j++)
		{
			if((i/height)*random(100) > 60)
			{
				block[0]->pnl.pos_x = 1;
			}
		}
	}
}


crashes in the block[0]->pnl.pos_x = 1;

Re: 'Structured' programming in Lite-C [Re: Rei_Ayanami] #317806
04/02/10 16:35
04/02/10 16:35
Joined: Jul 2001
Posts: 6,904
H
HeelX Offline
Senior Expert
HeelX  Offline
Senior Expert
H

Joined: Jul 2001
Posts: 6,904
try

(block[0])->pnl->pos = 1;

Last edited by HeelX; 04/02/10 16:35.
Page 3 of 4 1 2 3 4

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1