Author Topic: Optimize level loading from external file  (Read 898 times)

0 Members and 1 Guest are viewing this topic.

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Optimize level loading from external file
« on: June 19, 2011, 12:31:18 pm »
Can I optimize this?
Code: [Select]
Lbl LV
If r1=1
prgrmSTAGE1
End
If r1=2
prgrmSTAGE2
End
etc.

If you like my work: why not give me an internet?








Offline leafy

  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1554
  • Rating: +475/-97
  • Seizon senryakuuuu!
    • View Profile
    • keff.me
Re: Optimize level loading from external file
« Reply #1 on: July 06, 2011, 01:03:16 am »
I'm assuming this is axe:

Code: [Select]
Lbl LV
!If r1-1
prgmSTAGE1
Else!If -1
prgmSTAGE2
Else!If -1
prgmSTAGE3
etc.
End
Return
In-progress: Graviter (...)

Offline z80man

  • Casio Traitor
  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 977
  • Rating: +85/-3
    • View Profile
Re: Optimize level loading from external file
« Reply #2 on: July 06, 2011, 01:09:57 am »
Here it looks like a look up table would be the best option depending on the number of options, but I'm no Axe expert and don't know how to do that. My suggestion though would be maybe if you could have a list of pointers to the other source files then have the r1 index jump to what it's offset points to.

List of stuff I need to do before September:
1. Finish the Emulator of the Casio Prizm (in active development)
2. Finish the the SH3 asm IDE/assembler/linker program (in active development)
3. Create a partial Java virtual machine  for the Prizm (not started)
4. Create Axe for the Prizm with an Axe legacy mode (in planning phase)
5. Develop a large set of C and asm libraries for the Prizm (some progress)
6. Create an emulator of the 83+ for the Prizm (not started)
7. Create a well polished game that showcases the ability of the Casio Prizm (not started)

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Optimize level loading from external file
« Reply #3 on: July 06, 2011, 01:15:32 am »
I'd go with the lookup table idea. It's certainly possible in Axe if you have pointers to those files. Otherwise, since the level names are all the same size, you could store those mashed together in a big string and use r1*7 to index the file names in the string. An even more optimized way to do that would be to store a null value after each string like "prgmSTAGE1"[00]"prgmSTAGE2"[00]->Str1 and use r1*2*2*2 to index the string.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ