Author Topic: The Blue Platform  (Read 73550 times)

0 Members and 1 Guest are viewing this topic.

Eeems

• Mr. Dictator
• LV13 Extreme Addict (Next: 9001)
• Posts: 6233
• Rating: +318/-36
• little oof
Re: Platform Game Engine
« Reply #30 on: May 18, 2009, 01:30:54 pm »
I know, but I wasn't really planning to make a game in the first place.

Ok, major update, I've decided to completely rework the engine because of how hard it is for me to tweek it. this is how I'm going to structure it
Code: [Select]
Load mapGet ListsDisplay HUDDisplay MapWhile health and character is not off limitsgetkeyUpdate TilePhysicsDisplay characterIf Key thenswordJumpmagicEndJump actionIf enemy thenenemy movementEndTile testsEnd
By the way, this is a dual-layer platformer I'm guessing? And are those screenshots with 6 MHz?
Yes it is, and yes they are at 6MHz, which is why they are slow compared to Trev's
« Last Edit: May 18, 2009, 01:46:11 pm by Eeems »
/e

Eeems

• Mr. Dictator
• LV13 Extreme Addict (Next: 9001)
• Posts: 6233
• Rating: +318/-36
• little oof
Re: Platform Game Engine
« Reply #31 on: May 19, 2009, 11:35:09 am »
ok, I have almost finished coding the new engine, it runs a bit faster then the other one, but it feels a bit less responsive...the new one is more versatile. it also handles moving off the edge of the map better, and the physics engine is much smaller, and better.
/e

DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55882
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
Re: Platform Game Engine
« Reply #32 on: May 19, 2009, 04:04:13 pm »
by responsive do you mean key detection? I know I often had issues with that in my games when there were animated goodies or stuff moving around. The way to fix this with nothing moving around real time is to have your walking loop like:

Code: [Select]
While CONDITIONCODERepeat GetkeyEndAns->VARMOAR CODEEnd

Code: [Select]
While CONDITIONCODEGetkey->VARMOAR CODEEnd
Usually this helps a lot when you haven't pressed a key in a while. However, this cause all movement on the screen to halt until you press a key

Btw this post is cursed. Reading it will make you turn into Netham45 exactly one year after reading it the first time, because it is the 666th post this month

noahbaby94

• LV7 Elite (Next: 700)
• Posts: 585
• Rating: +29/-24
Re: Platform Game Engine
« Reply #33 on: May 19, 2009, 04:12:36 pm »
Code: [Select]
While CONDITIONCODERepeat GetkeyEndAns->VARMOAR CODE EndThis code is actually incorrect the Ans does not store to VAR.
That's what she said!!!

simplethinker

• LV7 Elite (Next: 700)
• Posts: 695
• Rating: +16/-5
• snjwffl
Re: Platform Game Engine
« Reply #34 on: May 19, 2009, 04:30:27 pm »
This code is actually incorrect the Ans does not store to VAR.

This should work:
Code: [Select]
:While CONDITION:CODE:Repeat Ans:getKey:End:Ans→VAR:MORE CODE :End
What I do for Chip's Challenge is along the lines of
Code: [Select]
:While STUFF:getKey→K:If K:prgmMOVE:(some stuff that has to be executed every time):End
prgmMOVE contains all the code for if the player moved, so if they didn't move the (useless) code isn't executed.  There's stuff besides a key press that triggers movement (or at least the need to run the movement code), but that's the gist of it.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true." -- Professor Robert Silensky

Chip's Challenge: ħ%

DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55882
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
Re: Platform Game Engine
« Reply #35 on: May 19, 2009, 04:50:49 pm »
Uhm Noah, by var I meant any real var. I wrote VAR because the user could decide to use whatever var from A to Z, and yes you can store Ans to real vars, I tried and it works.

simplethinker

• LV7 Elite (Next: 700)
• Posts: 695
• Rating: +16/-5
• snjwffl
Re: Platform Game Engine
« Reply #36 on: May 19, 2009, 04:52:49 pm »
Uhm Noah, by var I meant any real var. I wrote VAR because the user could decide to use whatever var from A to Z, and yes you can store Ans to real vars, I tried and it works.
I believe he meant that with "Repeat getKey:End", the getKey does not store to Ans, so you have no way to retrieve the input if a key was pressed.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true." -- Professor Robert Silensky

Chip's Challenge: ħ%

DJ Omnimaga

• Former TI programmer
• CoT Emeritus
• LV15 Omnimagician (Next: --)
• Posts: 55882
• Rating: +3151/-232
• CodeWalrus founder & retired Omnimaga founder
Re: Platform Game Engine
« Reply #37 on: May 19, 2009, 04:56:22 pm »
Oh ok I see now, I forgot about that when writing down the code , so I guess Repeat Ans:Getkey:End:Ans->VAR or simply Repeat VAR:Getkey->VAR:End (altough idk if it's a lil slower) would be the best way to go then

trevmeister66

• LV9 Veteran (Next: 1337)
• Posts: 1009
• Rating: +14/-5
Re: Platform Game Engine
« Reply #38 on: May 19, 2009, 05:34:10 pm »
This should work:
Code: [Select]
:While CONDITION:CODE:Repeat Ans:getKey:End:Ans→VAR:MORE CODE :End
What I do for Chip's Challenge is along the lines of
Code: [Select]
:While STUFF:getKey→K:If K:prgmMOVE:(some stuff that has to be executed every time):End
prgmMOVE contains all the code for if the player moved, so if they didn't move the (useless) code isn't executed.  There's stuff besides a key press that triggers movement (or at least the need to run the movement code), but that's the gist of it.

It would actually be faster to do:
Code: [Select]
:While STUFF:getKey→K:If K:Then:prgmMOVE:End:(some stuff that has to be executed every time):End

When using If statements with only 1 line afterwards, it's faster to execute that line WITHOUT the Then:End, but when skipping that line (in cases where key presses aren't pushed often), it's faster to have Then:End because instead of reading what's inside, it skips. Not sure if what I said just made sense, but to sum it up, it's faster to skip code using Then:End, and it's faster to execute the code just using If by itself.
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit

simplethinker

• LV7 Elite (Next: 700)
• Posts: 695
• Rating: +16/-5
• snjwffl
Re: Platform Game Engine
« Reply #39 on: May 19, 2009, 05:37:42 pm »
When using If statements with only 1 line afterwards, it's faster to execute that line WITHOUT the Then:End, but when skipping that line (in cases where key presses aren't pushed often), it's faster to have Then:End because instead of reading what's inside, it skips. Not sure if what I said just made sense, but to sum it up, it's faster to skip code using Then:End, and it's faster to execute the code just using If by itself.
So, when the condition is false (the next line is skipped) it's faster to use If:Then:End.
When the condition is true (the code is executed) it's faster to just use If.

Is that right?  If that's the case, then whether to use the Then:End depends on if most of the time the condition will be true or false.
"We've all heard that a million monkeys banging on a million typewriters will eventually reproduce the entire works of Shakespeare. Now, thanks to the Internet, we know this is not true." -- Professor Robert Silensky

Chip's Challenge: ħ%

trevmeister66

• LV9 Veteran (Next: 1337)
• Posts: 1009
• Rating: +14/-5
Re: Platform Game Engine
« Reply #40 on: May 19, 2009, 05:38:40 pm »
When using If statements with only 1 line afterwards, it's faster to execute that line WITHOUT the Then:End, but when skipping that line (in cases where key presses aren't pushed often), it's faster to have Then:End because instead of reading what's inside, it skips. Not sure if what I said just made sense, but to sum it up, it's faster to skip code using Then:End, and it's faster to execute the code just using If by itself.
So, when the condition is false (the next line is skipped) it's faster to use If:Then:End.
When the condition is true (the code is executed) it's faster to just use If.

Is that right?  If that's the case, then whether to use the Then:End depends on if most of the time the condition will be true or false.
Yes, you put it in a much simpler way. That is correct.

And yes, if you're going to have multiple things going on at once, I think it would be better to have the If:Then:End, whereas if you're just having an enemy moving around and thats it, only having If shouldn't be a problem.
Projects:    nameless RPG: 1.0%  |  Reverse Snake v1.5: 100%  |  Secret Project: 5%  |  DUNGEON: 70%

My MW2 Blog <-- Please visit

Eeems

• Mr. Dictator
• LV13 Extreme Addict (Next: 9001)
• Posts: 6233
• Rating: +318/-36
• little oof
Re: Platform Game Engine
« Reply #41 on: May 19, 2009, 06:34:41 pm »
I'm going to stick to what I have because the enemy has to keep moving too. I use booleans to change my vars and such and I skip stuff if there isn't a keypress, I would post my code, but since I've started from new I have to just post progress from here on because I want to enter this into the contest
/e

Eeems

• Mr. Dictator
• LV13 Extreme Addict (Next: 9001)
• Posts: 6233
• Rating: +318/-36
• little oof
Re: Platform Game Engine
« Reply #42 on: May 19, 2009, 08:55:25 pm »
ok screenshot time!
...hmm they don't seem to work right on wabbit
/e

Eeems

• Mr. Dictator
• LV13 Extreme Addict (Next: 9001)
• Posts: 6233
• Rating: +318/-36
• little oof
Re: Platform Game Engine
« Reply #43 on: May 20, 2009, 11:47:57 am »
ok, I fixed the error's and built the menus. Now I'm working on the items, lol, I figured out a way to do the sword that is faster. I just save the pic before it goes, then run the animation and then recall the pic, no more reloading the tile after each part of the animation.
/e

• Mr. Dictator