Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Compynerd255

Pages: 1 ... 16 17 [18] 19 20 ... 24
256
Axe / Key Timers
« on: March 15, 2011, 10:49:04 am »
I started this topic not because I have a question, but I have something cool to share. By default, in Axe, you can either use GetCSC to read your keys or read the input directly. However, this means that the key either responds once per press or responds as long as it is held down. What if you would like the key to instead respond every few frames, like a variable key repeat function? The solution is a key timer, which I will demonstrate below:

1. Set aside an area of free RAM, one byte per key you plan to read (the example uses 4 keys, one for each directional arrow):
Code: [Select]
0→L1
Fill(L1, 2

2. Create a subroutine that updates the key timers for each key:
Code: [Select]
{L1}+1*getKey(1)→{L1}
{L1+1}+1*getKey(2)→{L1+1}
{L1+2}+1*getKey(3)→{L1+2}
{L1+3}+1*getKey(4)→{L1+3}
Alternatively, instead of +1, you can add a variable that is updated by an interrupt.

3. After calling that subroutine, check for each key like so and preform the action:
Code: [Select]
If {L1}+1<127
...action...
End
...check the other keys...

4. After doing all you want to with the key, insert the following between your action and the End:
Code: [Select]
{L1}-[key delay in frames]→{L1}

The total effect of this code means that a key will register the instant it is pressed, and will then repeat in the delay you set.
This code is useful because not only does it let you control your key repeats, but it also condenses all your direct key reads to one place, allowing you to easily change the keys.

257
The Axe Parser Project / Re: Features Wishlist
« on: March 15, 2011, 12:57:08 am »
EDIT: Also, because I'm sure I'm not the only one wondering about this, I'll go ahead and ask it:
Nested libraries would be nice.
Nested libraries? ???
He means libraries within libraries. Remember that in Axe, you can use prgmNAME to include the Axe program called NAME as if it were inline. Nested libraries means that we could use this same concept within the referenced program (which we currently can't do).

258
ASM / Re: Getting around the 8000 limit without using apps
« on: March 11, 2011, 06:34:18 pm »
What Deep Thought said is correct. You can have a lot of data behind the 8K limit and it will still run fine.
Phew. I still have 2000 or so bytes left then. I should have little trouble keeping under that limit. If needs be, I will dive into the code and optimize it to death.

259
Other / Re: Let's learn OOP!
« on: March 11, 2011, 06:21:26 pm »
EDIT: I realize that my sudden little OOP tutorial might have blown you guys away just a bit, seeing as no one has posted to this forum since I posted. I rewrote it a little bit.

Oh, an OOP thread! My base is in C#, which is an incredibly OOP language. I would be happy to answer any questions about OOP that you guys might have. In the meantime, I can tell you guys what the basic idea of OOP is:

In low level programming, everything is managed by the programmer. All of the objects in the game, and all of their properties, are handled directly by the programmer. For example, to define a spaceship with an X, Y, and rotation in TI-BASIC, and then move it 10 pixels forward, you would do something like:
Code: [Select]
0->X:0->Y:0->R
X+sin(R)*10->X:Y+cos(R)*10->Y

However, in OOP, all of the objects in a program are encapsulated in classes. A class is basically an object's definition, which contains all of the properties of an object. For example, in C#, you would say
Code: [Select]
class Ship
{
public int x;
public int y;
public float rotation;
}
to define the class called Ship, with integers x and y and a floating point number "rotation". The keyword public is a special keyword that means that other objects can mess with this value.
Within that class, you can add methods and subroutines, which do things to the ship's variables. For example, you can define this method within the definition of the Ship class:
Code: [Select]
public void Move(float amount)
{
X += Cos(Rotation) * amount;
Y += Sin(Rotation) * amount;
}

Once you have defined your Ship class, you can create a new instance of it, just like you would any other variable type (e.g. an integer or float). Then, later in the program, you can access its variables and call its subroutines. To reference a part of a class, first type the name you gave that particular instance of the object, then a period, and then the property you want to reference.
Code: [Select]
Ship ship = new Ship();
ship.rotation = Pi;
ship.Move(10);
Print(ship.x);
This piece of code creates a new instance of Ship, sets its rotation to Pi, moves it forward 10 pixels, and prints the ship's x-coordinate (which should now be -10).

Now, you might be asking: Why would I ever want to use this? There are two main reasons you would.
First, while it might be easier to manage one ship in low level programming, how about managing 100 of them? To track down all 300 variables, even in a list, would be unbearable, especially if you decided later that ships also need to have health or something. However, if you create a list of Ships, you can manage each ship individually.
Second, objects encapsulate things that you just don't want to manage, or want to protect somehow. For example, our Ship had a subroutine called Move on it to move the ship forward. Instead of having to remember sines and cosines every time a person wanted to move the ship, they could just set the rotation and movement amount and just say "Move". OOP also lets you hide variables that an object needs to know about, but not the rest of the game.

And objects have real-life applications as well, more so than in games. For example, you might want to create an object called CALCnet that manages calculator linking. By using this object, you don't have to worry about all of the little details and issues with CALCnet. All you have to do is start it up, shut it down, and tell it to send frames to people.

So, that's OOP 101. There is still a LOT more to the world of OOP, and I would be happy to share my knowledge.

EDIT: I realize that the sheer magnitude of this explanation might have scared you guys away. I hope I can be clearer and help you learn OOP.

260
Miscellaneous / Re: Content Rating System
« on: March 11, 2011, 11:56:32 am »
You all have excellent points. Most people actually wouldn't care about a rating system - or anything that is highlighted by a rating system - and having one would cause more problems than it solves. I guess I'm part of the minority that's overly sensitive to that kind of stuff.

EDIT: Oh, and it wasn't just bad words I was considering. I've also seen sexual innuendoes in some games (like at the end of Marc the Superkid), and graphic violence in others (such as Gemini). But yeah, that's a lot more rare.

261
ASM / Re: Getting around the 8000 limit without using apps
« on: March 11, 2011, 11:51:32 am »
@Compynerd255 this limit applies to the executable, not the source.
Then how come 10K programs, such as FireTracks and Megaman, can exist?

262
ASM / Re: Getting around the 8000 limit without using apps
« on: March 11, 2011, 12:03:59 am »
Why is there an 8000 byte limit? Does it have to do with Axe's capabilites? Or is it a TI-OS thing? If the latter is the case, compile to Ion. MegaMan for 83 Plus is a gigantic 18000 byte program.

But, if the former is the case, it looks like this solution would work. Many BASIC RPGs create XTEMP programs to have giant apps composed of many subprograms. Now, you would have to be able to use HEX assembly to copy the program.

Also, does this 8000-byte limit apply to the executable, or just the source? Eitrix's executable is approaching 8000 bytes, but the source is around 4500 bytes.

263
Axe / Re: Establish Link Connection
« on: March 10, 2011, 11:55:28 pm »
Yes, since its hex code. It's compiled directly to Z80 instructions. Unless, of course, you don't need to flip the addresses to begin with.

264
TI Z80 / Re: Axe Tetris
« on: March 10, 2011, 11:52:56 am »
Ooh, a competitor.

I looked at your screenshot, and your game does look really cool. I guess that both of us have different priority as to which features are important. You have sound already, and I have multiplayer linking.

265
Miscellaneous / Re: Content Rating System
« on: March 10, 2011, 11:48:03 am »
You do have a good point, JustCause. Authors should warn their users of such content. However, different people have different standards, and what might be considered perfectly fine to one person might be appalling to another person. A rating system would standardize the opinion.
If we wanted to create a calc rating system, what we could do is when people review the game on Ticalc, Omnimaga, or any other rating site, they would also give the game content ratings based on several scales for individual pieces of content. Then, the game's calc rating would be the average of all of the ratings the game has gotten, weighted according to the rater's Respect level (e.g. a person who simply gives random values to the ratings without even playing would not have as much of an influence as a person who actually plays the game and gives honest ratings).

And yes, I didn't realize that palpable was the wrong word. A better word would be palatable.

266
Miscellaneous / Content Rating System
« on: March 10, 2011, 10:33:16 am »
I don't know about you guys, and I don't know how to put this tactfully, but I think that calc gaming has evolved to the point where we need a content ratings board. As I have played several notable games, I couldn't help but double take at some of the stuff I find:
  • Swearing of different degrees in several RPGs
  • Graphic violence
  • Adult/Criminal themes
  • Sexual overtones
  • And other things...
I'm not naming specific games because I don't want to aggravate anyone, but it's multiple people.
Now, I'm not saying that these games should be taken down. I just think its fair that people who don't find this stuff palpable be warned that they will find it in there. A good community rating system I've seen is the one on XNA Games. Just tell me what you think about this.

267
Axe / Re: Establish Link Connection
« on: March 09, 2011, 07:41:46 pm »
This problem is really simple. I can't remember the exact code off the top of my head, but it goes something like this:

Code: [Select]
0->C
Disp "WAITING...",i,"PRESS ANY KEY",i,"TO CANCEL",i
Repeat C
 Get->A
 Send(100,1000
 !If A-100
  2->C
 End
 If getKey
  1->C
 End
End
!If C-1
Goto <FailLabel>
End
Disp "SUCCESS!"
Goto <PassLabel>

Similar code is in Eitrix, if you want to see it in action.

268
News / Re: Eitrix v0.5 released and Tetris Marathon
« on: March 09, 2011, 07:35:59 pm »
Thanks for the awesome feature, DJ!

@Compynerd255 The project has a lot of potential! Keep up the great work!
Thank you, ralphdspam! The game is still a work in progress, and I hope to add more to it.

But Eitrix looks great.  What else is scheduled to be added?
To name a few:
  • See your opponent's grid height
  • Defense items (to protect yourself from attacks)
  • More attacks
  • Disease attacks that last indefinitely (e.g. hide piece preview, only get squiggily blocks)
  • Tournament mode (first to 2 or 3 wins)
  • Music in single player
  • CALCnet integration for 4-player play

So, will it work in DCS in MOS mode?
No, not the current version. However, I have just ripped out usage of the interrupt routine, which was getting it to crash originally. Instead, I am calling my interrupt function in various points in the code, especially where the program is more processor intensive. The next version I release should work on all shells.

It's great to get new followers on the game. I'll keep up the good work!

269
The Axe Parser Project / Re: Axe Interrupt Bug
« on: March 09, 2011, 07:26:49 pm »
It's not a compile bug. I have to pull my source out of backup every time the interrupt function crashes, so I don't believe that's the problem. I would like to see what is going wrong. For now, however, I am calling the interrupt function several times in my main game loop as a workaround, and it seems to be working.

270
The Axe Parser Project / Axe Interrupt Bug
« on: March 09, 2011, 10:29:38 am »
I wanted to report a bug in the fnInt command. In Eitrix, I use an interrupt to automatically manage key timing and linking. Sometimes the interrupt functions perfectly, but at other times the calculator freezes as soon as it hits the fnInt command, requiring a battery pull. And the problem only happens in one shell at a time - sometimes it only happens in MirageOS, and at other times it only happens in DoorsCS. But when it fails, it is always a freeze that requires a battery pull. Do you know what is going on?

Here's a generalized code sample:

Code: [Select]
fnInt(CLK, 2
... game code ...
LnReg
Return

Lbl CLK
T+1->T
Return

Pages: 1 ... 16 17 [18] 19 20 ... 24