dMZX Forums: set "command" to code? - dMZX Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

set "command" to code? is this safe?

#1 User is offline   ice 252 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 36
  • Joined: 23-December 04
  • Location:WVC, UT

Posted 24 October 2007 - 12:07 AM

ok so i have heard that you should not mess with the SET "COMMAND" TO X code unless you know what you are doing, I also read that it can slow the game down to a crawl if set to high. so my question is, could you set the COMMAND to X code to a high number just while you load info and then set it back to the defult "30" and would this have any drastic effect on the game? ? ?

Thanks, Ben
0

#2 User is offline   Risu2112 

  • I can't get the top off this bottle
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,864
  • Joined: 12-August 01
  • Gender:Male

Posted 24 October 2007 - 12:11 AM

Yep, increasing "commands" while initializing a board and then dropping it back down would be fine. But I think the default is 40 not 30.

you could raise it several times the default amount and not cause any slowdown on a modern computer, just if you start to get drastic like over 10x you need to be RESPONSIBLE with your cycles and make sure to end them with wait 1's so you don't suck all the juice.

The strict limit on commands per cycle is a safe guard against sloppy code. example:

:loop
if spacepressed "pause"
goto loop

that would cause lots of problems if you set commands too high, there's no need to check for that condition more than once per cycle, the solution is to add in a wait 1 to end the cycle
:loop
if spacepressed "pause"
wait 1
goto loop


The above situation is 99% of the reason why a novice mzxer should be careful when pushing the commands counter too high.

This post has been edited by Risu2112: 24 October 2007 - 12:15 AM

Respond! Vibrate! Feed back! Resonate!
<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
0

#3 User is offline   ice 252 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 36
  • Joined: 23-December 04
  • Location:WVC, UT

Posted 24 October 2007 - 12:17 AM

k sweet thanks a ton, its not used in a loop, just when i load some info and it only has to load once and then its droped, thanks again!
0

#4 User is offline   Wervyn 

  • I can see you
  • Group: DigiStaff
  • Posts: 1,855
  • Joined: 24-December 00
  • Gender:Male
  • Location:Caras Galadhon

Posted 24 October 2007 - 12:36 AM

For more complex games with code intensive engines, you will have situations where you need commands to be constantly set reasonably high in order for the game to work right. Of course, if you're actually pushing the code to where you need to execute 32767 commands in a cycle, your game is going to be slow with or without a wait 1. So it is possible to set it only up to the number of commands that need to be executed. However, this takes a lot of busywork to figure out, and is subject to change if you change your code, so what most people do when they need to do this is set commands arbitrarily high and then code responsibly.
This is a good skill to learn now, because someday you're probably going to want to write engines that need extra cpu, and being in the habit of coding a wait into all of your non-terminating loops will be to your advantage. I'm not saying you need to always set commands high, because you don't, and you shouldn't when you don't need to. But you should learn to put in appropriate wait 1's even when you don't technically need to, just because it's a good practice.

"Loose loops sink ships! DON'T GOSSIP!"
To lie is to change the truth.
..Ignorance is to be unaware of the truth.
....Incompetence is to be unable to grasp the truth.
......And escape is to run away from the truth.
It is useless to run, since the truth is right next to you.

-Wervyn
0

#5 User is offline   nooodl 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 735
  • Joined: 28-October 06
  • Gender:Not Telling
  • Location:Belgium

Posted 24 October 2007 - 06:38 AM

Putting wait 1's into code has become some kind of habit for me already... :)
0

#6 User is offline   Kom 

  • Senior Member
  • PipPipPipPip
  • Group: Members
  • Posts: 611
  • Joined: 05-March 07
  • Gender:Male

Posted 24 October 2007 - 11:26 AM

I should have done that in Doom Spire :) , making commands be set back to 40 after the level generates. But it never played slow for me so I figured that it wouldn't matter that much.
0

#7 User is offline   Pyro1588 

  • wojtek
  • PipPip
  • Group: Members
  • Posts: 145
  • Joined: 20-October 02
  • Gender:Male
  • Location:Minnesota

Posted 24 October 2007 - 04:47 PM

because i'm lazy but rarely forget my "wait" statements, i like to set my commands high and then just code per normal. i guarantee you, i need commands higher than 40, but i have no desire to try to determine how high exactly i need it.

that and most relatively complex globals and such will have enough subroutines so that it's almost impossible to determine what the maximum number of cycles is with the global.
<Tox> bah. I may as well give in and shop australia. D:
<pyro1588> "welcome to australia, can i help you find what you're looking for?"
<Tox> pyro1588, I'm giving you the most reproachful of glares right now.
--------
Go show those nutty Koreans what us crazy Europeans are made of pirate.gif pirate.gif pirate.gif - Saike
<exophase> The old Commodore strategy of, "Go friggin' bankrupt!"
<wervyn> Go away! I'm writing the same engine I always do!
0

#8 User is offline   Risu2112 

  • I can't get the top off this bottle
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,864
  • Joined: 12-August 01
  • Gender:Male

Posted 24 October 2007 - 06:48 PM

I still think we should have a read only counter set to the value of the number of commands executed last cycle, said counter would be a GREAT debugging tool for situations like that.
Respond! Vibrate! Feed back! Resonate!
<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
0

#9 User is offline   Exophase 

  • Laughing on the inside.
  • Group: DigiStaff
  • Posts: 7,155
  • Joined: 23-October 00
  • Gender:Male
  • Location:Cleveland, OH

Posted 24 October 2007 - 07:53 PM

Risu2112, on Oct 24 2007, 01:48 PM, said:

I still think we should have a read only counter set to the value of the number of commands executed last cycle, said counter would be a GREAT debugging tool for situations like that.

I don't think so, if it's too many you'll know it. It wouldn't tell you where all those cycles are being spent. Maybe you want a profiler for that.
~ ex0 has a kickass battle engine, without it you sux0rz! without it you sux0rz! ~

"The fact that I say I've one of the best, is called honesty." -Akwende
"Megazeux is not ment to be just ASCII, it is ANSI!" - T-bone6
"I hate it when you get all exo on me." - emalkay

Exophase can what Rubi-cant.
exoware is ware ur ware is exoware
ps. not loking 4 new membrs kthx
0

#10 User is offline   Risu2112 

  • I can't get the top off this bottle
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,864
  • Joined: 12-August 01
  • Gender:Male

Posted 24 October 2007 - 08:31 PM

Either one would have greatly sped up the development of my pixel perfect engine, being able to know what cycles there was a surge of commands would have quickly identified some huge inefficiencies that went undetected by me for quite a while. Also having that value displayed while testing would give a reasonably accurate indication of the average commands the board consumes under normal operation, info like that would be great for us mzx'ers with really fast computers, the initial incarnation of my pixel perfect engine ran great on my laptop, but as it turned out it was producing slowdown even on a Pentium 4, 2.26ghz. Duo-core is not a realistic system requirement for a mzx game :)

This post has been edited by Risu2112: 24 October 2007 - 09:11 PM

Respond! Vibrate! Feed back! Resonate!
<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
0

#11 User is offline   Old-Sckool 

  • megazeux breaker
  • PipPipPipPip
  • Group: Members
  • Posts: 649
  • Joined: 07-June 05
  • Gender:Male

Posted 25 October 2007 - 12:32 AM

Kom, on Oct 24 2007, 07:26 AM, said:

I should have done that in Doom Spire :) , making commands be set back to 40 after the level generates. But it never played slow for me so I figured that it wouldn't matter that much.

nah, I didn't have any issues with the game engine itself running too slow (though I never got too far to begin with...). Besides, wouldn't setting your commands back to 40 break your nifty pointy arrow thing?

... anywho, I find that my computer can handle commands set somewhere around 40000/50000 (if you didn't know, that would be written as "(40000)" ) without too much slowdown.
<Nadir> mzxers don't make GAMES, usually
<phthalocyanine> they make experiences.
<Nadir> demos, more like
<Nadir> a glimpse into what could have been if mzx wasn't such a bore to work with
<Nadir> actually, i'm being unfair
<Nadir> i would have made mzx games if it was capable of running on more than 20 computers worldwide in 1998
<Nadir> >:D

<%Alice> functor
<%nooodl> i hear C++ has a thing called functors and they're completely different from Haskell functors...
<rorirover> the result is the most horrid thing in C++, it's basically black magic and it transforms any code you're writing into some eldritch monstrosity
0

#12 User is offline   Risu2112 

  • I can't get the top off this bottle
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,864
  • Joined: 12-August 01
  • Gender:Male

Posted 25 October 2007 - 01:05 AM

the # of commands you can run without slow down does vary widely with what commands are being used, some take considerably more power than others, Also, commands is # of commands per cycle per robot. setting commands to 40,000 with some sloppy coding could potentially cause a lot of slowdown.
Respond! Vibrate! Feed back! Resonate!
<Cybersilver> "All my sugestions are for FUTER VERSIONS. Say it with me Fu-ter futer. Yep..."
9-21-2009, SFMZX game play video: HERE
Risu2112
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users