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 - Omar Chehab

Pages: [1] 2
1
Axe / [HELP] Unstable program speed
« on: June 12, 2015, 05:19:54 pm »
Hello, I have a problem with program speed. When the program is processing a lot of things the game slows down, and when everything settles down it goes fast again.

You can see it in the movement here:

As you can see the character dashes when the animation goes from 9 to 5, and this is probably because of the way i designed my program.  You can see the code over here:


-Something to note is, most of the features like jump and duck were before i decided to add animations but i didnt change them. so you can ignore them. i need help in either finding a new method to organize my sprites and to load them when needed, or to fix my problem of maintaining a constant program speed.
Code: [Select]
.MK Omar Chehab
sub(INIT)
Repeat getKey(15)
sub(MOVEMENT)
sub(ACTION)
sub(RENDER)
End



Lbl MOVEMENT
  ..If TIRED then RECOVER
{L1+4}++
  If {L1+3}>128
    {L1+3}++
  End
  ..If no ANIMATION STATE is going on then
  If {L1+3}=0
  0->{L1+2}
    ..DUCK
    If getKey(1)
      ..Set ANIMATION to DUCK
      3->{L1+2}
    End
    ..LEFT
    If getKey(2) and ({L1+2}=0)
      ..Decrement X POSITION
      {L1+0}--
      sub(aWALK)
    End
    ..RIGHT
    If getKey(3) and ({L1+2}=0)
      ..Increment X POSITION
      {L1+0}++
      sub(aWALK)
    End
    ..JUMP
    If getKey(4) and ({L1+1}=56)
      ..Set ANIMATION to JUMP
      4->{L1+2}
      ..Set ANIMATION STATE to UPWARDS
      1->{L1+3}
    End
    ..IDLE
    If {L1+2}>=0 and ({L1+2}<=4)
      sub(aIDLE)
    End
  End
  ..GRAVITY
  If {L1+2}=4 or ({L1+2}=5)
         ..LEFT
      If getKey(2)
        {L1}--
    End
    ..RIGHT
    If getKey(3)
        {L1}++
    End
      If {L1+1}=56 and ({L1+3}=2)
      ..Set ANIMATION to RECOVER
          11->{L1+2}
        ..Set ANIMATION STATE to RECOVER for 15 ticks
        ~15->{L1+3}
    End
    ..Peak
    If {L1+1}=34
        ..Set ANIMATION to FALLING
      5->{L1+2}
        ..Set ANIMATION STATE to DOWNWARDS
        2->{L1+3}
    End
      ..If ANIMATION STATE is UPWARDS
      If {L1+3}=1
        ..Increment height
      {L1+1}--
    End
    If {L1+3}=2
        ..Decrement height
        {L1+1}++
    End
  End
Return



Lbl ACTION
   
Return



Lbl RENDER
  Text(0,0,{L1+2}>Dec
  ..Sum all sprite sizes up till the selected sprite
  0->D
  For(C,0,{L1+2})
    (({GDB1+(C-1*2))*({GDB1+(C-1*2+1)))+D->D
  End
  ..Loop for height of sprite
  0->C
  ({GDB1+({L1+2}*2+1)})->B
  While B>0
      B--
    ..Loop for width of sprite
    For(A,0,({GDB1+({L1+2}*2)})-1)
      Pt-On(A*8+{L1},~B*8+{L1+1},C*16+Pic0+(D*16))
      Pt-On(A*8+{L1},~B*8+{L1+1},C*16+Pic0+8+(D*16))^^r
      C++
    End
  End
  DispGraphClrDraw^^r^^r
Return



Lbl aIDLE
  If {L1+4}=128
    0->{L1+4}
  End
  If {L1+4}<16
    0->{L1+2}
  ElseIf {L1+4}<32
    1->{L1+2}
  ElseIf {L1+4}<64
    2->{L1+2}
  ElseIf {L1+4}<96
    3->{L1+2}
  ElseIf {L1+4}<128
    4->{L1+2}
  End
Return



Lbl aWALK
  If {L1+4}=128
    0->{L1+4}
  End
  If {L1+4}<16
    5->{L1+2}
  ElseIf {L1+4}<32
    6->{L1+2}
  ElseIf {L1+4}<64
    7->{L1+2}
  ElseIf {L1+4}<96
    8->{L1+2}
  ElseIf {L1+4}<128
    9->{L1+2}
  End
Return

Lbl INIT
  0->{L1+0}.. X POSITION
  56->{L1+1}.. Y POSITION
  0->{L1+2}.. ANIMATION
  0->{L1+3}.. ANIMATION STATE
  0->{L1+4}.. ANIMATION CLOCK

*Hexadecimal Sprites into Pic0 and their sizes x,y into GDB1*

Return

2
I wrote a paint.net plugin that generates hexadecimal strings from a colored image.




The plugin is made so easy to use for speeding up sprite management in order to get to coding ! :D

1. So to use it first you will have to install the free software Paint.net (if you dont have it already) getpaint.net.

2. Next you will need to download my plugin (its called in effect in paint.net but i used it differently).
https://drive.google.com/open?id=0BwL8OxR4bj83NFlIaFFpNHJSWUk&authuser=0

3. Put this file in the folder Paint.NET/Effects/

4. Startup Paint.NET, open up an image, select it with CTRL+A, click on EFFECTS, click PNGtoHEX which should be at the bottom.

You will get a popup like this


Select it and click CTRL+C to copy it

After copying it there will be some extra dashes in the beginning and the end of your clipboard just delete those, i am not sure how to remove them since they come with the default messagebox stuff...

Anyways! thats all i hope you find this useful, if you have any feature suggestions i will for sure implement.

3
I am just testing random images i have around on my computer, theres nothing in specific. Your code seems to generate for an 8x8 image a hex string bigger than the size i am trying to reach which is 16 numbers. I have fixed this issue though, my script is complete iam just having an issue with paint.net that several instances of this method are being run which is generating redundant data making the out put file hard to read. So what i am doing is i am researching on how to force it to run once.

4
It had many errors at the start, but after fixing them it would output hexs that arent in the format i am trying to put them in such as:
"[000000000000030070170 F77777777777747727607]"
when selecting 8x8 and huge unseperated hex when selecting more.
I finished up the code I am just reasearching on some more things before i publish this tool

5
The code is on the computer because it is used to convert regular images such as png, jpeg, bmp to useable grayscale hexadecimal. So on a calculator it would be redundant because all pictures are already in that form! :P
Thanks for your help, I am currently working on making it easy to use so it can be used by the community.
I will look into your optimizations and definitely try to learn and apply the concepts.

6
Hello, I have recently needed a converter to hexadecimal from colored images. This plugin is used for gray scale sprite development on the ti-84 graphing calculator. I surfed the internet and couldn't find what I needed, so I decided to write a plugin on paint.net that will process my selection and display the output. Here's my progress, it currently is functional however it is conditional. It only properly works when my selection is 8x8, i am aware that i can put it in try and catch i will for sure implement that later, I want to focus on the things that matter now.
Code: [Select]
bool done = false;
void Render(Surface dst, Surface src, Rectangle rect)
{
    Rectangle selection = EnvironmentParameters.GetSelection(src.Bounds).GetBoundsInt();
    ColorBgra CurrentPixel;
    string[,] binary1 = new string[8,8];
    string[,] binary2 = new string[8,8];
    int xx;
    int yy = 0;
    for (int y = selection.Top; y < selection.Bottom; y++)
    {
        xx=0;
        if (IsCancelRequested) return;
        for (int x = selection.Left; x < selection.Right;x++)
        {
            CurrentPixel = src[x,y];
            int rgb = (CurrentPixel.R+CurrentPixel.G+CurrentPixel.B)/3;
            if(rgb >= 0 && rgb < 64)
            {
                binary1[xx,yy] = "1";
                binary2[xx,yy] = "1";
            }
            else if(rgb >= 64 && rgb < 128)
            {
                binary1[xx,yy] = "1";
                binary2[xx,yy] = "0";
            }
            else if(rgb >= 128 && rgb < 192)
            {
                binary1[xx,yy] = "0";
                binary2[xx,yy] = "1";
            }
            else if(rgb >= 192 && rgb < 256)
            {
                binary1[xx,yy] = "0";
                binary2[xx,yy] = "0";
            }
            dst[x,y] = CurrentPixel;
            xx++;
        }
        yy++;
    }
    if(done == false)
    {
        string line;
        string hex = "[";
        for(int y = 0; y < 8; y++)
        {
            line = "";
            for(int x = 0; x < 8; x++)
                line += binary1[x,y];
            hex += ConvertHex(line);
        }
        hex += "][";
        for(int y = 0; y < 8; y++)
        {
            line = "";
            for(int x = 0; x < 8; x++)
                line += binary2[x,y];
            hex += ConvertHex(line);
        }
        hex += "]";
        System.IO.File.WriteAllText(@"C:\Users\user\Desktop\Dota Duelz\hex.txt", hex);
        done = true;
    }
}

string ConvertHex(string strBinary)
{
    string hex = Convert.ToInt32(strBinary,2).ToString("X");
    if(hex.Length == 1)
        hex = "0" + hex;
    return hex;
}

Keep in mind this is the first plugin i write on paint.net, so it probably isn't the most efficient way to do this. Now my question is: what is a good way to display the output string "hex" to the user? I am currently writing to a file. Coming from java development I don't know the tools i can use to do these operations. I tried to display a message box but it seems to open it 8 times and that's why i tried implementing the Boolean done so i make sure it runs only once, but i am not sure why it didn't work.

visual example of what it does:

It starts with the first image, i have to manually select 8 x 8 pixels and run the program to generate these four pairs hexs
[04050B3434742EEC][070E1A3B166E655B]
[20F0782C0A1E3577][E0A090BC3E34771E]
[5455D4F4CA5F7B00][F9FAF3CFFD6E6A00]
[1B9B1B3733FBFE00][0E2FFF5B777B3200]
and using this website, I am able to see the images visually
http://clrhome.org/pix/

7
Axe / Re: [QUESTION] about Clrhome.org's IES
« on: June 07, 2015, 03:35:46 am »
Please don't lock your topics once the issue is resolved for you, others may still have something to add on ;)
Sorry, I am not familiar to the rules of forums.
Yep, the List and Matrix options are meant to create TI-BASIC lists and matrices. Data in Axe is handled in a much different way—see the Axe docs for more info.

I guess it would be nice to make it clearer, haven't really thought of a way to do so.
Thanks

8
Axe / Re: [QUESTION] about Clrhome.org's IES
« on: June 05, 2015, 04:13:24 pm »
Okay thanks, I guess so too

9
Axe / [QUESTION] about Clrhome.org's IES
« on: June 05, 2015, 01:56:42 pm »
Can someone explain how I can utilize the created list in my axe program?
I know that I can edit values of the list
I don't know how to use it in my axe program.

10
TI Calculators / [ERROR] Can't move programs from PC to TI
« on: June 04, 2015, 10:27:31 am »
The device does not recognize the command
I get this error when I try moving a program from my Windows Computer to my TI-84 Plus 2.55MP calculator.
This error is new, I was able to transfer programs before.
I have already tried:
Restarting calculator and computer
Reinstalling Ti-Connect
Resetting Ti-84
Changing batteries
Changing USB-link cable

I am desperate, please help me.

11
Axe / Re: HELP - Maximum Optimization
« on: April 13, 2015, 04:00:13 pm »
Thank you for your time, I will further look into your reply.

12
TI Z80 / [Axe] Island Troll Tribes; Sneak peak
« on: April 13, 2015, 02:07:25 pm »

A custom map in Warcraft III; Island Troll Tribes. It's a game whereby 4 teams survive in the wilderness...

13
Axe / Re: HELP - Maximum Optimization
« on: April 13, 2015, 08:00:11 am »
Thanks, I'll take look at that thread.

The Pt-On calls are called once in the program and that is to display' LOADING...' I don't see the point in wasting ram space to save something I won't use again.

14
Axe / HELP - Maximum Optimization
« on: April 13, 2015, 04:43:49 am »
Objective:
Reduce file size, increase program speed, and general optimizations.


Does space organizing your program cost space?
Example:
Code: [Select]
For(A,0,10)
    If A=1
         **
    End
End
Versus:
Code: [Select]
For(A,0,10)
If A=1
**
End
End


How can I avoid repetitively storing empty sprites without losing the tile-maps sprite synchronization?
Using level 3 gray-scale, I store my sprites into two pointers. One for front buffer and the other for the back.
When a sprite only uses one buffer I store [0000000000000000] in the opposite pointer so that they remain in sync.


Is it possible to shrink down my map size while maintaining the same tile map?
Example:
[00000000]
[01000001]
[00010100]
[01000001]
[00000000]
Versus:
[40]
[112011]
[102110]
[112010]
[40]
I remain unsure how to begin with something like this.


I'll post my code here so you guys can spot any easy optimizations:
Code: [Select]
[sprites front buffer] ->Pic0
[sprites back buffer] ->Pic1
[character both buffers] ->Pic2

.64x64
[map]->GDB1

ClrDraw
Pt-On(0+20,26,[E0E0E0E0E0F8F8F8])
Pt-On(6+20,26,[F8F8D8D8D8D8F8F8])
Pt-On(12+20,26,[70F8D8F8F8D8D8D8])
Pt-On(18+20,26,[E0F0F8D8D8F8F0E0])
Pt-On(24+20,26,[F0F000F0F0F0F0F0])
Pt-On(30+20,26,[98D8E8F8F8B8D8C8])
Pt-On(36+20,26,[F8F8C0C0D8D8F8F8])
Pt-On(42+20,26,[0000000000E0E0E0])
Pt-On(46+20,26,[0000000000E0E0E0])
Pt-On(50+20,26,[0000000000E0E0E0])
DispGraph

For(A,0,4096)
If (({GDB1+A})=1) and ((rand^25)=1)
If (rand^2=1)
10->{GDB1+A}
Else
If (rand^2=1)
11->{GDB1+A}
Else
7->{GDB1+A}
End
End
ElseIf (({GDB1+A})=2) and ((rand^15)=1)
If (rand^2=1)
  8->{GDB1+A}
  Else
  9->{GDB1+A}
  End
End
End
ClrDraw
0->P->Q->V->H->I->J->theta

Repeat getKey(15)
sub(MOVE)
sub(ACTION)
sub(RENDER)
End


Lbl MOVE
Z->Y
Q*64+P+262→Z
If (I=0) and (J=0)
If getKey(3) and (({Z+1+GDB1}=0) or ({Z+1+GDB1}=1) or ({Z+1+GDB1}=2) or ({Z+1+GDB1}=7) or ({Z+1+GDB1}=8) or ({Z+1+GDB1}=9) or ({Z+1+GDB1}=10) or ({Z+1+GDB1}=11))
    1→I
ElseIf getKey(2) and (({Z-1+GDB1}=0) or ({Z-1+GDB1}=1) or ({Z-1+GDB1}=2) or ({Z-1+GDB1}=7) or ({Z-1+GDB1}=8) or ({Z-1+GDB1}=9) or ({Z-1+GDB1}=10) or ({Z-1+GDB1}=1))
    ~1→I
ElseIf getKey(1) and (({Z+64+GDB1}=0) or ({Z+64+GDB1}=1) or ({Z+64+GDB1}=2) or ({Z+64+GDB1}=7) or ({Z+64+GDB1}=8) or ({Z+64+GDB1}=9) or ({Z+64+GDB1}=10) or ({Z+64+GDB1}=11))
    1→J
ElseIf getKey(4) and (({Z-64+GDB1}=0) or ({Z-64+GDB1}=1) or ({Z-64+GDB1}=2) or ({Z-64+GDB1}=7) or ({Z-64+GDB1}=8) or ({Z-64+GDB1}=9) or ({Z-64+GDB1}=10) or ({Z-64+GDB1}=11))
    ~1→J
    End
End
If (getKey(1)) or (getKey(2)) or (getKey(3)) or (getKey(4))
theta++
Else
    0→theta
End

  H+I+I→H
V+J+J→V
If (H=8) or (H=~8)
  P+I→P
    0→H→I
  End
If (V=8) or (V=~8)
  Q+J→Q
    0→V→J
  End
Return


Lbl ACTION
If getKey(54)
If ({Z+GDB1}=8) or ({Z+GDB1}=9)
2->{Z+GDB1}
ElseIf ({Z+GDB1}=10) or ({Z+GDB1}=11)
1->{Z+GDB1}
ElseIf ({Z+GDB1}=7)
1->{Z+GDB1}
End
End
Return


Lbl RENDER
Q*64+P→Z
For(B,0,9)
For(A,0,13)
Pt-On(A*8-8-H,B*8-8-V,((B+Q->D<64?A+P->C<64)?{D*64+C+GDB1}*8,Pic1-Pic0)+Pic0->C)
Pt-On(A*8-8-H,B*8-8-V,C-Pic0+Pic1)^^r
End
End
Pt-Off(40,24,Pic2+8+(theta/4^2*8+8*(theta!=0)))
Pt-Off(40,24,Pic2)^^r
DispGraphClrDraw^^r
Return

Also, looking at the 'Move' section, testing for what tiles the player is able to move on looks too big, maybe I can sort the tiles and make a loop for testing? Is that better?

Thanks in advance.

15
Axe / Re: HELP - Tilemap fill black outside the map
« on: April 12, 2015, 03:07:06 am »
Sweet, case closed thanks for your help.

Pages: [1] 2