Author Topic: Anti-RPG RPG  (Read 60946 times)

0 Members and 2 Guests are viewing this topic.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Anti-RPG RPG
« Reply #60 on: December 14, 2009, 05:47:31 pm »
Code like that both reduces the size of your code and makes it faster.  Great job!

My favorite type of change :) Usually you are trading speed for size of visa-versa.

To bad it runs slower :( Do you know what it is that is slowing down the loop?  Maybe I could help, people say I'm good at making things fast, perhaps i could give a few suggestions :D

Offline Insorak

  • LV3 Member (Next: 100)
  • ***
  • Posts: 76
  • Rating: +4/-0
  • Omnimaga n00b
    • View Profile
Re: Anti-RPG RPG
« Reply #61 on: December 14, 2009, 06:19:37 pm »
@ztrumpet: Not according to TI-BD, it isn’t: http://tibasicdev.wikidot.com/timings#toc3

The If:X structure is only considerably (20-fold) slower if one uses a For( loop, of which there are none in my movement engine. Otherwise, the speed is comparable (and even slightly faster).

And aahhh... xcopy uses the X variable. This could be slightly problematic, as my movement is stored (temporarily) in the variables X and Y before these variables are copied to L4(8 ) and L4(9). (Justification for this is the enormous toll saved on memory – X and Y take up one byte each, while L4(n) takes up an enormous five bytes. The default list variables take up TWO bytes each, which is extremely irritating.)

Does xcopy have deletion capabilities for the programs as well, or will I have to use another ASM library, since I don’t think I can manage otherwise? This is quite the interesting collection of ASM code I’m assembling (pun completely intended) ;)

I just tried it without xlib, and it didn't seem to run any faster. When I counted pixels there was a tiny difference, but not really enough to matter.

I would love some help with this devilish piece of code, builderboy :) I'll post it tomorrow (when I hijack my friend's link cable) but I'll just give some background information now (he brings his laptop to school and we only have lunch to do this, so I won't have time to type it out then):
  • In [A] is the "world" map for each portion of the game, and the element stored in a place in [A] gives you what map loads. For example, in the first zone, [A] is a 2x4 matrix with [[4,5][3,6][2,7][1,8]]. You start in room 1, and which room you progress to after that depends on which side you exit from. (i.e. if you exit to the up direction your y-coordinate in the matrix increases 1).
  • I'm not going to include the menu or teacher mode programs - only the map file, the event file, and some other necessary stuff. So don't press 2nd unless you want an error. :P
  • All the checks for stuff in L6 are completely necessary. (They're your status ailments.)
  • Whether you can move or not is determined directly from the string, seeing if sub(Str1,16(Y-1)+X,1 returns a valid string that you can move on. This is probably the slowest part, but I couldn't think of anything else unless you want me to store everything to a 128-element list which is extremely memory-inefficient.
  • You need xlib enabled. (Duh. :P)
Thanks for all the help and support so far, guys - I'm going to take a break (and do my homework) tonight! See you all tomorrow at noon :)

E - wait, do you guys just want the code or the actual files themselves to see how fast it runs? Code would be harder to do (my friend doesn't have a program editor on his computer).
« Last Edit: December 14, 2009, 06:23:54 pm by Insorak »
(re)working on Anti-RPG: 3% completion

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Anti-RPG RPG
« Reply #62 on: December 14, 2009, 06:29:56 pm »
Both could be done, just use sourcecoder 2 on cemetech.net
« Last Edit: December 14, 2009, 06:35:22 pm by Builderboy »
/e

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Anti-RPG RPG
« Reply #63 on: December 14, 2009, 06:40:04 pm »
  • All the checks for stuff in L6 are completely necessary. (They're your status ailments.)

Its assumptions like that that leave room for optimization ;) Although I'd have to look at it to be sure.  Often times you can check whether or not you need to check, if you get my meaning.  It may be slower when you need to actually do the checking, but if you don't need to do the checking often, it will be much faster.  (I do have to see if this can be applied though)

Hope to see the code soon though!

Offline Insorak

  • LV3 Member (Next: 100)
  • ***
  • Posts: 76
  • Rating: +4/-0
  • Omnimaga n00b
    • View Profile
Re: Anti-RPG RPG
« Reply #64 on: December 14, 2009, 07:16:58 pm »
I need to do that particular check every turn, actually - the counter ticks down once per turn :P
(re)working on Anti-RPG: 3% completion

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Anti-RPG RPG
« Reply #65 on: December 14, 2009, 08:29:13 pm »
Never use Y variable. Some TI-OS glitches causes it to be reset to 0 from time to time. You'll run into problems later.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Anti-RPG RPG
« Reply #66 on: December 14, 2009, 10:01:07 pm »
Never use Y variable. Some TI-OS glitches causes it to be reset to 0 from time to time. You'll run into problems later.
I am pretty sure these only deal with some draw-type commands and the graph screen.

@ztrumpet: Not according to TI-BD, it isn’t: http://tibasicdev.wikidot.com/timings#toc3
Ah, yes that would be correct when you have an empty If 1: statement.  However if you have If 1:"Blahblahblah (or mabey If A*SD*(2=H):"Hi I don't remember which is longer to matter; line of If or the next) as an example it would take the basic parser longer than an If:Then.  I'm not sure how it works exactly, but longer ifs are slower.  I wish I could explane it better. (I feel like that didn't make much sense :P)

Like I said, Without a program in a string it will detete the program. Like 1->X:Asm(prgmXCOPY

I can't wait to see your code. :)
« Last Edit: December 14, 2009, 10:05:23 pm by ztrumpet »

Offline Insorak

  • LV3 Member (Next: 100)
  • ***
  • Posts: 76
  • Rating: +4/-0
  • Omnimaga n00b
    • View Profile
Re: Anti-RPG RPG
« Reply #67 on: December 15, 2009, 11:29:30 am »
Lunch was extraordinarily hectic, so I will be posting code after school. I'm on one of my school's pathetic Macs right now (which, incidentally, doesn't have TI-Connect - imagine that!) so I can't transfer code right now. (I suppose I could just type it out, but I have better things to do with my time. :P)

Quote
Never use Y variable. Some TI-OS glitches causes it to be reset to 0 from time to time. You'll run into problems later.
I think ztrumpet is right - the Y variable automagically gets set to zero whenever you display the graph screen. However, I don't display the graph screen while I'm moving except if I go into the menu (during which I temporarily save the value of Y somewhere else). I've already run into problems with that in which I moved up a screen whenever I exited the menu. It was fixt rather fast.

ztrumpet, it made sense. I need to test that. If it's true (and not that I'm doubting you, but I like to test these things. There should be documentation for that somewhere, or else I can't read), then it would be an interesting speed-for-memory tradeoff (and a good excuse not to use xlib).

Okay, thanks for xcopy syntax. :)
« Last Edit: December 15, 2009, 11:30:16 am by Insorak »
(re)working on Anti-RPG: 3% completion

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Anti-RPG RPG
« Reply #68 on: December 15, 2009, 01:50:36 pm »
Lunch was extraordinarily hectic
A food fight occured? O.o

But yeah the Y glitch is something many people ran into before and they would wonder why their game would not work. Finally when they would post the code I would discover they used Y and that it was always reset to 0. I guess this might just be something to do with Graph screen indeed, though

Offline jsj795

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1105
  • Rating: +84/-3
    • View Profile
Re: Anti-RPG RPG
« Reply #69 on: December 15, 2009, 01:54:48 pm »
I wonder why Y change and X doesn't???


Spoiler For funny life mathematics:
1. ROMANCE MATHEMATICS
Smart man + smart woman = romance
Smart man + dumb woman = affair
Dumb man + smart woman = marriage
Dumb man + dumb woman = pregnancy
2. OFFICE ARITHMETIC
Smart boss + smart employee = profit
Smart boss + dumb employee = production
Dumb boss + smart employee = promotion
Dumb boss + dumb employee = overtime
3. SHOPPING MATH
A man will pay $2 for a $1 item he needs.
A woman will pay $1 for a $2 item that she doesn't need.
4. GENERAL EQUATIONS & STATISTICS
A woman worries about the future until she gets a husband.
A man never worries about the future until he gets a wife.
A successful man is one who makes more money than his wife can spend.
A successful woman is one who can find such a man.
5. HAPPINESS
To be happy with a man, you must understand him a lot and love him a little.
To be happy with a woman, you must love her a lot and not try to understand her at all.
6. LONGEVITY
Married men live longer than single men do, but married men are a lot more willing to die.
7. PROPENSITY TO CHANGE
A woman marries a man expecting he will change, but he doesn't.
A man marries a woman expecting that she won't change, and she does.
8. DISCUSSION TECHNIQUE
A woman has the last word in any argument.
Anything a man says after that is the beginning of a new argument.

Girls = Time * Money (Girls are a combination of time and money)
Time = Money (Time is money)
Girls = Money squared (So, girls are money squared)
Money = sqrt(Evil) (Money is also the root of all evil)
Girls = sqrt(Evil) squared (So, girls are the root of all evil squared)
Girls = Evil (Thus, girls are evil)
*Girls=Evil credit goes to Compynerd255*

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Anti-RPG RPG
« Reply #70 on: December 15, 2009, 02:00:56 pm »
Yeah that always confused me. I mean, X is used by graph screen too afterward >.>

Offline Insorak

  • LV3 Member (Next: 100)
  • ***
  • Posts: 76
  • Rating: +4/-0
  • Omnimaga n00b
    • View Profile
Re: Anti-RPG RPG
« Reply #71 on: December 15, 2009, 02:10:21 pm »
Because the TI-BASIC parser is idiotic.

Okay, I've attached the files. Theta-G is the main file for the movement engine, and theta_G.txt is the source code for that file.

Thanks a bunch, guys! Appreciate it! :)
(re)working on Anti-RPG: 3% completion

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Anti-RPG RPG
« Reply #72 on: December 15, 2009, 02:44:46 pm »
Cool, I'll check out when I get some time

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Anti-RPG RPG
« Reply #73 on: December 15, 2009, 04:27:56 pm »
What do we run first?  All the programs give silly little errors, except for thetaMO.  I really like how it looks, though.

Here's the code for those like Eeems that can't open zips. (Ipod)
Code: [Select]
:While 1
:¦ "θM"+sub("0123456789",{L4}(1),1
:¦ real(10,0,0
:¦ {L4}(2→X
:¦ prgmXTEMP000
:¦ real(10,1,0
:¦ Output(1,1,Str1
:¦ Output({L4}(9),{L4}(8),"π
:¦ {L4}(9→Y:{L4}(8→X
:¦ Repeat X=17 or Y=9 or not(XY
:¦ ¦ {0 //This is unnessecary, as a Repeat loop is a post-test loop.
:¦ ¦ Repeat sum(Ans //change this to sum(Ans={24,25,26,34,21,15
:¦ ¦ ¦ getKey // add →θ
:¦ ¦ ¦ Ans={24,25,26,34,21,15 //get rid of this
:¦ ¦ End
:¦ ¦ sum(Ans{24,25,26,34,21,15→θ //Get rid of this
:¦ ¦ If θ=15
:¦ ¦ prgmTM
:¦ ¦ If θ=21
:¦ ¦ Then
:¦ ¦ ¦ "θM
:¦ ¦ ¦ real(10,0,0
:¦ ¦ ¦ prgmXTEMP000
:¦ ¦ ¦ real(10,1,0
:¦ ¦ ¦ If 2={L4}(4
:¦ ¦ ¦ real(5,0,35
:¦ ¦ ¦ If {L6}(1
:¦ ¦ ¦ real(5,0,2
:¦ ¦ ¦ Output(1,1,Str1
:¦ ¦ End
:¦ ¦ Y→T
:¦ ¦ X→U
:¦ ¦ Y+(θ=34)-(θ=25→Y
:¦ ¦ X+(θ=26)-(θ=24→X
:¦ ¦ If X≠17 and Y≠9 and XY //You could move this to the begining of the loop (before the getKey to save speed)
:¦ ¦ Then
:¦ ¦ ¦ sub(Str1,16(Y-1)+X,1
:¦ ¦ ¦ If Ans=" " or Ans="/" or Ans="-" or Ans="=" or Ans="ñ
:¦ ¦ ¦ Then
:¦ ¦ ¦ ¦ If Ans="ñ
:¦ ¦ ¦ ¦ Then
:¦ ¦ ¦ ¦ ¦ "θM"+sub("0123456789",{L4}(1),1)+"A
:¦ ¦ ¦ ¦ ¦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9
:End
« Last Edit: December 15, 2009, 05:05:41 pm by ztrumpet »

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Anti-RPG RPG
« Reply #74 on: December 15, 2009, 06:03:50 pm »
looks good!
I actually was able to get on the comp right now, but thanks for thinking about me Ztrumpet!
/e