2 registered members (AndrewAMD, juanex),
1,247
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
OP
Expert
|
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 . 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
Senior Member
|
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
Expert
|
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 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,
|
|
|
Re: 'Structured' programming in Lite-C
[Re: Joozey]
#286131
08/23/09 10:47
08/23/09 10:47
|
Joined: Aug 2009
Posts: 11
alwaysblack
Newbie
|
Newbie
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? //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: Rei_Ayanami]
#317787
04/02/10 15:22
04/02/10 15:22
|
Joined: Dec 2006
Posts: 1,086 Queensland - Australia
Nidhogg
Serious User
|
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
Expert
|
Expert
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
|
I don't get it...
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
HeelX
Senior Expert
|
Senior Expert
Joined: Jul 2001
Posts: 6,904
|
try
(block[0])->pnl->pos = 1;
Last edited by HeelX; 04/02/10 16:35.
|
|
|
|