Function-Library challenge

You must understand the Game Editor concepts, before post here.

Function-Library challenge

Postby feral » Mon Jul 07, 2008 12:30 am

Ok.. like most of us, I suck at finishing off games, as i am more into solving problems,
and once i solve the problem I get bored ....and want to move onto a new game ( or problem)

so..

this is my challenge
1. I think,... we should all go through the many lists of requests for features/improvements... and the many small demos
and, find a list of items that could be implemented in GE now as functions

I know many of these have already been written, but they are scattered throughout the many solutions/demos etc etc all over the board

We should then make a single definitive list of items requested and unsolved, and or requested and solved...
then ...

2. Create libraries of "ready to use" functions that answer these problems, and, if not yet answered, attempt to work on the best possible solution and turn it into a user ready function.

I know that this seems very much like repeating ourselves, but I see so many requests for help that are repeated and repeated, and whose solutions I believe should be included in GE as a basic function - simple examples are moonwalk and double jump problems. these could be solved at the outset with something like actordirection() or actorjump() functions

While these functions would be limiting/limited and basic , they would be a good springboard for newbies to start on, and later they can modify and or write their own solutions/routines.. but this way they can jump straight in to GE while avoiding many of the early simple pitfalls we all had to go though.

These libraries could then be collected, and categorized, and made ready to be loaded into GE as needed (in Global scripts) as mini collections of useful functions for various type games..

eg:
a library of standard useful actor functions, actordirection(), actorjump(), actorhealth(), etc etc
a library of standard bitmap functions, like pyro's and game-a-gogos bitmap24(),rotate(),etc
a library of special features like my stickto() function, etc

I believe this would not only help the community at large, but also be of enormous help to makslane, as he would then not have to do all the work himself, and indeed many of the functions we create/collect could possibly then be included as "built in" functions in the future

If this sounds like a good idea, I would like to start off two new threads

1. Suggestions/requests for functions. Keeping in mind this is different list then "Requests for GE features" as some of those request can only be done by makslane in GE himself,

BUT, many of the smaller requests for GE features are possible to solve by us the users, which means, for example, while we workon a simple rotation routine to solve many requests, makslane would then have more time to concentrate on writing a DS port (or something :shock:) ... if you know what i mean..

just have a look in the list's of requests, and you will find many that are completely solvable by us the users and can be done now...

obviously some would be better done in a compiled GE function ( ie: much faster), but, at least in the meantime there will be a solution... again the "rotate sprite" is a good example..it could be included in new versions , but we have it now..

So we as a group could go through the requests lists, all the "help me's"... etc , and, if we think it can be solved as a function, we add to idea/request to the list of things to do...

2. The second thread would be where we concentrate on a list of all existing, or nearly ready, or half done routines/functions etc that are spread out all over the forum, put them all in one spot , then we can all decide if they are "library ready", or need improving, or whatever... then start creating libraries..

Ideally, then, whenever a question is asked in the future, and someone writes a code snippet to solve it, we can work out whether it is worth converting to a fully fledged function, and add it in the the library.. thus improving GE constantly.

any thoughts ?

feral
PS: I am more then happy to work on this myself, if people just want to send stuff to me, as, I prefer solving these types of small challenging problems then I do actual "game making", and need the challenges , but, I would much prefer to see a community oriented approach, if this is a good idea ?
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: Function-Library challenge

Postby zygoth » Mon Jul 07, 2008 8:44 pm

I personally think it's a great idea.
Nova: 100% Vertigo/Mazeman: 100%
Visit my website to download them both! http://www.ketonegames.com
User avatar
zygoth
 
Posts: 140
Joined: Mon Jun 11, 2007 6:37 pm
Score: 5 Give a positive score

Re: Function-Library challenge

Postby feral » Tue Jul 08, 2008 2:46 am

Here is the first example

note: I really tried to figure out how to make this self contained without making the user add additional variables.. so if anyone wants to , please improve on it..

basically - can we add to the actor struct through a script ?

anyhow animation speed changing function ->
Code: Select all
// Global Function - animspeed()
// By: feral
// Pupose: sets actor animation speed as a percentage of game FPS
// can be used by multiple actors at different speeds
// Usage:
// 1. paste following code into a global script.
// 2. Set a new user Variable (using Variables button in script editor)
// Set as:
// name: speed (lowercase)
// type: integer
// variable type: Actor variable
// note: this adds a new unique variable to every actor called 'speed'
// and stores the indiviual speed count for that actor.
// 3. edit animspeed() function and set fps variable to match the current game
//
// To Use:
// 1. In any actor in the 'Create Actor' event script insert
//
// ChangeAnimationDirection("Event Actor", STOPPED);
//
//
// 2. In the Draw Actor event
// use
// 
// animspeed(var);
//
// where the varibale = 0 to 100
// (this coverts as a percentage of total game FPS)
//
//----------------CUT AND PASTE FOLLOWING TO GLOBAL SCRIPT------------------------

void animspeed(float i)
{
float fps=30;

speed=speed+fps/100*i;


if (speed>=real_fps)
  {
  animpos=animpos+1;
  speed=0;
  }
  if (animpos>=nframes)
  {
     animpos=0;
  }
}

//-------------------------------------------------
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score

Re: Function-Library challenge

Postby feral » Tue Jul 08, 2008 6:31 am

here is how it works

Earlier I posted a animspeed() function which we could all comment on, and or, offer better, or different solutions..

In this case, .. I have already changed my mind about a few things and remade the function, ( others could have posted better version... or comments .. or requests etc)

but. now we have 2 versions and if everyone is happy that at least one is as good as it gets, we pick the best ( or if both work well for different purposes we could pick both)

Then the best would get added into an official User Based GE function library

anyhow.... here is a second version

I changed my mind about using percentages as the speed count, as it would have made no sense to anyone.... every GE user is used to seeing 'frame counts' when loading and using animations..

so I rewrote the function to use the same "frame rate numbers" as GE does..

it also means that the speed variable now contains a useful number that can be used in formulas/routines etc
whereas, before it used to hold a percentage of the current game frame rate...

Now it holds the actual frame rate of the actor animation (from animspeed) which could theoretically be used in a program.
note: the variable 'speed' can now be used like any other actor struct and can be modified and read by other actors etc..
eg Actor.speed

for example
if (Actor.speed<=5)
{
//actor is going slow enough to shoot
}
else
// actor too fast to shoot accurately
}

new version code
Code: Select all
// Global Function - animspeed2()
// By: feral
// note: this version animspeed2() runs based on frames rates
// and not percentages of game speed like the original animspeed()
//
// Purpose: sets actor animation speed of an actor
// can be used by multiple actors at different speeds
// Usage:
// 1. Set a new user Variable (using Variables button in script editor)
// Set as:
// name: speed (lowercase)
// type: integer
// variable type: Actor variable
// note: this adds a new unique variable to every actor called 'speed'
// and stores the individual frame speed of that actor.
//
// To Use:
// 1. In any actor in the 'Create Actor' event script insert
//
// ChangeAnimationDirection("Event Actor", STOPPED);
//
//
// 2. In the Draw Actor event
// use
//
// animspeed(var);
//
// where the variable = 0 to total game FPS
// 0 will stop the animation
// game rate will give highest speeed eg: in a 30 FPS game a var of 30 is max speed
// numbers higher then current game rate will defualt back to current game max
// eg if game rate is set at 30,  a animspeed var of 50 will still run at 30 frames
//-------------------------------------------------

void animspeed2(float i)
{
speed=speed+i;

if (speed>=real_fps)
// note using real_fps should stop frames skipping if game lags..

  {
  animpos=animpos+1;
  speed=0;
  }
  if (animpos>=nframes)
  {
     animpos=0;
  }
}

//-------------------------------------------------
User avatar
feral
 
Posts: 308
Joined: Sun Mar 16, 2008 6:27 am
Score: 47 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 1 guest