Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Platformer (Climber)
Index -> Programming, Turing -> Turing Submissions
Goto page Previous  1, 2, 3  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Beastinonyou




PostPosted: Tue Oct 18, 2011 10:17 pm   Post subject: Re: Platformer (Climber)

I guess I'm the first to notice this, and post it.

People won't even get past the credits. I'm going to leave it for you to figure it out, but it is very obvious given the error message:

Turing:

for i : 0 .. maxy + 300
    var fontt : int := Font.New ("TimesNewRoman:14")
    var y : int := i
    cls
    Font.Draw ("Credits:", maxx div 2 - 5, y, fontt, purple)
    Font.Draw ("I'd like to personally thank,", maxx div 2 - 5, y - 30, fontt, purple)
    fontt := Font.New ("TimesNewRoman:20")
    Font.Draw ("Tony", maxx div 2 - 5, y - 100, fontt, brightred)
    Font.Draw ("And", maxx div 2 - 3, y - 150, fontt, black)
    Font.Draw ("Zren", maxx div 2 - 5, y - 200, fontt, green)
    fontt := Font.New ("TimesNewRoman:14")
    Font.Draw ("Thank you both for all the amazing help!", maxx div 2 - 40, y - 280,fontt, black)
    View.Update
    delay (25)
end for


Error Message: Cannot Allocate Item. Out of id numbers (max 1000)


Any idea as to why you get that error? I know why =P


Also, after playing the game past the credits (after i modified your above code to get past the credits), I receive the same error moments later in the second map, hint: Your exact same problem as above, occurs in the following procedure.

Turing:

% Draw the outlines / all text
proc drawoutlines


As an observation, am I supposed to only reach the second map? and maybe you should move the Credits to the end of the game, or have a button that runs that for credits, rather than waiting 30 seconds before the program starts to run.


=D
Sponsor
Sponsor
Sponsor
sponsor
Aange10




PostPosted: Wed Oct 19, 2011 4:30 pm   Post subject: Re: Platformer (Climber)

Beastinonyou @ 18/10/2011, 9:17 pm wrote:
I guess I'm the first to notice this, and post it.

People won't even get past the credits. I'm going to leave it for you to figure it out, but it is very obvious given the error message:

Turing:

for i : 0 .. maxy + 300
    var fontt : int := Font.New ("TimesNewRoman:14")
    var y : int := i
    cls
    Font.Draw ("Credits:", maxx div 2 - 5, y, fontt, purple)
    Font.Draw ("I'd like to personally thank,", maxx div 2 - 5, y - 30, fontt, purple)
    fontt := Font.New ("TimesNewRoman:20")
    Font.Draw ("Tony", maxx div 2 - 5, y - 100, fontt, brightred)
    Font.Draw ("And", maxx div 2 - 3, y - 150, fontt, black)
    Font.Draw ("Zren", maxx div 2 - 5, y - 200, fontt, green)
    fontt := Font.New ("TimesNewRoman:14")
    Font.Draw ("Thank you both for all the amazing help!", maxx div 2 - 40, y - 280,fontt, black)
    View.Update
    delay (25)
end for


Error Message: Cannot Allocate Item. Out of id numbers (max 1000)


Any idea as to why you get that error? I know why =P


Also, after playing the game past the credits (after i modified your above code to get past the credits), I receive the same error moments later in the second map, hint: Your exact same problem as above, occurs in the following procedure.

Turing:

% Draw the outlines / all text
proc drawoutlines

=D


Hmm, I'm not sure. If I could re create the error, I could probably fix it. The only thing I know of that involves a 1000 limit is pictures... Which my text has nothing to do with. Everything works perfectly fine for me. Do you have any idea why both of these are flawless on my computer, and my school's computer, but do not work on yours?

Also

Beastinonyou wrote:


As an observation, am I supposed to only reach the second map? and maybe you should move the Credits to the end of the game, or have a button that runs that for credits, rather than waiting 30 seconds before the program starts to run.



I doubled the speed, but I want to keep it at the front. I want people to see those who helped a lot
Tony




PostPosted: Wed Oct 19, 2011 4:48 pm   Post subject: Re: Platformer (Climber)

Aange10 @ Wed Oct 19, 2011 4:30 pm wrote:
on my computer, and my school's computer, but do not work on yours?

Resolution, window size, fonts available to the system...

"but it works on _my_ computer" is more of an industry's inside-joke than a legitimate excuse.

Aange10 @ Wed Oct 19, 2011 4:30 pm wrote:
I want people to see those who helped a lot

That's a nice gesture, but typically games do keep credits at the end. I think some games choose non-blocking methods, such as making a message be a part of the level itself. Basically -- making players wait is bad news; reminds me of http://compsci.ca/blog/now-loading-loading-bar-anti-pattern/
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Aange10




PostPosted: Wed Oct 19, 2011 5:52 pm   Post subject: Re: Platformer (Climber)

Tony @ 19/10/2011, 3:48 pm wrote:

Resolution, window size, fonts available to the system...


I thought about that, but the resolution/window size is pre set, and the fonts are in turing itself...?
Tony




PostPosted: Wed Oct 19, 2011 5:53 pm   Post subject: RE:Platformer (Climber)

no, no, and no.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Aange10




PostPosted: Wed Oct 19, 2011 6:09 pm   Post subject: RE:Platformer (Climber)

Turing:
View.Set ("offscreenonly,graphics:700;500,position:center;center,nobuttonbar")


Doesn't set the screen size to 700x 500y?

...
And how do i go about fixing the bug if I can't recreate it to test solutions
Tony




PostPosted: Wed Oct 19, 2011 6:17 pm   Post subject: Re: RE:Platformer (Climber)

Sure, but is the window resizable by the user? If so, it could be stretched much further on a system running at a larger resolution that yours.
Aange10 @ Wed Oct 19, 2011 6:09 pm wrote:
And how do i go about fixing the bug if I can't recreate it to test solutions

That is indeed a problem.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
mirhagk




PostPosted: Wed Oct 19, 2011 6:22 pm   Post subject: RE:Platformer (Climber)

Well there is a key fundamental problem that we can all see, fixing that issue does not require compiling it, it requires looking at the error message, and the code. I'll tell you what line it's on (haven't run the code but I'm pretty sure)
Turing:

var fontt : int := Font.New ("TimesNewRoman:14")
Sponsor
Sponsor
Sponsor
sponsor
Beastinonyou




PostPosted: Wed Oct 19, 2011 6:24 pm   Post subject: Re: RE:Platformer (Climber)

mirhagk @ Wed Oct 19, 2011 6:22 pm wrote:
Well there is a key fundamental problem that we can all see, fixing that issue does not require compiling it, it requires looking at the error message, and the code. I'll tell you what line it's on (haven't run the code but I'm pretty sure)
Turing:

var fontt : int := Font.New ("TimesNewRoman:14")


Precisely =P
mirhagk




PostPosted: Wed Oct 19, 2011 6:30 pm   Post subject: RE:Platformer (Climber)

Also I can tell you why Beastinyou came across it and you didn't. And it's not resolution, it's the fact that he saw the credits twice. Again, can't say for sure, but it's an educated guess.
Beastinonyou




PostPosted: Wed Oct 19, 2011 6:42 pm   Post subject: Re: Platformer (Climber)

If I May Elaborate, You get the exact same error in this Situation:

Turing:

drawfillbox (200, 200, 210, 210, black)
for i : 1 .. 1200
    var picture : int := Pic.New (200, 200, 210, 210)
end for


This should give you a giant clue.....
Aange10




PostPosted: Wed Oct 19, 2011 7:27 pm   Post subject: Re: Platformer (Climber)

Fixed?


and

Tony wrote:

Aange10 @ Wed Oct 19, 2011 6:09 pm wrote:
And how do i go about fixing the bug if I can't recreate it to test solutions

That is indeed a problem.


I take it there is no way, then. I guess that's why there are testers



Platformer V1,0,1.rar
 Description:

Download
 Filename:  Platformer V1,0,1.rar
 Filesize:  42.58 KB
 Downloaded:  63 Time(s)

Tony




PostPosted: Wed Oct 19, 2011 7:36 pm   Post subject: RE:Platformer (Climber)

It might just take a lot more effort to reproduce such a bug. A bug could potentially happen only on a specific hardware/OS/3rd-party-software combination -- such an environment could be acquired (virtualization makes this cheaper, though still very time consuming), though typically it is not feasible to test through all of the possible permutations.

Heisenbug (such as problems with the compiler or certain cases when dealing with concurrency) are a lot more interesting. http://en.wikipedia.org/wiki/Unusual_software_bug#Heisenbug
Quote:

A heisenbug (named after the Heisenberg Uncertainty Principle) is a computer bug that disappears or alters its characteristics when an attempt is made to study it.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Beastinonyou




PostPosted: Wed Oct 19, 2011 8:56 pm   Post subject: Re: Platformer (Climber)

I see you've changed a few things, such as moving the font declarations to the top, and using a couple Font.Free()'s in there.

However, 34 Seconds from the time I entered my Username, and Was able to move the Character, I come to the same error.

Turing:

proc drawoutlines
    font2 := Font.New ("TimeNewRoman:20")


Firstly, I notice there's no 's' on the end of Time, so I'm not sure if that will even set the font it properly. However, this isn't the major issue.

Might I suggest, that rather than changing a font over and over, multiple times (even if you are using Font.Free), in a loop, Wouldn't it be Much Much more simpler to make a couple fonts at the beginning. Example:

You are (Correct me if I'm wrong) doing this (essentially, in regards to the fonts):
Turing:

var font : int := Font.New ("TimesNewRoman:20")
loop    % Main Program
    Font.Draw ("Using Font", 100, 100, font, black)
    font := Font.New ("TimesNewRoman:15")   % Change font
    Font.Draw ("Using Font Altered", 100, 120, font, black)
    font := Font.New ("TimesNewRoman:10")   % Change font again
    Font.Draw ("Using Font Altered Again", 100, 140, font, black)
    Font.Free (font)    % Freeing font
    font := Font.New ("TimesNewRoman:5")    % Changing font again
    cls
end loop


You could do this instead:

Turing:

var fontSize20 : int := Font.New ("TimesNewRoman:20")
var fontSize15 : int := Font.New ("TimesNewRoman:15")
var fontSize10 : int := Font.New ("TimesNewRoman:10")
var fontSize5 : int := Font.New ("TimesNewRoman:5")

loop % Main Program
    Font.Draw ("Using Font Size 20", 100, 100, fontSize20, black)
    Font.Draw ("Using Font Size 15", 100, 120, fontSize15, black)
    Font.Draw ("Using Font Size 10", 100, 140, fontSize10, black)
    Font.Draw ("Using Font Size 5", 100, 150, fontSize5, black)
end loop


Now, say you didn't want to write those boring Declaration lines for the font's, you could do this:

Turing:

var myFontSizes : array 1 .. 4 of int := init (20, 15, 10, 5)% Sizes I want
var font : array 1 .. upper (myFontSizes) of int % Fonts used, retaining to how many size's you've chosen

% Initializes whatever number of font's as the number of Sizes you've chosen
for i : 1 .. upper (myFontSizes)
    font (i) := Font.New ("TimesNewRoman:" + intstr(myFontSizes(i)))
end for

% Draws all the fonts you've initialized
for i : 1 .. upper (myFontSizes) 
    Font.Draw ("Font Size:" + intstr(myFontSizes(i)), 100, 100 + (i * 25), font (i), black)
end for


Aside from this, I Advise organizing your code in a more readable manner, and grouping certain things together.
Variables related to a certain thing should be grouped with other variables involved with that same thing. Cramming your variables into one declaration line may seem to be nice by saving Lines, but it's much more easily readable, to find your variables.

I also notice that for the majority of the programming, there are rarely spaces, sometimes two lines with "%", but it doesn't make it a whole lot clearer. Try to separate some of the Structures a bit more.

Lastly, I would like to ask why is it that you are Freeing your Pictures at all? You only have: 15 Pictures; 5 of Scenery, and 10 of your Character.
At Most, this should be 15 declarations for your pictures.
You don't have to Free stuff, if you aren't having your photo's repeatedly loading. You only need 15 slots (out of what? 1000?)

Declare your pictures Outside of your Loop for your Main Program, Therefore not constantly being loaded, and not needing to be Freed.

You could hardcode each declaration line for all your pictures, or use an array and a For repetitive structure to initialize those pictures with numbers on the end.
Let me end off on this long post I've spent the last hour on, while watching Episode 3 of Dexter (S.6), and Currently, Penn & Teller: Tell A Lie

Turing:

% The Other 5 Pictures with no common name
var portal : int := Pic.FileNew ("portal.bmp")
var sky1 : int := Pic.FileNew ("sky1.bmp")
var skyplat1 : int := Pic.FileNew ("sky_plat_1.bmp")
var sand : int := Pic.FileNew ("sand.bmp")
var palmtree : int := Pic.FileNew ("palmtree.bmp")

% Array's to store the picture ID's of Douggie and Player
var douggieClip : array 1 .. 4 of int
var playerClip : array 1 .. 6 of int

% Initialize the 4 Douggie Clips
for i : 1 .. upper (douggieClip)
    douggieClip (i) := Pic.FileNew ("douggie_clip_" + intstr (10 + i)) % Your Douggie Clips count from 10 to 14 (1 to 4( + 10))
end for

% Initialize the 6 Player Clips
for i : 1 .. upper (playerClip)
    playerClip (i) := Pic.FileNew ("player_clip_" + intstr (i))
end for
Aange10




PostPosted: Wed Oct 19, 2011 9:41 pm   Post subject: Re: Platformer (Climber)

beastinonyou wrote:

Turing:

font2 := Font.New ("TimeNewRoman:20")



I feel fail for missing that line. Also for the misspelling.


The font thing.. Genius! I can't believe I didn't think of that. Excellent! Thankyou!


Fix?



Platformer V1,0,1.rar
 Description:

Download
 Filename:  Platformer V1,0,1.rar
 Filesize:  42.56 KB
 Downloaded:  90 Time(s)

Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 2 of 3  [ 35 Posts ]
Goto page Previous  1, 2, 3  Next
Jump to:   


Style:  
Search: