Author Topic: 22 FPS 3D graphics on HP Prime! (sort-of)  (Read 16910 times)

0 Members and 1 Guest are viewing this topic.

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
22 FPS 3D graphics on HP Prime! (sort-of)
« on: November 09, 2013, 08:29:38 pm »
I was experimenting with the BLIT_P and DIMGROB_P commands then modified my scrolling sprite sheet program, and this is the result that I got: Pseudo 3D graphics running at 16 images per second (160x120 resolution) on the real calculator! *.*



Ok I know this is a particularly cheap way to do it, but if you changed the background of the front graphics to a texture that can be superposed fine (such as the bricks, plain tiles or rocky stuff), it would work well. Now imagine if every layer were pre-rendered into a large GROB, so that no scaling is done during runtime (except the weird camera angle effect).

EDIT: Replaced large GIF with youtube video

EDIT 2: I fixed the transparency issues causing purple to appear.
« Last Edit: November 16, 2013, 12:51:25 am by DJ Omnimaga »

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #1 on: November 10, 2013, 04:01:13 am »
HOLY ... *.*

Offline Eiyeron

  • Urist McEiyolobster
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1430
  • Rating: +130/-10
  • (-_(//));
    • View Profile
    • Rétro-Actif : Rétro/Prog/Blog
Re: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #2 on: November 10, 2013, 04:17:06 am »
Nice, now implements a parralax scrolling lib!

Offline AssemblyBandit

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 374
  • Rating: +60/-1
  • ~AssemblyBandit~
    • View Profile
    • briandm82.com
Re: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #3 on: November 10, 2013, 04:26:05 am »
Can't wait to see what you do with this!!!

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #4 on: November 10, 2013, 08:18:16 am »
wow, just wow, that is so epic!
* Sorunome suddenly imagines Majoras Mask on the prime :P

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

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: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #5 on: November 10, 2013, 08:39:48 am »
It looks supprisingly well, but if you have to scale so many images at runtime, isn't 'normal' 3D or raycasting more efficient?
EDIT: but if they are pre-rendered (or rendered at the start of the program) it would indeed be more efficient.
« Last Edit: November 10, 2013, 08:41:09 am by ben_g »
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 Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #6 on: November 10, 2013, 09:06:46 am »
That is fantastic O.O Wow. :thumbsup:

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: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #7 on: November 10, 2013, 11:39:24 am »
Lol thanks, I was wondering if this would get any attention since people would look last night but not reply (except one person in the Youtube vid and Kerm on Cemetech) :P, but yeah, after seeing poor performance from a zoomed in mapper that I was drawing 5 times a while ago, I never thought that this 3D effect would be this fast.

There are some quirks, though:
-If you zoom out too far, it's very slow. On the other hand, it seems that adding 8 extra layers in front of the rest rather than on the back without zooming out doesn't impact speed that much. So basically, games have to remain close to the camera and if your levels are very deep, the game would probably have to only render the closest stuff, meaning that you wouldn't see very far.
-It is not wireframe. I could add a camera rotate feature so you can look to the left or right to a certain extent, but you wouldn't be able to look very far.
-Animated tiles are probably a no-go, unless levels or rooms are very small, since it would take a lot of space the way they are stored.


Now I'll need to make the engine portable before I can even think about making a game, though. For example, I need to ensure that camera angles and the perspective are perfectly aligned and that I can freely move around. I also need to make better graphics that are suitable for such engine. I hope that HP calcs supports functions with arguments, so that I can call the 3D function whenever I need it and possibly do some animations as well.

Nice, now implements a parralax scrolling lib!
Actually what I use is some extreme form of parallax scrolling. Notice how there are like 8 tilemap layers scrolling around at different speed to create the 3D effect. :P However, the layers are zoomed out rather than being the same size, and there's some sort of camera angle. The fact that it's parallax is why I considered pre-rendering every layer once, but that would probably fill the entire game RAM during runtime if levels were large. It would most likely improve speed a lot, though, because displaying non-scaled graphics is MUCH faster than scaled ones. Of course, pre-rendering would be out of the question if my engine ever added zooming in/out, since the scaling involved would defeat the point of pre-rendering everything.

It looks supprisingly well, but if you have to scale so many images at runtime, isn't 'normal' 3D or raycasting more efficient?
EDIT: but if they are pre-rendered (or rendered at the start of the program) it would indeed be more efficient.
I once tried to pxl-on the entire screen, pixel by pixel, and the results were not convincing. In my engine, the entire tilemap is actually pre-rendered, just not the scaling effect. Filling the screen with lines one by one isn't too bad, but I worry that the more complicated calculations involved in raycasting would make such engine even slower.

EDIT: On a side note, if the engine is used for a top-down view game rather than side-scroller, I could just rotate the camera angle effect :P
« Last Edit: November 10, 2013, 11:53:24 am by DJ Omnimaga »

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +153/-23
    • View Profile
Re: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #8 on: November 10, 2013, 12:38:20 pm »
I'm not an expert in the gaming arena but this does look rather good me! I know you're already over the top in points terms, +1 nevertheless. ;)
As a side note, BUT, BUT what do you mean by: "I hope that HP calcs supports functions with arguments ..." What?? O.O

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: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #9 on: November 10, 2013, 01:54:16 pm »
I mean stuff like in computer languages, such as:

prgm Zelda()
<code>
FadeOutEffect()
<more code>
func FadeOutEffect()
<code for fadeout effect>
Return
End

IIRC, the TI-89 and the Nspire supported them and I heard that the Prime did too, but I wasn't sure. I know that the 84+CSE lacks functions, which requires you to use external sub-routines or extra variables. Not that the lack of functions would be much of an issue for me, but it would make it easier to code if they are actually supported, since I could easily call my map engine from anywhere I want.

EDIT: By the way, I can now display the frame rate in real time. Here's how you do it:

At the beginning of your loop, add the following code:

Code: [Select]
TICKS->T
Then at the end, add the following:

Code: [Select]
TEXTOUT_P(IP(1000/(TICKS-T)),G0,0,0,1,RGB(255,255,255));
« Last Edit: November 10, 2013, 04:55:19 pm by DJ Omnimaga »

Offline SpiroH

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +153/-23
    • View Profile
Re: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #10 on: November 11, 2013, 02:51:04 am »
... I know that the 84+CSE lacks functions, which requires you to use external sub-routines or extra variables.
Well, this is really ancient programming practice, imho, hence my astonished question.

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: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #11 on: November 11, 2013, 03:42:15 pm »
Oh ok. To be honest, though, since I used TI-BASIC for so long, it took me ages to understand a bit about how functions work, and I had no problem working without them since I knew how to get around it (for example, using an extra variable to detect when I need to get out of a loop then enter a new one when needed).

In fact, maybe I should try things that way on the Prime too then try functions, just to compare speed, in case there would be a difference (we never know. After all, TI managed to make Lbl/Goto and running sub-programs brutally slow).

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #12 on: November 12, 2013, 12:47:37 am »
(we never know. After all, TI managed to make Lbl/Goto and running sub-programs brutally slow).
Not only Gotos are slow but they also slow down progressively. I once made a loop with a Goto (when I didn't know about While yet (that was a while ago, see what I did here ?)) and noticed that the game was running slower and slower after each iteration.
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

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: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #13 on: November 12, 2013, 12:59:24 am »
It depends if you used them properly. If you put a Goto inside an if:then block or a While/Repeat loop (basically, before the End command), the memory that the block/loop took will never get cleared. As a result, Gotoing out of a block/loop over and over slowly depletes your RAM, causing slowdowns then an eventual ERR:MEMORY.

Even when used properly, however, Gotos are still slow. Back when they were used on a regular basis, it was semi-common to see games coded like this:

Code: [Select]
Goto 1
Lbl 2
<very large gameplay code>
<Game over>
Lbl 1
<title screen code>
<menu code>
<Goto 0 to exit>
<Goto 2 to start game>
Goto 0

The lower a Lbl is inside the code, the longer it takes to reach it, even if the Goto command was right next to it, because Goto starts searching from the very start of the program.


Also, in some rare cases, using Lbl/Goto was actually faster than While/End. If the loop was very small and placed at the start of the code (such as the example above), that is. Otherwise, the speed was just atrocious. Even in cases where it's faster, however, the speed gain is usually negligible, especially on the 84+CSE, where drawing huge shapes or images is slow.
« Last Edit: November 12, 2013, 01:14:00 am by DJ Omnimaga »

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: 16 FPS 3D graphics on HP Prime! (sort-of)
« Reply #14 on: November 14, 2013, 02:20:49 am »
« Last Edit: November 14, 2013, 02:21:22 am by DJ Omnimaga »