Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.

Functions: break to maintain small size?
Yes! less than 1 page!
 38%  [ 5 ]
No. wasteful.
 61%  [ 8 ]
Total Votes : 13

They are faster, but they are stored in RAM for the life of the program (or until you delete them), so you lose quite a bit of extra memory. Using the functions lets you calculate them on the fly, without having to use more than a few bytes of RAM (though it is a couple clocks slower).
Fair enough. that's different from on calcs, where it would be overall more efficient to use a lookup table than ball into Tl-OS trig functions.
But a GBA has 2 StrongARM processors (one for GB backwards-compatibility, the other for GBA games and such), which is much more powerful than a 6MHz z80 Smile
Either way, one can never have too much RAM.
im sending this to anyone who doesnt understand the FULL issue with the updated code... i took a sceeny of the problem... cuz the prob isnt much of the coding... its decifering where the actual wall is... some walls are completely skipped for lack of gud counter.... hence this pic:

anyone see the real issue now?
yes, i do, and your best bet is to read up at that link i posted about how to just check for a wall at each line-grid intersection, rather than at a specified interval
Ultimate Dev'r wrote:
But a GBA has 2 StrongARM processors (one for GB backwards-compatibility, the other for GBA games and such), which is much more powerful than a 6MHz z80 Smile

And they dare make our calculators expensive. Well that's economics for you, it's all about supply and demand.
something1990 wrote:
And they dare make our calculators expensive. Well that's economics for you, it's all about supply and demand.

lol. i don't think with a graphing calc you are paying for the hardware so much as the software. A GBA is just hardware (for all practical purposes). You then have to purchase any games and such to use it with. For graphing calcs, you pick it based not on hardware but on the software. IF the TI-89 had the same OS as the 83/84 series, do you think as many people would buy it? Of course not! its all about the software
Yeah; when you open up a calc, there's only a few IC's, and then some discrete components...nothing totaling over $20 though Laughing Plus the screens are dirt cheap...
>>z80 calc
>>64k RAM module
>>512k ROM (EEPROM) module

It's actually the LCD driver IC that's the most complex chip on the board.
Ok, I know what you're talking about now Komak. Could you send me the full source code for your game? I'll look through it and see if I can change it around a bit to fix the wall issue. I'll PM you me email.
Are you referring to the jaggedness of the left wall? That looks like some miscalculations with the ray being cast...
That's just from the size of the matrix. Little data, so everything gets rendered super blocky and messed up looking. Can be fixed, but would require a rewrite of half the code.

Speaking of code, Komak: I looked through all the code you emailed me. Everything in it looks & works perfect, so, whatever is wrong has gotta be in the renderWalls() function. I haven't found the problem yet, but I will eventually.
A bit offtopic, but what kind of plans do you have for this eventually? retail?
theres no actual probelem with it except for speed... i need to render the walls faster... >.< yeah... but that blockyness in the wall.... thats jincs program... its missing the wall entirely... if i walk, ill run into the ability to see half of the wall... >.<
sry Kerm.. didnt c ur post till a lil too late... anyways.. this will be turned into a 3D sonic/Chao mini game if you will... and its a contest between me and my other freind... hes doing his on pc... and seeing as i only know gba and ti and vb, i decided y not make it playable on my gba memory card? hehe
I FOUND IT.... MUAHAHAHAHA.... i found the way to find out the distance at an angle... ^.^ im so proud... but i still need help in 1 subject

at the angle, using positions x and y, which wall will it hit first...


|                          .             |
|                         .              |
|                        .               |
|                       .                |
|                      .                 |
|                    X                  |
|                                        |
|                                        |
|                                        |
|                                        |
|                                        |
|                                        |
|                                        |
|                                        .
|                                       .|
|                                     X |
|                                        |
|                                        |
|                                        |
|                                        |

if im in a different spot, the next wall itll hit changes... i need an equation to find this formula... once thats done, ill easily be able to finish the programming off... UC, this is a 1x1 square... once it hits a wall, add the distace to that wall to the total distance. Then, check the next square for a wall, if none, repeat the process with the new set of points...[/code]
Hey where did you get the header files you used for this program?
really sorry for the lack of keeping up with this program... i totally got pissed at it.. but im back onto it... (though i changed the language to make it fast(much))... now its in VB so every1 knows how to do this....

anywhos.... i found out a way to find the distance to the walls and at each angle interval... ive come to the realization that thats not going to work so well.... so -_- ive come to a new method that will help out ^.^ but only by a little bit...

heres the code im using right now to find out which wall it hits first and how to find the distance to that wall at the given angle:


-While i havent reached the last pixel on the created screen(350x500)
        While dblCount < 500
-get distance to left, right, top and bottom walls using our location
            dblLeft = dblX - Int(dblX)
            dblRight = 1 - dblLeft
            dblTop = dblY - Int(dblY)
            dblBottom = 1 - dblTop

-errors in getting the angle from tangent (Tan-1 on Calcs)
            'dblC1 = iTan(dblTop / dblRight)
            'dblC2 = iTan(dblRight / dblBottom) + 90
            'dblC3 = iTan(dblBottom / dblLeft) + 180
            'dblC4 = iTan(dblLeft / dblTop) + 270
since im not worried about moving yet, these will never change
            dblC1 = 45
            dblC2 = 135
            dblC3 = 225
            dblC4 = 315

-reference to Sine(o/h) Cosine(a/h) and Tangent(o/a)
            'Soh Cah Toa
-reset distance
            dblDist = 0

-|         |
-X    O   X
-|         |

-if it hits the right side
            If intAngle(0) >= dblC1 And intAngle(0) < dblC2 Then
-did it hit the upper or lower part of the right side
                If intAngle(0) <= 90 Then
                    dblDist = (dblRight / (Cos(intAngle(0))))
                    intScout = 2
                    dblDist = (dblRight / (Cos(intAngle(0))))
                    intScout = 3
                End If
            End If
-if it hit the bottom wall
            If intAngle(0) >= dblC2 And intAngle(3) < dblC3 Then
-did it hit the left or right side of the bottom wall
                If intAngle(0) <= 180 Then
                    dblDist = (dblBottom / (Cos(intAngle(0))))
                    intScout = 4
                    dblDist = (dblBottom / (Cos(intAngle(0))))
                    intScout = 5
                End If
            End If
-if it hit the left wall
            If intAngle(0) >= dblC3 And intAngle(4) < dblC4 Then
-did it hit the upper or lower of the left wall
                If intAngle(0) <= 270 Then
                    dblDist = (dblLeft / (Cos(intAngle(0))))
                    intScout = 6
                    dblDist = (dblLeft / (Cos(intAngle(0))))
                    intScout = 7
                End If
            End If
-if it hit the left of the top wall
            If (intAngle(0) >= dblC4 And intAngle(0) <= 360) Then
                    dblDist = (dblTop / (Cos(intAngle(0))))
                    intScout = 8
            End If
-if it hit the right of the top wall
            If (intAngle(0) >= 1 And intAngle(0) < dblC1) Then
                dblDist = (dblTop / (Cos(intAngle(0))))
                intScout = 1
            End If
-int Scout is used for a map i programmed to tell me where its hitting the wall at (which i noticed its not measuring corectly)

-if the distance is higher than the program can handle without recieving an overflow error, shorten it
            If dblDist > 4.4 Then dblDist = 4.4
-grab the walls view-height
            intLHeight = (Tan(89) * dblDist)
-if the height would exceed the given map sice, shrink it to fit
            If intLHeight > 250 Then intLHeight = 250

-draw a line (color(), X1, Y1, X2, Y2) pretty much just a verticle line where the wall was located at
            Me.CreateGraphics.DrawLine(System.Drawing.SystemPens.FromSystemColor(System.Drawing.SystemColors.WindowText), intCount, 0, intCount, intLHeight)
-start on the next angle
            dblCount = dblCount + dblINC
            intCount = dblCount
            intAngle(0) = intAngle(0) + 1
            If intAngle(0) > 360 Then intAngle(0) = intAngle(0) - 360
        End While
You DO realize that VB will be MUCH slower than C/C++?
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 3 of 4
» All times are GMT - 5 Hours
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum