Author Topic: Flip  (Read 4591 times)

0 Members and 1 Guest are viewing this topic.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Flip
« on: September 04, 2011, 11:01:55 am »
* sigh
There hasn't been much activity in the good ol' TI-BASIC section, has there?

Anyway, I had an idea last night, so I went off to make my first serious TI-BASIC program in over a year. Right now it doesn't have much, but it seems reasonably fast enough that a simple physics platformer could come out of it.

The biggest challenge, as with gravity in Axe and any other language, was how to make it detect a collision when the character could be traveling ten pixels in one frame. This program does that with list operations, which I've found to be the most powerful yet overlooked aspects of TI-BASIC.

Of course, the more platforms there are, the slower it gets. Here's the program running with one platform:

http://img.removedfromgame.com/imgs/t1.gif

Here it is running with four:

http://img.removedfromgame.com/imgs/t4.gif

And here's a full eight:



(Only one image here because some browsers (*cough* Safari) crash when they see a page with more than one animation.

All these screenshots are of a plain TI-83 Plus. On a TI-84, it's several times faster -- the perfect speed for a platformer:

http://img.removedfromgame.com/imgs/u8.gif

On the other hand, it would definitely slow down once enemies and other game components are added, but right now (on TI-84s) it's too fast for the TI-OS's keypresses anyway. (Arrow keys always pause a bit before repeating.)

Again, I'm not sure if I'll actually make a game of this, but it was a quick and fun little challenge to go back to TI-BASIC again.
« Last Edit: December 10, 2011, 11:59:01 pm by Deep Thought »




Offline ralphdspam

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 841
  • Rating: +38/-1
  • My name is actually Matt.
    • View Profile
Re: Real gravity in pure TI-BASIC
« Reply #1 on: September 04, 2011, 01:03:53 pm »
Wow!  It looks very nice!  :D
ld a, 0
ld a, a

Offline ben_g

  • Hey cool I can set a custom title now :)
  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +125/-4
  • Asm noob
    • View Profile
    • Our programmer's team: GameCommandoSquad
Re: Real gravity in pure TI-BASIC
« Reply #2 on: September 04, 2011, 02:54:52 pm »
looks good.

The problem with it being slower with more platforms can be solved by dividing the screen in 4 (or more) sections, then only check for collision in the section the player is in.
My projects
 - The Lost Survivors (Unreal Engine) ACTIVE [GameCommandoSquad main project]
 - Oxo, with single-calc multiplayer and AI (axe) RELEASED (screenshot) (topic)
 - An android version of oxo (java)  ACTIVE
 - A 3D collision detection library (axe) RELEASED! (topic)(screenshot)(more recent screenshot)(screenshot of it being used in a tilemapper)
Spoiler For inactive:
- A first person shooter with a polygon-based 3d engine. (z80, will probably be recoded in axe using GLib) ON HOLD (screenshot)
 - A java MORPG. (pc) DEEP COMA(read more)(screenshot)
 - a minecraft game in axe DEAD (source code available)
 - a 3D racing game (axe) ON HOLD (outdated screenshot of asm version)

This signature was last updated on 20/04/2015 and may be outdated

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: Real gravity in pure TI-BASIC
« Reply #3 on: September 04, 2011, 02:56:12 pm »
The problem with that is that it becomes difficult to address the lists efficiently if you have four different sections. TI-BASIC has very limited symbol selection.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Real gravity in pure TI-BASIC
« Reply #4 on: September 04, 2011, 03:00:43 pm »
The problem with it being slower with more platforms can be solved by dividing the screen in 4 (or more) sections, then only check for collision in the section the player is in.
Unfortunately that would make it slower as a whole, because I'd need to test which section it's in (and on borders, sections overlap).




Offline Juju

  • Incredibly sexy mare
  • Coder Of Tomorrow
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 5730
  • Rating: +500/-19
  • Weird programmer
    • View Profile
    • juju2143's shed
Re: Real gravity in pure TI-BASIC
« Reply #5 on: September 04, 2011, 03:19:12 pm »
Looks pretty nice indeed. Of course it's better in Axe, but making this in BASIC would be cool.

Remember the day the walrus started to fly...

I finally cleared my sig after 4 years you're happy now?
THEGAME
This signature is ridiculously large you've been warned.

The cute mare that used to be in my avatar is Yuki Kagayaki, you can follow her on Facebook and Tumblr.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Real gravity in pure TI-BASIC
« Reply #6 on: September 04, 2011, 04:27:38 pm »
That sounds like you have some very very clever list operations going on right there!  What kind of algorithms are you employing? 

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Real gravity in pure TI-BASIC
« Reply #7 on: September 04, 2011, 08:32:31 pm »
They're not really clever. I just meant I think too often we overlook the fact that lists in BASIC can be added, subtracted, multiplied, divided, and compared with each other and real numbers much faster than loops.
« Last Edit: December 10, 2011, 11:34:03 pm by Deep Thought »




Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Real gravity in pure TI-BASIC
« Reply #8 on: September 04, 2011, 10:22:43 pm »
Nice stuff Deep. It's fun to see what can be done in TI-BASIC.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

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: Real gravity in pure TI-BASIC
« Reply #9 on: September 11, 2011, 03:11:34 pm »
This is pretty awesome, Deep.  I certainly think something cool could be made of this; if it can be made faster, would you continue work on it?

Edit:  I decided to optimize what I saw to optimize in the main loop: (Code "removed" by request)
:Repeat K=20
:getKey-25→K
:C+2→C
:Ans+A→F
:max((Ans-L1)(B≥L2 and B≤L3 and Ans≥L1 and A≤L1
:If Ans
:Then
:DelVar CF-Ans→F
:If K=‾4
:‾10→C
:End
:B+2K(1=abs(K
:If F-A or Ans-B
:Then
:Text(‾1,A,B,"
:Text(‾1,F,Ans,"°
:RecallPic 0
:Ans→B
:F→A
:End
:End


Edit 2: Optimized more. :D
« Last Edit: December 10, 2011, 11:54:44 pm by ztrumpet »

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: Real gravity in pure TI-BASIC
« Reply #10 on: September 11, 2011, 03:17:16 pm »
Awesome, I always love to see you guys making cool programs in TI-Basic!

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Real gravity in pure TI-BASIC
« Reply #11 on: September 26, 2011, 07:32:34 pm »
ztrumpet, amazing. I shifted the B stuff around and squeezed two more bytes out of that :D

Unfortunately, it's now hopelessly slow on a TI-83 Plus, and I haven't even added enemy hit detection yet D:





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: Goal
« Reply #12 on: September 26, 2011, 08:31:05 pm »
Hey Deep, take the "-1," out of ":Text(‾1,F,G,"°".  It'll look the same, except it won't erase quite as big of a spot.  Other than that, it looks really awesome. :D
« Last Edit: September 26, 2011, 08:31:22 pm by ztrumpet »

Offline boot2490

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 607
  • Rating: +54/-36
    • View Profile
    • Boot2490's Stuff
Re: Goal
« Reply #13 on: September 26, 2011, 08:31:06 pm »
I made something like this for a ti basic developer contest...
I tried to make a basketball free throw for the 1K contest.
The program was actually REALLY FUCKING AMAZING. It would do a simple power and angle bar and then when you actually let go of the ball, it simulated a real parabola (I checked the formula later) and it ran BLAZING fast. To make an arc from the bottom left to the middle of the wall took ONE SECOND at most, and then IT BOUNCED OFF THE WALL AND FLOOR. It simulated bouncing, gravity, force, and angle, and it was 600 BYTES. I should post it some time.
I'm not worried about SOPA creating censorship, that will not stand for long. I'm worried that they'll succeed in stopping piracy!

Spoiler For Signature, updated march 23, 11:28 PM EST:















An useful tool!

PM me if you need some help. I am glad to be of assistance and part of the TI Communnity.

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Goal
« Reply #14 on: September 26, 2011, 08:32:53 pm »
Hey Deep, take the "-1," out of ":Text(‾1,F,G,"°".  It'll look the same, except it won't erase quite as big of a spot.
But it would be slower :/ Maybe.
Other than that, it looks really awesome. :D
Thanks!