Custom Sprites [v1.5]
Re: Custom Sprites [v1.4.1]
Hi Lux,
I am liking this program, does the job. Attached my sprite code for you to see heh heh. You might recognise the sprite.
Also I notice after adding the sprite to my code the compilaton time takes an age. probably because it has to process all those putpixel lines heh heh.
Only thing is I made your code crash. Decided to load in a picture which was 800 x 600 and it came up with an error and wouldn't carry on. I know it was designed for sprites, but thought I would try.
Can't wait to get png's into the program LOL, they are the best for transparent graphics.
Asimov
I am liking this program, does the job. Attached my sprite code for you to see heh heh. You might recognise the sprite.
Also I notice after adding the sprite to my code the compilaton time takes an age. probably because it has to process all those putpixel lines heh heh.
Only thing is I made your code crash. Decided to load in a picture which was 800 x 600 and it came up with an error and wouldn't carry on. I know it was designed for sprites, but thought I would try.
Can't wait to get png's into the program LOL, they are the best for transparent graphics.
Asimov
- Attachments
-
- Asimov.zip
- Little test of my sprite after using the LUX program
- (77.19 KiB) Downloaded 671 times
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
Re: Custom Sprites [v1.4.1]
Glad you liked it.
I have to say it's weird your program takes so long to generate the code. I have far more putpixels and other code than that, and it takes just a couple of seconds to generate. The problem may be somewhere else.
As for the scanner crashing, the 1.4.1 version is fast for small images, which it scans almost instantly, but for larger images the 1.3 is better.
That can be blamed on the .NET which is slow as hell compared to c++. difference in 1.4.1 and 1.3 is that the newer scans the image in one sequence and outputs the text all at once, while the older one goes through pixel by pixel, which is a slow process, but does it eventually.
Just for the record, 1.4.1 doesn't crash, it just scans it, but doesn't sen any messages to the computer, and the way your computer "knows" if a program has crashed is if it doesn't send any messages. In this case where its scanning, it hasn't crashed, it simply is busy scanning and won't send these messages.
I guess I could make it faster, if instead of outputting the text on the screen, it would directly write it to a text file. I might try that when I find the spare time... Which I have a lot!
I have to say it's weird your program takes so long to generate the code. I have far more putpixels and other code than that, and it takes just a couple of seconds to generate. The problem may be somewhere else.
As for the scanner crashing, the 1.4.1 version is fast for small images, which it scans almost instantly, but for larger images the 1.3 is better.
That can be blamed on the .NET which is slow as hell compared to c++. difference in 1.4.1 and 1.3 is that the newer scans the image in one sequence and outputs the text all at once, while the older one goes through pixel by pixel, which is a slow process, but does it eventually.
Just for the record, 1.4.1 doesn't crash, it just scans it, but doesn't sen any messages to the computer, and the way your computer "knows" if a program has crashed is if it doesn't send any messages. In this case where its scanning, it hasn't crashed, it simply is busy scanning and won't send these messages.
I guess I could make it faster, if instead of outputting the text on the screen, it would directly write it to a text file. I might try that when I find the spare time... Which I have a lot!
ʕ •ᴥ•ʔ
Re: Custom Sprites [v1.4.1]
Yeah, yeah....
I tried your image in a newer framework and works smooth, so don't worry. Later in the tutorials you are going to be thought how to make the frameworks faster.
I tried your image in a newer framework and works smooth, so don't worry. Later in the tutorials you are going to be thought how to make the frameworks faster.
ʕ •ᴥ•ʔ
Re: Custom Sprites [v1.5]
Haha, just compared 1.3, 1.4.1 and 1.5
Result: 1.5 is by far the fastes!
1.3 lapse: ~190 seconds
1.4.1 lapse: ~30 seconds
1.5 lapse: ~5 seconds
Using the same image as shown on the first page.
Result: 1.5 is by far the fastes!
1.3 lapse: ~190 seconds
1.4.1 lapse: ~30 seconds
1.5 lapse: ~5 seconds
Using the same image as shown on the first page.
ʕ •ᴥ•ʔ
Re: Custom Sprites [v1.5]
Hi Lux,
Have you thought about re writing it all in C++?
I mean if you can put a pixel there must be a way of reading a pixel as well.
Understand why you used the .net to do it as it is faster to get programs off the ground.
Asimov
Have you thought about re writing it all in C++?
I mean if you can put a pixel there must be a way of reading a pixel as well.
Understand why you used the .net to do it as it is faster to get programs off the ground.
Asimov
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
Re: Custom Sprites [v1.5]
They way you program in visual basic is a lot different than in c++, and instead of having to build everything from scratch you have these preset objects that make it very easy to use. I tried a couple of times to rewrite it to c++ but its just too different.
Just a couple of differencies: For example adding an image from a custom source, saving to custom source, opening any image type that has been installed on your computer, etc.
VB is really good for these kind of utilities and its fast to make them and easy to make them understandable, so that other people using it wont have much problems.
The image uploaded to the program doesn't have to go through a special conversion written by the programmer. Which yet again makes it easier. There's a ton of reasons. Maybe the biggest has to be that I'm used to write in VB : -)
Here's the "core" scanner code, if you wan't to have a look.
Probably not the best way, but has proven itself good for now.
And as chili mentions in tutorial 20, well he uses VC#, but that really a C version of VB, its easy and simple to make utilities in the Visual programs. Or lets say that making such takes a lot less time.
Lets just sum it up:
Making stuff in Basic is much like having a premade gameengine where you can spawn premade enemies with premade AI, rather than having to program the whole engine by yourself as well not to forget having to design and make all the other visual objects etc.
Just a couple of differencies: For example adding an image from a custom source, saving to custom source, opening any image type that has been installed on your computer, etc.
VB is really good for these kind of utilities and its fast to make them and easy to make them understandable, so that other people using it wont have much problems.
The image uploaded to the program doesn't have to go through a special conversion written by the programmer. Which yet again makes it easier. There's a ton of reasons. Maybe the biggest has to be that I'm used to write in VB : -)
Here's the "core" scanner code, if you wan't to have a look.
Code: Select all
If ScanOK.Text = "1" Then
For indexY = 0 To Val(ImgHeight.Text - 1)
For indexX = 0 To Val(ImgWidth.Text - 1)
Dim i As Integer
Dim j As Integer
Dim Color As Color
Dim img As Bitmap = New System.Drawing.Bitmap(ScanImage.PictureBox1.Image)
Dim R(Width - 1, Height - 1) As Integer
Dim G(Width - 1, Height - 1) As Integer
Dim B(Width - 1, Height - 1) As Integer
Dim LRed As Integer
Dim LGreen As Integer
Dim LBlue As Integer
Dim ROk As Integer = 0
Dim GOk As Integer = 0
Dim BOk As Integer = 0
i = indexX
j = indexY
Color = img.GetPixel(i, j)
R(i, j) = CInt(Color.R)
G(i, j) = CInt(Color.G.ToString)
B(i, j) = CInt(Color.B.ToString)
LRed = CInt(Color.R)
LGreen = CInt(Color.G.ToString)
LBlue = CInt(Color.B.ToString)
If LRed <> TransR.Text Then
ROk = 1
End If
If LGreen <> TransG.Text Then
GOk = 1
End If
If LBlue <> TransB.Text Then
BOk = 1
End If
If TransColor.Checked = True Then
If ROk + GOk + BOk >= 1 Then
Dim InfLine As String
Dim NewImage As New System.IO.StreamWriter(ImagePath.Text, True)
InfLine = LineStart.Text & "(" & indexX & " + " & XVal.Text & ", " & indexY & " + " & YVal.Text & ", " & LRed & ", " & LGreen & ", " & LBlue & ");" & vbNewLine
NewImage.Write(InfLine)
NewImage.Close()
End If
Else
Dim InfLine As String
Dim NewImage As New System.IO.StreamWriter(ImagePath.Text, True)
InfLine = LineStart.Text & "(" & indexX & " + " & XVal.Text & ", " & indexY & " + " & YVal.Text & ", " & LRed & ", " & LGreen & ", " & LBlue & ");" & vbNewLine
NewImage.Write(InfLine)
NewImage.Close()
End If
Next indexX
Next indexY
End If
And as chili mentions in tutorial 20, well he uses VC#, but that really a C version of VB, its easy and simple to make utilities in the Visual programs. Or lets say that making such takes a lot less time.
Lets just sum it up:
Making stuff in Basic is much like having a premade gameengine where you can spawn premade enemies with premade AI, rather than having to program the whole engine by yourself as well not to forget having to design and make all the other visual objects etc.
ʕ •ᴥ•ʔ
Re: Custom Sprites [v1.5]
Hi Lux,
I have written programs in VB before now. Then after realising that the client had to install .net to run it that put me off.
However very often if I want to write a quick utility program I sometimes use realbasic.
By the way I am now trying out your 1.3 sprite loader and it seems to be doing the whole picture.
I do notice that by storing pictures this way they take a much greater size than say a jpg, or a png because there is no compression. Maybe later I will learn enough to load in compressed files and use them as sprites.
Also later I want to learn how to load in a sprite sheet for animated sprites, but I am going to start simple first.
Asimov
I have written programs in VB before now. Then after realising that the client had to install .net to run it that put me off.
However very often if I want to write a quick utility program I sometimes use realbasic.
By the way I am now trying out your 1.3 sprite loader and it seems to be doing the whole picture.
I do notice that by storing pictures this way they take a much greater size than say a jpg, or a png because there is no compression. Maybe later I will learn enough to load in compressed files and use them as sprites.
Also later I want to learn how to load in a sprite sheet for animated sprites, but I am going to start simple first.
Asimov
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk
Re: Custom Sprites [v1.5]
I made the original version of this scanner back when I was at tutorial 2 or 3, at the time I only needed a quick scanner for small images, then later I just kept improving when I needed or wanted to.
True, the 1.3 and earlier go through pixel by pixel, so that they keep refreshing themselves in between making them slow but stable. The 1.4 used a simple loop to do everything in one shot and display the stuff. It was already a lot faster, but displaying the text took a lot of time and it was easy to crash. Now 1.5 uses the same idea but just stores the information directly in a file.
This scanner was never really meant to be a new way of storing images, it was just my way of doing custom sprites back when I had no other idea of how to do it. I saw a lot of other people writhing their own images by hand and just had to faceplam and help the poor fellows : -P
True, the 1.3 and earlier go through pixel by pixel, so that they keep refreshing themselves in between making them slow but stable. The 1.4 used a simple loop to do everything in one shot and display the stuff. It was already a lot faster, but displaying the text took a lot of time and it was easy to crash. Now 1.5 uses the same idea but just stores the information directly in a file.
This scanner was never really meant to be a new way of storing images, it was just my way of doing custom sprites back when I had no other idea of how to do it. I saw a lot of other people writhing their own images by hand and just had to faceplam and help the poor fellows : -P
ʕ •ᴥ•ʔ
Re: Custom Sprites [v1.5]
That program is the shiz
Thanks so much for creating it and ofcourse for sharing it with us!
+1
Thanks so much for creating it and ofcourse for sharing it with us!
+1