Puzzling Vectors - Source Included

BlitzMax Forums/BlitzMax Programming/Puzzling Vectors - Source Included

dw817(Posted 2016) [#1]
.


dw817(Posted 2016) [#2]


This question has been answered - see bottom code

Here's a puzzle for you guys. I am seeing some people asking questions about videogame mechanics and I wanted to have some simple code to draw both players and attackers in demonstration code; vectors being the easiest way to produce them.

Change 'typ' to 0 (zero) to use BlitzMAX's DrawPoly() with my figure.
Change 'typ' to 1 (one) to use my own plotter.
Change 'typ' to 2 (two) to see vector data is accurate for DrawPoly().

REM or UNREM out the VEC$ to try them out.

The difficulty is in using BlitzMAX's own DrawPoly() command. It seems flawed with some figures, and not all figures as I found out.

Or - did I somehow write the code below incorrectly ?

Could you look this over please and tell me what is wrong here ? suggest fixes to the code so it runs correctly ?




Floyd(Posted 2016) [#3]
DrawPoly assumes the vertices are traversed counterclockwise.

That is a common assumption with such algorithms and really should be documented somewhere.

Here is another way to visualize proper order. Imagine the figure is drawn on the floor. Walk along the perimeter visiting v0, v1, v2 etc in the order listed. The interior of the shape must always be on your left.


TomToad(Posted 2016) [#4]
@Floyd, Drawpoly uses DX order which is clockwise

@dw817, Drawpoly has problems with concave angles. Sometimes they work, and sometimes not. It can be different with different graphics cards and DX or OGL. just break up your polygon into sections so no angles are concave.


TomToad(Posted 2016) [#5]
Also, you need to steer away from using Global. When used in a function, the values only initialize the first time called. Subsequent calls use the old values. Also no need to define globals in the main program as you are passing the values as a parameter to the function calls.




Floyd(Posted 2016) [#6]
Right, I mixed that up with triangles in 3D.

In that case the x-y plane is the screen, but y points up. For 2D graphics this is flipped so y points down and the order is reversed to clockwise.


dw817(Posted 2016) [#7]
TomToad:

Oh my gosh, I used total GLOBAL in both main and functions ? First time I've done that.
I must've really been brain-dead when I wrote this !


Changing to local functions ... yehh, didn't fix the problem tho.

Floyd:

I know I drew that alien counter-clockwise to begin with. Let's see if a total reverse of coordinates fixes it.


Nope, not even that worked, just a different vectored mess. Nice to know it's not my code that's in error anyways.

.. Sometimes they work, sometimes they don't ? WTH ? I know GFA's own fillpoly() routine had no problems with any angles you chose and didn't care the direction you drew them either, concave or convex - and that's a Windows 3.1 programming language from 30-years ago FCS.

Thanks for the info though, Floyd and TomToad.

Alright, let's ask the important question now. Did someone make a 'patch' to the routine or write their own fillpoly() routine to circumvent BlitzMAX's own flawed ?


col(Posted 2016) [#8]
You're so sure that your algo isn't flawed when it clearly is!

TomToad has already told you the problem - you have a list of points that define a concave polygon. In GL the DrawPoly function uses the GL_POLYGON state to draw polygons which can only draw polygons with points that define a CONVEX polygon. It's not that BlitzMax's way is flawed, BRL are simply going by the gl spec, maybe you should take it up with the governing board that are in charge of OpenGL?


Endive(Posted 2016) [#9]
Pffft, he obviously knows better than the ARB. They should be the ones taking things up with him and not the reverse.


dw817(Posted 2016) [#10]
As Michael Roberts from Quantum Leap once said, "Put up or shut up."

Show me your solution then in code, Dave. No ?

Understand that I can write this exact same code in GFA and it works perfectly with their fillpoly() routine. If BlitzMAX cannot handle concave polygons for a fillpoly() routine for whatever reason, I consider that =THEIR= error and not mine.

More interesting would be for me to write code that would take ANY set of vertices and build a correctly filled polygon from them.


col(Posted 2016) [#11]
Why do I need to provide a solution for your problem?
Tom Toad and I am telling that your code is flawed so that YOU can correct it. You've been told already what the problem is, roll up your own sleeves and make your own code to do what you need.

DrawPoly... BlitzMax does it the way it does it, because it's different from others it doesn't mean that it is flawed.

Or - did I somehow write the code below incorrectly ?

Yes, and you've now been told 3 times now.
Could you look this over please and tell me what is wrong here ?

Again, you've been 'told' three times already.
As Michael Roberts from Quantum Leap once said, "Put up or shut up."

Right back at ya!


dw817(Posted 2016) [#12]
Perhaps it would be better to show you someone ELSE's code that bears the same problem.


BTW, Col. What good have you done for others today ? It's all good and well to bluster and say "see they told you - they told you, so why should I help ?"

Why, because if you came here NOT to help, not to submit a source code working example, why are you even here ? Your words could well be interpreted as just a poor way of saying, "I don't know how to fix this."

That's what I'm reading from your attitude in here, and YES, you did, first post, come in here with an attitude.

Unless you plan on submitting source code as a solution, which is what I requested initially, you really have no need to be here in this thread, now do you, Col ?


Endive(Posted 2016) [#13]
If BlitzMAX cannot handle concave polygons for a fillpoly() routine for whatever reason, I consider that =THEIR= error and not mine.


He just explained it to you. Maybe you don't understand winding order?

There are about a hundred ways of filling polygons. If all you're doing is 2D, you could do worse than a flood fill. You could also rasterize a bounding rectangle and test each pixel for whether it's inside each of your line segments... but crap, how would you do that without winding order?

Wait a sec, did you really say this?

As Michael Roberts from Quantum Leap once said, "Put up or shut up."


How about you put up or shut up? Novel idea, I know. He explained your error very concisely but you are still demanding to be spoonfed and you are still being peevish toward people who are trying to help you... but can you feel the reception getting steadily cooler? Why is that? Does it have anything at all to do with you or are you going to continue to blame other people?


Endive(Posted 2016) [#14]

That's what I'm reading from your attitude in here, and YES, you did, first post, come in here with an attitude.

You're the one who has been consistently guns blazing, and at people who were foolish enough to try to help you.

This behavior is a pattern in your life. I would speculate on the reasons for your behavior but I'm pretty sure I already know, and those who understand will pity you, though it's certainly annoying nonetheless.

The behavior pattern has already damaged you incalculably in terms of personal relationships and will continue to do so until you interrupt it but you can't do that, it's impossible for you.


col(Posted 2016) [#15]
@dw817
You didn't request a solution, you asked if someone could tell you what's wrong, then you start saying that BlitzMax is flawed because it does things differently. Even in another post you are blatantly saying an OS is broken because it doesn't do things the way that you are expecting.

Clearly you are one of those programmers who want other people to write their code for you rather than figure out a solution for yourself. A part of being a programmer is figuring out solutions to your own problems. It's easy to throw some code together that doesn't work the way you intend, then blame something else, then ask someone to fix it. Asking for help is one thing, asking them to do it for you is something else.

To sum up...
I have helped you by re-iterating that you need to create a convex polygon. Don't waste your efforts on me any more and code up the solution that you need. There are plenty of resources on the internet already, like you say, the problem was solved 30 years ago, so why not port that code yourself?

After all of 2 seconds on google here is a solution for YOU to write yourself.


dw817(Posted 2016) [#16]
And I suppose when I post a working solution that can handle any vectors, you will all scoff and say, "Oh ! Well I could've done that."

Indeed. Let me hope future complications in programming do not require solutions so complex that absolutely NO-ONE could post a working example - yet you all easily line up upside my door to beat on it and berate me telling me where I am wrong.

That, my friend, is hypocrisy.

I apologize if I come off heavy-handed. But see it from my viewpoint. All other programming languages I can think of can plot that filled vector perfectly every time no matter how it was constructed, and from the same initial code I wrote.

And BlitzMAX, the one language - fails, so naturally, it's my fault in the coding.

You sure showed me. *Grin*


Endive(Posted 2016) [#17]
Col, I don't think this guy is playing with a full deck, I'm going to bow out here and I'm not going to engage him any more and I suggest you do likewise.

DW: I apologize for any unkindness. I tried to help you but your attitude makes it impossible. I'm sorry.


dw817(Posted 2016) [#18]
Endive, I did choose the asterisk. You do understand that is the universal symbol for WILDCARD ? :)

Thanks for your patience. I'll see if I can solve this, and I'll post it, and hopefully that will be of help to others.

Col, I apologize, I should've stated specifically that I am looking for a source solution.

It could well be that my 2-dimensional thinking gets confused when presented with a 3-dimensional solution. I'm fairly good with logic in programming, some of the semantics and mathematical methods can confound me, however.


col(Posted 2016) [#19]
@Endive
I don't mind helping when people ask for help, no matter how things progress.

@dw817
It's been interesting, and if you ask for help while working on the solution I'm sure you'll get a good response, even if no one will actually write the code for you, someone may do that, maybe not. There are hundreds of years of combined expertise and experience in these forums, people that will choose when, if and who they help. By not having someone write the code for you then you will benefit much more greatly and progress much more quickly in your own expertise and experience as a programmer.

edit:- The link from the website I posted just now to the code that's easy to port to BlitzMax is here, but like I said, I'm not doing it for you and I certainly don't need to do it either, and you won't learn anything from just porting it :-)


dw817(Posted 2016) [#20]
Dave, if your logic is true, then you are saying I will benefit in my own expertise and experience as a programmer most by not asking for help. By solving it entirely on my own and not even letting others know I have a problem.

Because I will be honest, I understood very little of what was said in the solutions above. I have and always have been a person to learn from example code.

If that makes me the rarest programmer in the lot, so be it.

Let's address the answers above.

Try: DrawPoly assumes the vertices are traversed counterclockwise.
Res: I did this and rerouted the vectors so they were, there was no change.

Try: Drawpoly has problems with concave angles.
Res: If this were the case, you could not draw triangles which are solely concave.

Try: Drawpoly uses DX order which is clockwise
Res: Opposite of what I was told, okay, rerouted the vectors again so they were clockwise, no change

Try: Drawpoly has problems with concave angles. Sometimes they work, and sometimes not
Res: A good routine could handle any angles, not good to hear that BlitzMAX's is flawed with the active word "sometimes."

Try: Also, you need to steer away from using Global.
Res: Yeah, I don't know why I did that ! First time. Changed all back to locals.

Try: You're so sure that your algo isn't flawed when it clearly is!
Res: (read as attack and not at all helpful)

(and thus the dispute began, silly really, now ended)

Now I'm not even certain if BlitzMAX has a routine for filling in areas. I can write one certainly and have in the past, would like to avoid this.

Came across this:

http://www.blitzbasic.com/Community/posts.php?topic=104247

Yep, I'm not the only that has problems with drawpoly()

As for never posting source solutions for anyone because you want others to learn on their own, my goodness ! That certainly does take some charitable thinking and more importantly, you are clearly doing it for the good of the programming community.

That IS what you are telling me, right ? :)

I will look over the javascript, but as I have never programmed in it before, What you want me to do is learn and become intimately familiar with an entirely different programming language than the one this forum is about - solely to draw a filled vector.

Because I do not see any other way to interpret this (by reading it in notepad).

You certainly do have my education in mind !


col(Posted 2016) [#21]
I'll try to help you progress a little...

Convex and concave with respect to polygons is usually referencing the angle of the corners inside the polygon, as opposed to the angles of corners on the outside of the polygon. I feel a picture may help here

BlitzMax isn't flawed with DrawPoly, is simply does it the same way that OpenGL is doing it, you don't get any 'hand holding' when using it, does that mean, indirectly, that OpenGL is flawed too?

You read it as an attack, it wasn't meant for you to feel attacked but merely to stop you in your tracks in your school of thought and for you to rewind and calm down so that you can think a little more about what the real problem with your code actually is. It turns out that you may need a little deeper knowledge in the way computers work. Maybe you've not been exposed at the low level that lies underneath what you are used to.
I apologise if it came across as an attack, and was never meant as such.

BlitzMax can kind of be compared to c/c++. c and c++ doesn't come with any graphics libraries what so ever, you either create them them or use 3rd party ones. 'Max is a programming language that also has a basic 2d library bolted on. People generally either work around the limitations or create their own 2d/3d libraries or own an outside library altogether.

After your last post and your sarcasm I bid you farewell ;-)


Kryzon(Posted 2016) [#22]
Here's a suggestion for a simple implementation of a polygon filling function, software-based:

1) Have a collection of vertices assumed to form an arbitrary polygon (concave, convex, self-crossing, it doesn't matter).
2) Compute the bounding box of the polygon (EDIT: it's a rectangle actually, since it's 2D). This is the fill area.
3) Go through every pixel in that bounding box area and fill the pixels that pass the Even-Odd fill rule test (https://en.wikipedia.org/wiki/Even–odd_rule).
The pixels that are not filled will remain transparent.

EDIT: If you want speed, triangulate the polygon using one of the many algorithms available for it and feed the individual triangles to DrawPoly or a manual glBegin( GL_TRIANGLES ) ~ glEnd() block (if using OpenGL) or a DrawPrimitiveUP call with the D3DPT_TRIANGLELIST primitive type (if using Direct3D).
Look at the source of the Max2D modules (GLMax2D.mod and D3D9Max2D.mod) for examples.


dw817(Posted 2016) [#23]
No, you were actually helpful. (If not source example, screen shots were useful to look at).

I am looking at some graphic libraries (MODs) others wrote to see how they handle the polygon problem.

And - apology accepted. I think when someone is frustrated because they can't solve a problem, someone else yelling, "You're still wrong !" is not deemed altogether helpful.

Reading what you wrote ... I don't use OpenGL because I see in the help files it only has a few functions like drawpixmap(), drawrect(), and drawtext() whereas Max2D houses a whole host of useful graphic functions I make use of daily in my coding.

There's a good chance I don't understand how computers render graphics. I think you're right about that. I know back in Turbo Pascal I wrote my own library entirely from plotting one pixel at a time. Back then screens were 320x200 with 256-colors where you had to initialize a palette.

So I could easily top 45fps even by updating every single pixel on the screen as a unique object. Those were the days. :)

But even then I really didn't understand graphics. Oh sure a year later I was POKEing directly to the screen by indirect array modification and storage to get that extra speed, but today - I doubt Windows has any trace of a raw memory you can poke numbers to - to effect changes in the screen.

And even then if you could, surely it would vary from one computer to the next. You couldn't rely on fixed memory locations. I realize that.

It's up to you to leave if you want to, Dave - that is your choice. I will say, "You have been helpful. Thank you."


dw817(Posted 2016) [#24]
Kryzon, that is very similar to what I had in mind should I have to write it myself. And it does seem that way. I'm trying to keep the source small though so I can post it easily across the Internet to demonstrate a variety of solutions for game mechanics.

Check every vertices and find the natural center. That I can do. Then write a quick routine to FILL it all in spreading out. Also something I can write. This won't work with 'donut' style images but will work for what I need here.

I suppose I could add an ending vertices to be the 'paint' spot, necessary for an image where the center of vertices does not connect to the main hub.

Hoping I'll find some source or library in BlitzMAX that fills in any polygon proper however without going through this clumsy method, and will allow the same of any size, shape, or skew.

I know years ago on graphic Apple ][ adventures, Robert C. Clardy and company relied on machine-language region fills for polygons by scanning all pixels outward. Not the smoothest method but it did work.

http://crpgaddict.blogspot.com/2014/01/game-129-apventure-to-atlantis-1982.html

Here you can see down in the photos a room drawn entirely with vectors, and then filled in with color using the clumsy scan-pixels outward method.

Penguin Software did a lot of this, too.




Kryzon(Posted 2016) [#25]
Hello.

Check every vertices and find the natural center.

I meant the bounding rectangle (the minimum and maximum X and Y). The rectangle that most tightly encloses all vertices of the polygon.

Then write a quick routine to FILL it all in spreading out.

The bounding rectangle encloses all pixels of the polygon including pixels outside of the polygon. You start traversing each pixel in the rectangle, usually from the top-left corner, and input the pixel coordinates to the Even-Odd test, that will tell if the pixel is inside the polygon (if it covers any part of the polygon) and should be painted, or if it's outside of the polygon and should be left transparent.
The pixel coverage is not always absolute (like on or off) -- when the pixel partially covers the polygon you use the coverage as an opacity factor, plotting a semi-transparent pixel to produce antialiasing.

If you want to avoid writing any of this, use the Cairo graphics library. There's a BMax module that wraps it:

- http://brucey.net/programming/blitz/#bahcairo
- https://github.com/maxmods/bah.mod/tree/master/cairo.mod

Cairo is used in several GNOME project software, like Inkscape (a vector illustration program).


dw817(Posted 2016) [#26]
Hi Kryzon:

* Yes ! Now that's what I'm talking about. pinned.

A graphics library not only with sourcecode examples for every feature but graphic representations on the side. I guess if I ever get around to posting my own graphic library, I should do the same.

Unfortunately, I'm now beginning to see that there is no 'simple' code to do a filled polygon, which was the point of the exercise.

Sure I can use Cairo, but then that would mean anyone who wants to run my sample code just to create some simple graphic elements would be required to download and install the Cairo library as well.

As for myself, I have no need for polygons or even vectors, having built everything I needed for S3 from static images already. This is just one bit I put together a few years ago, some found, and some generated by my own code solely by pixels, lines, Truetype dingbats, and semi-circle cuts generated in BlitzMAX and GFA:


(small stamp only, not actual size)

Cairo covers other bases however and for my main engine where the source is unlikely to be released, is definitely something to look over to see if it can improve what I've already written, or provide new interesting features and effects, thanks.


dw817(Posted 2016) [#27]


I think Egrorian worded it best in Blake's 7, episode "Orbit," when he offered to trade the Tachyon Funnel, a powerful weapon, for Orac, a sentient computer.

"I have other projects under development. It would be an invaluable help. I've no doubt I could design an Orac myself, but duplicating the work of others is a waste of time. I've got much to do."

I completely understand Egrorian's viewpoint - who wants to write what is already out there ? And yet it seems at times I must. Another gray hair is grown.

No, I don't want to use an external DLL or MOD library to fill a polygon. If it is to be done effectively, it must be code that can be run, posted entirely from a single text source, "out of the box," for anyone to see or make use of.





52-lines of coding in all, and this will cause me to rethink my tagline.


Bobysait(Posted 2016) [#28]
Too many post to read, one single word for your problem :
"ear-clipping-algorithm".


dw817(Posted 2016) [#29]
What I have works since no-one plans to submit any "ear-clipping-algorithm" in BlitzMAX sourcecode, Bobysait. Oh, don't worry. Life is good. :)


Bobysait(Posted 2016) [#30]
What you have is the worst method you could ever use ... but it's your problem if you want to use this way.

As you mentioned somewhere else, other members can find this topic and will be happy to see that what they are looking for is "ear-clipping".
(sometimes, all you need is the name of a robust algorithm you couldn't have heard of if noone tells it)

Knowledge is not only <full-blitzmax-implementation>, it's above all theorical stuff that enables you to make your own implementation.

-> most of the times, the "blitzmax-implementation" is the easiest part of the problem
The real challenge is to find the theory and the "names" of related stuff.

So, what you were looking for here, is "ear-clipping", and it's really far from the way you solved the problem.
Ear clipping allows to use the DrawPoly function, there is no need for WritePixel.

The algorithm computes points of a polygon to cut it into a serie of convex polygons that the DrawPoly function can manage perfectly.


ps : BTW, most of the time, the generic stuff is pretty bad for almost all case (regarding performance or integration) whether or not it works for almost all cases. The theory of an algorithm is always better than "a way to implement it".

ps 2:

Oh, don't worry. Life is good. :)


What was that ? a private joke ?
You seem a bit sarcastic, don't you ? (If I don't get all the depth of this, it's probably because I'm french. I can't pretend to understand perfectly everything in english, so if it was not a sarcasm, nevermind.)


Endive(Posted 2016) [#31]
 If ReadPixel(pic,j+l,i+k)=$ff000000 And(k=0 Or l=0) ' ensure search is cross and not square
                    WritePixel pic,j+l,i+k,$fffffffe ' it's empty so fill it in

Hahaha!


Brucey(Posted 2016) [#32]
Don't worry bobysait, dw*** is american. Only other americans can understand his version of English :-p


Bobysait(Posted 2016) [#33]

What I have works since no-one plans to submit any "ear-clipping-algorithm"



http://www.blitzbasic.com/Community/posts.php?topic=96133#1111315
http://www.blitzbasic.com/Community/posts.php?topic=78165#876296

It's not because you didn't find it that it doesn't exist.
There is many entries on ear clipping on the forum, you just didn't search with the good words.


dw817(Posted 2016) [#34]
Endive, if you look at the code you will see I am searching for a cross + and not a square []. And yes, that makes a big difference in the code. Glad you found it so amusing. :)

Bobysait, since I am the only one that presented a written source code solution to the question, I think that makes it the winner. Your suggestion of "ear-clipping-algorithm" does not seem to be a smaller solution.

Brucey, who said I was American ? ;) My Mother certainly wasn't.


Bobysait(Posted 2016) [#35]

Bobysait, since I am the only one that presented a written source code solution to the question, I think that makes it the winner. Your suggestion of "ear-clipping-algorithm" does not seem to be a smaller solution.



...
My bad, I thought you were a programmer. That's true, big code are soooo difficult :)
It's always better to make smaller codes with poor result ;)
And ... Who wants to learn anything anyway ...

Well, guy, I must admit I'm fed up with you, so, as you're always answering like a child and acting like an asshole, you're actually the winner, I won't try to help you anymore. Have fun (and I hope you good luck) on the forum with this very mature attitude.

ps : When you want to fix drawpoly and finally come to use WritePixel ... you actually totally failed to solve the "real" problem. Just saying ^^ but, yeah, that's probably too difficult for you.

"I can't swimm, help me"
"Nevermind, I solved the problem, I 'm going to walk"


dw817(Posted 2016) [#36]
Bobysait, I don't mind large code. S2 was a little over 20,000 lines of code when I wrote it. Perhaps you didn't read above ? I am looking for SMALL solutions so I can write simple source code examples for OTHER people interested in game theory and mechanics directly in BlitzMAX forums - and for no other reason.

Did you also not read above that I have zero use for polygons myself ?

As for my own personal code, the sky is the limit. You assume a great deal that I am not a programmer. Other people might find that insulting, me ? I find it laughable from the strong backing of Worldbuilders who even use my ancient S2 engine today.

Also from actual game and business packages I wrote and sold in the past.

Here is an early engine I was working on. As you can see media resources are kept in "current.pak."

https://www.mediafire.com/?uxyjcrsbydy6tsw

Today I am relying on downloading data packets straight off the Internet. This is more reliable and lets me both upload and download data so it can be instantly shared with other Worldbuilders. I have upgraded the font, you can now use any Truetype Font (not limited to monospace as other programs have been), and contains an object-oriented graphic handler to keep track of elements during edit and play.

Thanks to Casaber's incredible code, I can now have MIDI, Mp3, and WMA in addition to usual OGG and WAV for audio. I will definitely give him full credit for that when I complete S3.

. . .

Now, would you like some ice-cream to put out that burn, Bobbysait ? :)


Endive(Posted 2016) [#37]
I agree, he won. He's too smart for us.


dw817(Posted 2016) [#38]


Not trying to win anything here. Merely trying to help the BBCode community with simple code, especially those who are new to the language. And not all of you are making that entirely easy to do with snide remarks, insults, and links to code ad infinitum.

You said and assumed that I did not know how to program, and you said it in an insulting way. I think you have decided otherwise now. That was not something that should've come into the conversation.


Endive(Posted 2016) [#39]
links to code ad infinitum.

#ten
print "LOL!"
goto ten



dw817(Posted 2016) [#40]
What I mean is code that cannot be understood by average programmers, such as this:



That code is not something beginning programmers want to dive right into to learn how to merely move a sprite across the screen. So are you helping people by pointing them to this sort of thing, or merely discouraging them from ever learning - I ask you ?


Kryzon(Posted 2016) [#41]
That snippet you posted is far, far more readable to me (proper variable names, large indenting) than the cryptic way of storing coordinates that you used:
Local vec$="3U^jV\lf]7RGN"

Local l=Len(vec$),vec#[l*2],a,i
For i=1 To l
	a=Asc(Mid$(vec$,i))-40
	vec#[i*2-2]=a Mod 9*16+20 ' store X
	vec#[i*2-1]=a/9*16+20 ' store Y
Next

About 'helping the community', can you give me at least one name of a user that has thanked you and found useful one of your source-included threads? Someone that has written "thank you, I'm starting out and your code helped me."

Please understand that I don't mean the following in a condescending way, it's that I don't like seeing people spending effort fruitlessly.
BlitzMax is old and its popularity peaked in the past. To my knowledge the few people still around here are all advanced users. I think you're being quixotic.


dw817(Posted 2016) [#42]
As I posted with it in the code submission:


Any questions or comments, especially about the BlitzMAX commands or functions used in this code, please address them below.


And the BEST message you can receive for a code submission is none at all. That means people understood your code, they have nothing to add to it, and there are no errors they found in it. If they thank you, that is kind of them but not REQUIRED.

As for me, I have thanked people for their submissions. If I do so, it is from the heart because I can see the love and effort that went into their code.

Considering I have also only submitted one piece of code to code submission, as of today, it might be a-while before I get that desired "thank you" you are referring to. :)


Endive(Posted 2016) [#43]
I especially liked the use of lowercase l as a variable name. "For i = 1 to l." If you really want to go for code clarity, do exactly that...


dw817(Posted 2016) [#44]
I especially like how you keep coming at me with criticism after criticism - And I keep shooting you down each time. That's what a real friend does after all. :)

As I use the font Lucida Console 14 in my IDE, I hardly notice this.



As you can see, I do not color my numbers and prefer them to be the same color as variables as I don't want too many colors in my source code. Yes, you can color your numbers in the IDE, and by default I believe it already does, so it would look like this.



Yes, in this Internet message forum font which is proportionally spaced, Arial 9 and courier 9 for monospace, I think it is indeed difficult to read now that you mention it.

Let me hope you are not using Arial 9 in your BlitzMAX IDE with all colors set to black. If so, that's your own fortune ...

I can certainly avoid letter L if that will make you uniquely happy, but I know it won't as you will look very hard to find something else to complain about that I have done.

Now I =WOULD= be using all uppercase in my variables except that BlitzMAX does not have as nearly an intuitive editor as GFA.

With GFA, you can type ApPle=5

then type 'apple' again for a variable and as soon as you hit space or equals or parenthesis, it takes the last occurrence of the way you typed it and replace it to 'ApPle,' the initial entry.

It also automatically spaces out variables and commands correctly. You can do it as you type or it automatically does it for you. It also CAPS all commands. The way it treats variables is also for your PROCEDURES and FUNCTIONS. It remembers exactly the way you had each letter upper and lowercase.

So if I had a function TransmitFreeData

When I wanted to call it, I could type out "transmitfreedata" and it would automatically change it to "TransmitFreeData." Really quite nice.

Now if you want to change that variable name later, it's pretty easy. Press ALT-C M, change the variable the way you want it to look, doesn't matter where you change it, then ALT-C M again and the moment you return it automatically changes all occurrences of your variable throughout the entire program to the new casing.

Very quickly I might add.

It also BINDS executions. That is, there are 3 types of ways to execute code in GFA. The first is really slow and useful only if you want to debug each line in question.

The second is where your code is BOUND, a very QUICK compilation, but not a full compilation, and it compiles and runs very fast indeed with the debugger still fully active.

Whereas BlitzMAX =ALWAYS= takes time to compile, GFA has this BOUND method so the moment you select RUN it's already up and going even before you lift your finger off the keyboard.

The third is a bit slower and a full compile for final EXEs, but the execution of the code is so fast that if you don't have proper timers in your code, you can hang the computer and require TaskManager to remove it.

As BlitzMAX uses flip(), GFA uses PEEKEVENT.

I miss all that ... but GFA does not run in Window 8, which is why I am here.

Curiously, if you take my code and post it in the editor, with numbers set to BLUE or any other color, the letter "L" will stand out from the numeral 1.

But I think you are already aware of this and just grasping at straws now hoping I would not be aware of this glaring fact.

In any case, this backfired on you. Despite your attempts at insult, your last comment was helpful, if not delivered with kindness. I will go to change the codes to reflect the update and ensure I do not use variable L but M in future posts.

It seems I like the blue digits after all, too, so I'll keep those configured on in the IDE additionally.

Anything else you'd like to share with the group before I retire for the evening ?


Endive(Posted 2016) [#45]
<blah blah blah blah blah>

In any case, this backfired on you

Obviously.


dw817(Posted 2016) [#46]


Good night then. See you in the morning. :)


Endive(Posted 2016) [#47]
You're how old and you have this bizarre fascination with anime art?


dw817(Posted 2016) [#48]
Good morning. Seems I overslept. Endive, you are wayyy off topic, but I'll answer.

I've always been fascinated with any type of art, including programming, where great work and skill are involved. Having been watching Anime since I was 20, I decided right then and there, I liked it.

I also like very old code, like this 1K program to play chess I came across for the Sinclair 1000. Fascinating stuff.

Seems I can never stay mad for very long. (editing).

Let's hope your next questions are not personal and barbed ones in your attempts to derail the topic, but about programming in BlitzBasic and BlitzMAX - which is what this forum is for.


BlitzSupport(Posted 2016) [#49]
Think this thread has run its course.