Page 1 of 1

how can I do this?

PostPosted: Tue Jul 31, 2012 1:16 am
by Hblade
I'm on a goal to figure out programming from a different view. My goal is to not use if statements and still be able to make a decent game. Currently Im trying to figure out something like this:

Code: Select all
if(yvelocity>2)
{
//code)
}


since you can't use > and < in case: codes

Re: how can I do this?

PostPosted: Tue Jul 31, 2012 2:26 am
by AliceXIII
this is exactly what i've been trying to do myself, although some if's will need to exist..

your best bet at optimization is to use pointers and send activation events, since pointers use only 2 bytes of data and activation events can be used sorta like inheritance but on a specific level for instance:
optimization.zip
(451.35 KiB) Downloaded 108 times


if you check that out i was trying to make a way to take advantage of one draw_from() function to draw a tiled out map from a single actor onto a canvas would have been something great had it worked but the only trouble is getting the animpos to change then be drawn only for the single instance of a tile which i've only gotten to work once..

this may seem off topic but i posted it because this is a good example of using SendActivation() for optimization which optimization is what im guessing your going for :)

Re: how can I do this?

PostPosted: Fri Aug 03, 2012 4:23 am
by Hblade
I like the file you just gave. Its actually put together really well =)

Re: how can I do this?

PostPosted: Fri Aug 03, 2012 1:43 pm
by AliceXIII
I try my best to program, and piece together my programs in the most optimized way which is why i still have tons of work on my engine i started it before i knew alot of stuff i do now so alot of reworking to be done..

The idea was to show you that although if's are nasty they hold there specific place for use, when needed they should be used on inherited actors or sent by send activation events so you keep the calls down to a minimum and so you only need to write your if a single time!

this specific example i made in a minute or two trying to find a way to make static maps load from a single actor with a single canvas if your interested as am i, im still working on a way to make it work :)

also instead of draw actor's if you can use send activation events use them saves alot of calls, my engine total i think a single actor has a draw event and that's just my debug text actor every other actor uses send activation although i need to rework some to use inheritance instead of activations!

maybe i should make a tutorial on inheritance, send activation's, and pointers after all they are the way GE was meant to be used! :P

Re: how can I do this?

PostPosted: Fri Aug 03, 2012 11:15 pm
by Hblade
A whole map on a single canvas would be fascinating!

Re: how can I do this?

PostPosted: Sat Aug 04, 2012 12:11 am
by AliceXIII
fascinating and very hard :lol:

maybe even impossible to do it with a single tile actor im thinking you would need to use a single actor for every differn't tile animation there is and save there map animation and x and y externally then read it in and draw it would still be more optimized than having 1000+ actual actors existing though, but not as nearly elegant as the first proposed idea..

Re: how can I do this?

PostPosted: Sat Aug 04, 2012 6:32 am
by Hblade
Whewww o-o'

Re: how can I do this?

PostPosted: Sat Aug 04, 2012 7:45 am
by AliceXIII
I got all the resources to do it just need to put it together :wink: