Author Topic: QB64SOURCECODE.COM  (Read 17526 times)

0 Members and 1 Guest are viewing this topic.

Offline codeguy

  • Forum Regular
  • Posts: 174
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #75 on: May 14, 2020, 09:06:26 pm »
I thought It was nicely explained and constructed in the few sections I read. Feel free to steal my recursive code merger. And sorting library if you want to do a blurb about sorting so people can know it isn't all magic. I have explained their workings in the comments.
« Last Edit: May 14, 2020, 09:19:53 pm by codeguy »

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #76 on: May 14, 2020, 09:51:07 pm »
Sorting, yes, that would make a good topic. Thanks for the idea :-)  And yes, I will steal your code as it's some of the best work I've seen over the past 10 years on QB64.org/net
In order to understand recursion, one must first understand recursion.

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #77 on: May 18, 2020, 09:55:52 pm »
Task 19: Motion Vectors, Angles & Rotation has been uploaded.

Beware of Zombies!

On to task 20!
In order to understand recursion, one must first understand recursion.

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #78 on: May 26, 2020, 11:35:55 am »
Task 20: Particle Effects has been added.

I plan to do one more general information task relating to parallaxing and layers and then move into game build demonstrations. I was hoping to have the site completed by the end of this month but it looks like the end of June is now the target goal. This is taking much longer than I anticipated.

On to task 21!
In order to understand recursion, one must first understand recursion.

Offline STxAxTIC

  • Library Staff
  • Forum Resident
  • Posts: 1091
  • he lives
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #79 on: May 26, 2020, 12:32:18 pm »
Hey Terry,

Always been a fan! I'm on the road right now too so I can't be as verbose as usual. Just wanted to raise a few things.

This is all about your page on vectors and motion. First off, nice job compensating for the fact the the default coordinate system violates the right hand rule and defines trig upside down.

My bone is with the word "vector" as used. It's introduced as a way to keep track of direction, which is only mostly true. Bear with me...

Starting at the top, the position in the XY plane is itself a vector. It doesn't need motion to be taking place. When you modify a position vector to make something move, you are adding a displacement vector. A displacement vector is defined like

\vec{displacement} = (speed) * (timestep) * cos(ang) * \hat{x} + (speed) * (timestep) * sin(ang) * \hat{y}

Where \hat{z} is a vector of maginude 1 whose only job is to point.

In this notation, the velocity vector divides out the time step:

\vec{velocity} = \vec{displacement} / (timestep)

And next, note that the velocity vector is the product of a speed scalar and a unit vector denoting pure direction:

\vev{velocity} = (speed) * \hat{vel}

... Where \hat{vel} contains just the trig terms and the x and y unit vectors. This is the proper object that denotes direction.

Anyway sorry for sloppy notes. Cell phone blues...

Try this link too

http://barnes.x10host.com/writing/Vectors%20and%20Trigonometry/Vectors%20and%20Trigonometry.pdf

You're not done when it works, you're done when it's right.

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #80 on: May 26, 2020, 01:03:40 pm »
Hey Terry,

Always been a fan! I'm on the road right now too so I can't be as verbose as usual. Just wanted to raise a few things.

This is all about your page on vectors and motion. First off, nice job compensating for the fact the the default coordinate system violates the right hand rule and defines trig upside down.

My bone is with the word "vector" as used. It's introduced as a way to keep track of direction, which is only mostly true. Bear with me...

Starting at the top, the position in the XY plane is itself a vector. It doesn't need motion to be taking place. When you modify a position vector to make something move, you are adding a displacement vector. A displacement vector is defined like

\vec{displacement} = (speed) * (timestep) * cos(ang) * \hat{x} + (speed) * (timestep) * sin(ang) * \hat{y}

Where \hat{z} is a vector of maginude 1 whose only job is to point.

In this notation, the velocity vector divides out the time step:

\vec{velocity} = \vec{displacement} / (timestep)

And next, note that the velocity vector is the product of a speed scalar and a unit vector denoting pure direction:

\vev{velocity} = (speed) * \hat{vel}

... Where \hat{vel} contains just the trig terms and the x and y unit vectors. This is the proper object that denotes direction.

Anyway sorry for sloppy notes. Cell phone blues...

Try this link too

http://barnes.x10host.com/writing/Vectors%20and%20Trigonometry/Vectors%20and%20Trigonometry.pdf

Yes, when I was writing that task I knew I was most likely getting terminology wrong as I have had zero formal training in mathematics and computer programming. If you wouldn't mind and find yourself with some free time at some point would you be willing to help me correct the terminology? The rewording of key sentences would be of great help. I won't be able to get back this task and correct it for a weeks while I finish up the remaining tutorial. I'll have time then to research the link you sent me and attempt to understand the concepts you laid out for me here. Like I've stated before I envy you math wizards with your knowledge of all things numbered.

Thank you also for helping to improve the tutorial. I welcome all comments especially those that help to improve it.
In order to understand recursion, one must first understand recursion.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #81 on: May 26, 2020, 01:38:53 pm »
The term in question is Component. Check it out on internet, the x component and the y component of a vector.


Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #82 on: May 26, 2020, 01:41:51 pm »
The term in question is Component. Check it out on internet, the x component and the y component of a vector.

Yes, I remember those from Geometry class now. Thank you for pointing that out.
In order to understand recursion, one must first understand recursion.

Offline Virtusoroca

  • Newbie
  • Posts: 24
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #83 on: May 26, 2020, 01:56:26 pm »
Hi @TerryRitchie. I was follwing your tutorial even before join the community. Very broad and helpful. Thanks for the effort. A humble suggestion: maybe some comments could be added in tasks 16 (transparency) and 17 (collision) regarding games based on text characters. It sounds simple but there are some tricky aspects to it, specially in edge-sensitive collision detection between complex (non-rectangular) character sets. I had a hard time figuring that out and ended up hard coding the calculations. @Ashish help me to abstract it further (I didnt posted that yet). Tutoriais on these topics would be great I think. Im willing to help but not sure if Im up to the task.
« Last Edit: May 26, 2020, 02:11:50 pm by Virtusoroca »

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #84 on: May 26, 2020, 03:23:23 pm »
Hi @TerryRitchie. I was follwing your tutorial even before join the community. Very broad and helpful. Thanks for the effort. A humble suggestion: maybe some comments could be added in tasks 16 (transparency) and 17 (collision) regarding games based on text characters. It sounds simple but there are some tricky aspects to it, specially in edge-sensitive collision detection between complex (non-rectangular) character sets. I had a hard time figuring that out and ended up hard coding the calculations. @Ashish help me to abstract it further (I didnt posted that yet). Tutoriais on these topics would be great I think. Im willing to help but not sure if Im up to the task.

I'm interested in seeing some code on what you describe. I would think with characters you're either in another character's spot or not. What I mean is that the letter A for instance isn't going to slide into the position on the screen where a letter I resides. The letter A would simply occupy that position by moving from text position to text position.
In order to understand recursion, one must first understand recursion.

Offline Virtusoroca

  • Newbie
  • Posts: 24
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #85 on: May 26, 2020, 04:04:10 pm »
The simplest way is as you described. Its two independent characters that cant ocuppy the same space. If the space is the same, then collision. Done.

But imagine first that you have layers. Some characters you can walk through, other you cant. It will require arrays. Maybe you want the forefront character to inherit the background color from below  or have its spaces ignored for "transparency" effect. And then imagine youre dealing with a non rectacular set of characters that may have its own collision structure, independently of its design layer. For the collision you will need to do a "player structure layer" calculation against a "terrain structure layer", for each ajdecent array position, dependent on player size, shape, direction and speed.

Thats what I did in my engine, in a clumsy way I believe. For example, you can make the player with up to 3x3 characters (for now), but that is blocked at its corners only, passing through blocks that fit into it (moving over those characters that dont block it, with transparency effect). Its customizable shape will fit perfectly in the terrain structure, like tetris. None of this requiere any particulary dificult function, but the whole construct has its own complexity, different from a pixel/graphics approach.

For the code mess i manage to pull off trying this, take a look at my ASCII Terrain Engine, MovePlayer function (I mean, Sub). Ashish helped me with that mess and in the next version this segment will much more clear and compact.
« Last Edit: May 26, 2020, 05:29:59 pm by Virtusoroca »

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #86 on: June 01, 2020, 04:17:41 pm »
Task 21: Layers and Parallax has been added.
In order to understand recursion, one must first understand recursion.

Offline lawsonm1

  • Newbie
  • Posts: 64
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #87 on: June 02, 2020, 07:39:39 am »
This looks great. I agree about a section on sorting. All I know about is bubble sorting; cheap, easy, and quick. I'm trying to think of a way I can have my sons take the course/tutorial and give them a 'Certificate of Completion' at the end. I taught a computer class at a home school co-op a couple of years ago, and I used QB64. The BASIC section wasn't much, but they had to calculate making a flange based on weight and size requirements. Thanks, Mike

Offline TerryRitchie

  • Seasoned Forum Regular
  • Posts: 495
  • Semper Fidelis
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #88 on: June 02, 2020, 09:24:32 am »
Thank you. I'm glad people are finding it useful. One of my goals for the tutorial is to come up with a set of lesson plans that cover a 9-week and 18-week course based on the tutorial. I was a high school computer science teacher and at one time used QB64 to teach introductory programming. I've gotten emails over the years that other teachers, mostly overseas, were using my tutorial in their classroom.

The sorting topic will be covered in an advanced programming task once I get the beginner course finished.
« Last Edit: June 02, 2020, 09:25:41 am by TerryRitchie »
In order to understand recursion, one must first understand recursion.

Offline lawsonm1

  • Newbie
  • Posts: 64
    • View Profile
Re: QB64SOURCECODE.COM
« Reply #89 on: June 02, 2020, 11:08:02 am »
Sounds like a great plan. Question though; I have a few old BASIC programming books, some are soft copy and others hard copy. I am in the process of 'pulling' the various sort programs from them and putting them into QB64. If you are interested I will post them for any use you all may find. Some are a bit more challenging though. As in I have now idea how to convert PET BASIC from 1982 into normal BASIC, let alone QB64. So it may take me some time. Mike