Gamestudio Links
Zorro Links
Newest Posts
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
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, dr_panther, TedMar), 872 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 7 of 16 1 2 5 6 7 8 9 15 16
Re: TUST or "The community library" [Re: PadMalcom] #422556
05/12/13 18:25
05/12/13 18:25
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline OP
Expert
MasterQ32  Offline OP
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
I've updated the documentation and started on a camera controller (a little lie the old from A6 times wink )



@OT:
My programming mood is back, yay!


Visit my site: www.masterq32.de
Re: TUST or "The community library" [Re: MasterQ32] #422705
05/15/13 10:30
05/15/13 10:30
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
hi,
I have been out of my hobbies for a while, but in the meanwhile I wrote a little system that works as a global state machines collection manager. I was wondering if it could fit on tust or it is reinventing the wheel xP

DOWNLOAD

I wrote it translucent for the user, where he has only to start the system, add new state machines and close the system at the end. All the added machines will run automatically.

It can manage any object pointer as machine holder (same concept as 'me' pointer in entity actions) and it is function pointer based. It executes functions with the state machine passed as first paremeter, where the state of any machine can be changed.

Code:
void stateHappy ( STMACHINE *stm ) 
{
   ENTITY *ent = stm_me ( stm );
   ENTITY *entFriend = stm_me ( stm_by_index ( stm_index ( friends_index ) ) );
   if ( entFriend->happyness > 50 )
      ent->happyness += time_step;
   else
      ent->happyness -= time_step * 0.5;
   if ( ent->happyness < 50 )
      stm_set_state ( stm, stateWretch, 0 );
   if ( ent->happyness > 80 )
      stm_set_state ( stm, stateSmiling, 0 );
}



In order to avoid any state change preference between machines I aded a system that ensures that every machine executes its actual function before been changed by another machine.

It can be used for automate almost eveything and the resultant coding style is normally quite clean and readable. Look into main.c to see it by yourself.

What do you think about this? Is it usefull?

Re: TUST or "The community library" [Re: txesmi] #422714
05/15/13 11:24
05/15/13 11:24
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
To be honest, I don't get exactly what it does laugh Does it contain and manage states of objects? What's the differenece to assigning simple functions to Entities?

Re: TUST or "The community library" [Re: PadMalcom] #422735
05/15/13 21:08
05/15/13 21:08
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
It is a state machines manager. It does what a state machine does: run a different script depending on a state. These state machines are usually contained in a switch case block inside the entity action. A function pointer based state machine avoids the need of this switch case, so does not matter the states amount of the machine. Each machine runs its state function straight. In the worst case, imagine the performance lost with a state machine with a hundred of different states running its last state inside a switch case. And then multiply it by a hundred state machines.

Mainly, the benefit of this code is that you can run function pointer based state machines without having any knowledge about what a pointer to a function is. Furthermore you get the benefit (not really big but necessary in some cases) of that next frame change that avoids the inherent advantage of the execution order. It has also the minor benefit of executing all the machines from a single array pass inside a single while loop. And the big benefit of been objects of any data type, not just entities. The machines do not need an object at all but there it is for its convenience.

This is not originally developed for tust but a code structure I usually write converted (with tust in mind) to an user friendly extension that I will certainly customize for my future projects laugh

Re: TUST or "The community library" [Re: txesmi] #422736
05/15/13 21:11
05/15/13 21:11
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline OP
Expert
MasterQ32  Offline OP
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
i would like to see something like this in TUST.
I could use such state machines very often but then i'm to lazy to implement them in a good way.


Visit my site: www.masterq32.de
Re: TUST or "The community library" [Re: MasterQ32] #422817
05/17/13 12:59
05/17/13 12:59
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
Hi,

I uploaded to TUST the state_machine extension. Also uploaded the node based pathfinder converted to arrays. I have to admit that I don't know how to continue with it...

Re: TUST or "The community library" [Re: txesmi] #422818
05/17/13 13:01
05/17/13 13:01
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline OP
Expert
MasterQ32  Offline OP
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Sounds good. I will do the free flight camera now. I think about adding some kind of expansion of the network template into a network system.


Visit my site: www.masterq32.de
Re: TUST or "The community library" [Re: MasterQ32] #423067
05/23/13 16:45
05/23/13 16:45
Joined: Nov 2011
Posts: 274
de
lemming Offline
Member
lemming  Offline
Member

Joined: Nov 2011
Posts: 274
de
In case you plan any further network programming, I'm currently working on a network-library wrapper as a side-project.

It's intended to cover basic network commands in ANet, GSTNet and AckNet (or whatever the internal network lib is called) like
- client/server connection (already working for ANet/GSTNet)
- events and messages (already working for ANet/GSTNet)
- create entities (already working for ANet)

You choose the lib you want to use by a define.
It is NOT MEANT to cover everything the different libs provide. But to be enough for a simple tutorial chat or shooter. (Or more if you only use the message-event system.)

I thought this might be useful (and it has already prooven useful to me) if you want to switch the network engine for whatever reason.

At the moment it needs to be cleaned up and is very incomplete. The whole Acknet part is impossible for me anyway, because I have the Extra Edition.
Right now I have no time to work on it. Maybe after the AckCon again.

If you want it, PM me, or tell me here to add it to TUST.

Last edited by lemming; 05/23/13 16:46.
Re: TUST or "The community library" [Re: lemming] #423068
05/23/13 16:53
05/23/13 16:53
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline OP
Expert
MasterQ32  Offline OP
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
Sounds useful, what are you guys thinking?

For myself i would have some non-gs related project:
A updater/update builder for a directory structure. It's not finished yet, but i think it will be reliable and easy to use. As a lot of people always try to include some kind of updater into their project i think this could useful.


Visit my site: www.masterq32.de
Re: TUST or "The community library" [Re: MasterQ32] #423072
05/23/13 17:54
05/23/13 17:54
Joined: Mar 2006
Posts: 1,993
Karlsruhe
PadMalcom Offline
Serious User
PadMalcom  Offline
Serious User

Joined: Mar 2006
Posts: 1,993
Karlsruhe
I'd prefer a 100% working GSTNet or ANet solution. Just one network component is easier to maintain than 3 different ons.

Page 7 of 16 1 2 5 6 7 8 9 15 16

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