Author Topic: Why dont we collab?  (Read 4620 times)

0 Members and 1 Guest are viewing this topic.

Offline Unseen Machine

  • Forum Regular
  • Posts: 158
  • Make the game not the engine!
    • View Profile
Why dont we collab?
« on: August 05, 2021, 04:54:33 pm »
Hi folks,

Some know me, some wont, either way it's irrelevant as my complaint and question would be valid irrelevant of my status in the community....

Some of us, are, to be fair and honest, F'ing amazing at coding. We've pushed the limits of QB64 and showed whats possible with BASIC. But how often do we work together or use each others code/libs to make projects? Apart from a few made with Fellippes' editor i've very rarely seen anyone pick up someone elses code and run with it. Why is this? How do we fix it? Why was my idea of a QB Blocks library ignored? Surely having an extended library of types and functions that people use as the basis for their libraries/programs isnt to far fetched an idea? (Its what every other freaking language has!)

Can we please address this!?

Whining over....

Unseen

Offline loudar

  • Newbie
  • Posts: 73
  • improve it bit by bit.
    • View Profile
Re: Why dont we collab?
« Reply #1 on: August 05, 2021, 05:00:09 pm »
Hey!

I've thought about this because I've had the same question as you. I don't think it's because people don't *want* to. But often times, when just wanting to try out some code, what you have to do to get it into your IDE is more work than in other IDEs. Something like a library importer and a public library on the website would be absolutely amazing (and I'm willing to help with that if needed). QB64 has TCP support, so automatic network stuff would be possible...
Check out what I do besides coding: http://loudar.myportfolio.com/

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
Re: Why dont we collab?
« Reply #2 on: August 05, 2021, 05:02:04 pm »
I agree that it would be nice to do collaborations with other programmers here on the forum. I am sort of collaborating with loudar (in the capacity of supplying some API help) on his vEdit program. I collaborate with AtomicKevin (on Discord) quite often.
Shuwatch!

Offline Cobalt

  • QB64 Developer
  • Forum Resident
  • Posts: 878
  • At 60 I become highly radioactive!
    • View Profile
Re: Why dont we collab?
« Reply #3 on: August 05, 2021, 08:42:00 pm »
Yeah if you do a search you will probably find where I have mentioned something along these lines, also a few others.
I once mentioned that maybe Steve should come up with a story line,
I could work on controls, maybe some graphics code,
somebody could make or find the graphics
somebody on logistics
ect
ect.
if we would go on a Game tangent, would be different on a Application tangent.
 
Biggest problems are,
A- Motivation, keeping everybody motivated in the early stages when things tend to drag. Most people drop off after the first 7-10 days,   
    you get that initial pumped up boom at the start then flat line.... then there is typically a boom again in later stages as things come
    together.
B- Logistics, we are technically Global, many different time zones and regions. We might all have an 'assigned' task but we may need
    to know what others are planning, say on the graphics, need to know the size, amount, type to be able to code for it. How easy
    would it be to get information from another party in a timely manor at any and all hours of the day?
C- Home life; work, school, chores, dates, ect ect..  how much time will the people involved have to put toward it?
D- Code style.... need I say more?


I always thought it would be a really great idea, we have some pretty great people in this community that for the most part get along well. but the amount of prep and contributions might make it a stretch to do on just a 'love-of-the-art' hobbyist approach.  I don't believe any of us are rich enough to be able to put up some minor funds to help keep things together.
Granted after becoming radioactive I only have a half-life!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Why dont we collab?
« Reply #4 on: August 08, 2021, 02:10:05 am »
In the two decades I spent at the QBasic Forum, we only had one group project. The owner, at that time, Mac, wanted to make a Danish Chess game. Four of us collaborated to put it together. Much like the library concept mentioned in this thread. We all worked on separate parts, so no one really had to understand another's coding style. Mac set certain parameters, so it would all tie seamlessly together. It took very little debugging that way. Amazingly, everyone got along throughout the project, but I'd say we were all dedicated coders. No slacker(s) in the mix. No "The dog ate my flash drive!" excuses. It all came together in the projected time alloted. While I can't say I prefer working with others over coding by myself, I can say it didn't suck in the least, but I still felt one and done was takeaway from that experience and truth be told, I pretty much coded ahead to complete most of the game, myself. I guess I just prefer to create the whole rather than only to be responsible for the part.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: Why dont we collab?
« Reply #5 on: August 08, 2021, 07:48:00 am »
It seems to me that the forum is a form of collab already, only without deadlines and expectations. Each contributes commensurate to their abilities and inclinations. If the dog eats my hard drive or I'm called away by life's vicissitudes, it doesn't impact anyone else. When someone posts a particularly good algorithm, they've collaborated on my projects involuntarily.

Having always been a solitary programmer, overt collaboration is something of a foreign concept to me. I often find other folks code incomprehensible. I take it as a given that it can be done when properly compartmentalized, but I've never attempted it.

Given that if my code were a boat, the Coast Guard would probably impound it, I assume that when others look at it they are wondering what drugs I'm on...

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Why dont we collab?
« Reply #6 on: August 08, 2021, 11:44:31 pm »
If your code was a boat... I hope you use _FLOAT.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline George McGinn

  • Global Moderator
  • Forum Regular
  • Posts: 210
    • View Profile
    • Resume
Re: Why dont we collab?
« Reply #7 on: August 09, 2021, 12:36:07 am »
Actually, some of us do collaborate and use each other's code, whether it be in discussions on Discord or here in the forums.

For example, I've worked with @bplus and others in the string math post where we both shared code and used each others.

I've worked with Zach (@SpriggsySpriggs) on both modifying and having him write a new strtok function in basic, discussed on Discord, which I am testing right now.

I've also taken Zach's examples using Zenity GUI on Linux and developed a full blown program. And I extensively use is pipecom function (as do many others here).

And I've taken what little has been done with mySQL, and am currently writting a system that uses everything from BASH scripts to stored procedures, and even building within QB64 SQL queries from within the program.

I share when a program is complete and free of obvious bugs.

@Dav, who I know from elsewhere, has some great routines that he shares and contributes to here.

Like @OldMoses, I think a great amount of collaboration and code-sharing goes on here. That is what we are all about. Since QB64 is itself open source, most programmers here share their work for others to learn and use, and even improve on.


 

Hi folks,

Some know me, some wont, either way it's irrelevant as my complaint and question would be valid irrelevant of my status in the community....

Some of us, are, to be fair and honest, F'ing amazing at coding. We've pushed the limits of QB64 and showed whats possible with BASIC. But how often do we work together or use each others code/libs to make projects? Apart from a few made with Fellippes' editor i've very rarely seen anyone pick up someone elses code and run with it. Why is this? How do we fix it? Why was my idea of a QB Blocks library ignored? Surely having an extended library of types and functions that people use as the basis for their libraries/programs isnt to far fetched an idea? (Its what every other freaking language has!)

Can we please address this!?

Whining over....

Unseen
____________________________________________________________________
George McGinn
Theoretical/Applied Computer Scientist
Member: IEEE, IEEE Computer Society
Technical Council on Software Engineering
IEEE Standards Association
American Association for the Advancement of Science (AAAS)

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Why dont we collab?
« Reply #8 on: August 09, 2021, 03:33:04 am »
If your code was a boat... I hope you use _FLOAT.

Pete

My code is a shark, and it can _BYTE, whereas Pete’s code is all alone and forlorn wasting away on screen 0 — it doesn’t get any more SINGLE than that!
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline krovit

  • Forum Regular
  • Posts: 179
    • View Profile
Re: Why dont we collab?
« Reply #9 on: August 09, 2021, 06:02:57 am »
Hi,

Collaboration is an absolute value that has a decisive weight in all things of life, from spiritual to practical...
In the field of programming it seems to me that this has been happening for years now.
The strategic vision of the problem and the optimization of the code, together with the collaboration and exchange of information is the key to its solution.

However...

in my opinion:

We need a common problem to tackle.
We need a person who has a good idea on how to proceed and that this idea is understood and approved by the collaborators.
A level of knowledge and technical expertise is required that is at least comparable among the participants necessary.
A similar "mental" approach is needed.
Separately developed parts must have specific input information and equally specific output settings so that the parts can be combined as in a puzzle.
The style of the result must be compatible - if not perfectly compliant - to the set in its total.

In here there are some very advanced in the knowledge of the language and gifted with imagination in finding a solution. Many others are at an average level that will hardly be of help to the former, but perhaps it will be to those who have just begun...

In short.. the thing is complex, however I must say that all or almost all the questions in this forum get the right answer!

And the reason is simple: people are kind and helpful (and I always say it: elsewhere it is not so)

To say... Once I was kicked out of the forum of an honestly very powerful language only - I just say - for asking if there was a function on the type of the one already present in VB. I was told that I would go to hell if I wanted something like this because they were from another parish...



A shared library is another type of approach.
But I would like to know how that library thinks so that I can insert it adequately in my projects often, given the result that is obtained, in fact, the library must be modified or adapted.
Sometimes the code is incomprehensible and refers to knowledge that... they are not known (difficult to intervene!)


« Last Edit: August 09, 2021, 06:09:27 am by krovit »
Nothing is easy, especially when it appears simple (and nothing could be as dangerous as trying to do good to others)

Offline TempodiBasic

  • Forum Resident
  • Posts: 1792
    • View Profile
Re: Why dont we collab?
« Reply #10 on: August 09, 2021, 09:37:05 am »
Hi
@Unseen Machine
also I have a great love for QB64 and its community.
Also I feel that it can be greater (or the greatest) as language of programming  and as community than that it is now.
This desire to see a greater QB64 doesn't let me not appreciate that QB64 is growing up and community has grown up and this trend of changement is going on.

@QB64 Community
The mix of coders of different levels and knowledges let  that community is an active place to share opinions, ideas and skill of coding.The more experienced give tips and trick and path to develope specific features to the less experienced, and these last give ideas, opinions and feedbacks that become point of thinking and developing for the first one.

About QB Block or whatever we want call a suite of embedded library to use like it is done in other modern programming languages, I reply "it is a good stuff" and about this it is useful a brainstorming to find the persons and the roles that they must have in this large project.
At the time of .NET I found a set of different libraries left as works already done and just ready to use in developing 2D sprite games and GUI of applications. At those days each library was cool but it was very difficult to use 2 or more libraries together for duplicate name errors, because in each library there is a CONST or variable TRUE and FALSE and UP or ArrowUp and DOWN or ArrowDown etc etc... of Functions and SUBroutines with the same name.
So the coder was tempted to choose the library more suitable for his need and code by himself the rest of code that was in another library.
So the advantage to have a specific module to create library to add to the set of libraries with no problem of integration is evident and big.
Thanks to Unseen to make ripples on the water, thanks to QB64 community to interact to this stimulus.
Thanks to all so I have learned another proverb in english that is very different from that italian.

Programming isn't difficult, only it's  consuming time and coffee

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Why dont we collab?
« Reply #11 on: August 09, 2021, 01:24:25 pm »
@Unseen Machine

https://www.qb64.org/forum/index.php?topic=3690.msg130348#msg130348
Locked out, gotta say what you said in thread seems inconsistent with your signature.

Need to start a thread in Programs Board, perhaps with a wish list of Blocks, maybe call it Block Party.

Why are you asking for permission? get going :-))

I've a feeling you have a library already started.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Why dont we collab?
« Reply #12 on: August 09, 2021, 01:41:03 pm »
I found a Physics Engine by @TerryRitchie, maybe you can kick things off with it?
Code: QB64: [Select]
  1. Const FALSE = 0, TRUE = Not FALSE
  2. Const TIMESTEP = 1 / 30 '          total engine updates per second - should match any _LIMIT FPS in program
  3. Const BALLS = 25
  4. Const ROUND = 0, SQUARE = 1
  5. Const SWIDTH = 800
  6. Const SHEIGHT = 600
  7. Const FIXED = TRUE
  8. Const NONFIXED = FALSE
  9.  
  10. Type OBJECT
  11.     Inuse As Integer '         is object currently in use (TRUE / FALSE)
  12.     Xpos As Single '           x position of object
  13.     Ypos As Single '           y position of object
  14.     Xvel As Single '           horizontal velocity of object
  15.     Yvel As Single '           vertical velocity of object
  16.     Radius As Single '         radius of object
  17.     Gravity As Single '        object is affected by gravity (0 = no gravity, >0 gravity present)
  18.     Friction As Single '       object has friction (0 = no friction, >0 friction present, use small increments of .1)
  19.     Attract As Single '        amount of attraction to another object (0 = no attraction, <0 = repulsion, >0 = attraction)
  20.     AttractedTo As Integer '   handle of object attracted to
  21.     Elastic As Single '        object has elastic collisions
  22.     Fixed As Integer '         object is in a fixed position (TRUE / FALSE)
  23.     MaxSpeed As Single '       object's maximum speed
  24.     Shape As Integer '         object's shape (0 for circle, 1 for square)
  25.  
  26. ReDim Object(0) As OBJECT '    array to hold objects
  27. Dim Ball%(BALLS)
  28. Dim Bcolor~&(BALLS)
  29. Dim Count%
  30. Dim rndRadius!, rndXpos!, rndYpos!, rndXvel!, rndYvel!
  31. Dim Dummy%
  32. Dim Paddle%
  33. Dim OldMouseX%, OldMouseY%
  34.  
  35. Screen _NewImage(SWIDTH, SHEIGHT, 32)
  36.  
  37. For Count% = 1 To BALLS '                                                      create random ball objects
  38.     rndRadius! = Int(Rnd(1) * 20) + 10
  39.     Bcolor~&(Count%) = _RGB32(Int(Rnd(1) * 256), Int(Rnd(1) * 256), Int(Rnd(1) * 256))
  40.     Ball%(Count%) = DEFINEOBJECT(ROUND, rndRadius!)
  41.     APPLYFRICTION Ball%(Count%), .01
  42.     APPLYMAXSPEED Ball%(Count%), 100
  43.     APPLYELASTIC Ball%(Count%), 1
  44.     rndXpos! = Int(Rnd(1) * (SWIDTH - 1 - OBJECTRADIUS(Ball%(Count%)) * 2)) + OBJECTRADIUS(Ball%(Count%))
  45.     rndYpos! = Int(Rnd(1) * (SHEIGHT - 1 - OBJECTRADIUS(Ball%(Count%)) * 2)) + OBJECTRADIUS(Ball%(Count%))
  46.     rndXvel! = (Rnd(1) - Rnd(1)) '* 3
  47.     rndYvel! = (Rnd(1) - Rnd(1)) '* 3
  48.     PUTOBJECT Ball%(Count%), rndXpos!, rndYpos!, rndXvel!, rndYvel!, NONFIXED ' define where ball resides
  49. Next Count%
  50.  
  51. Paddle% = DEFINEOBJECT(ROUND, 40) '                                            create a fixed ball with radius of 40
  52. APPLYELASTIC Paddle%, .1 '                                                     give a slightly bouncy surface
  53. PUTOBJECT Paddle%, SWIDTH / 2 - 1, SHEIGHT / 2 - 1, 0, 0, FIXED '              define where object resides
  54. _MouseMove SWIDTH / 2 - 1, SHEIGHT / 2 - 1
  55.  
  56.     _Limit 30 ' we limit simulation to 30FPS - note that TIMESTEP constant should match this to avoid tunneling through objects
  57.     Cls
  58.     While _MouseInput: Wend '                                                  get latest mouse information
  59.     SETOBJECTX Paddle%, _MouseX '                                              set paddle object X location
  60.     SETOBJECTY Paddle%, _MouseY '                                              set paddle object Y location
  61.     SETOBJECTXVEL Paddle%, OBJECTX(Paddle%) - OldMouseX% '                     set paddle object X velocity
  62.     SETOBJECTYVEL Paddle%, OBJECTY(Paddle%) - OldMouseY% '                     set paddle object Y velocity
  63.     OldMouseX% = OBJECTX(Paddle%) '                                            remember paddle X position
  64.     OldMouseY% = OBJECTY(Paddle%) '                                            remember paddle Y location
  65.     For Count% = 1 To BALLS '
  66.         Dummy% = INTERACTION(Ball%(Count%)) '                                  check this ball's interaction with all other objects
  67.         If OBJECTX(Ball%(Count%)) < OBJECTRADIUS(Ball%(Count%)) Then '         keep balls constrained to screen
  68.             SETOBJECTXVEL Ball%(Count%), -OBJECTXVEL(Ball%(Count%))
  69.             SETOBJECTX Ball%(Count%), OBJECTRADIUS(Ball%(Count%))
  70.         End If
  71.         If OBJECTX(Ball%(Count%)) > SWIDTH - OBJECTRADIUS(Ball%(Count%)) Then
  72.             SETOBJECTXVEL Ball%(Count%), -OBJECTXVEL(Ball%(Count%))
  73.             SETOBJECTX Ball%(Count%), SWIDTH - OBJECTRADIUS(Ball%(Count%))
  74.         End If
  75.         If OBJECTY(Ball%(Count%)) < OBJECTRADIUS(Ball%(Count%)) Then
  76.             SETOBJECTYVEL Ball%(Count%), -OBJECTYVEL(Ball%(Count%))
  77.             SETOBJECTY Ball%(Count%), OBJECTRADIUS(Ball%(Count%))
  78.         End If
  79.         If OBJECTY(Ball%(Count%)) > SHEIGHT - OBJECTRADIUS(Ball%(Count%)) Then
  80.             SETOBJECTYVEL Ball%(Count%), -OBJECTYVEL(Ball%(Count%))
  81.             SETOBJECTY Ball%(Count%), SHEIGHT - OBJECTRADIUS(Ball%(Count%))
  82.         End If
  83.         Circle (OBJECTX(Ball%(Count%)), OBJECTY(Ball%(Count%))), OBJECTRADIUS(Ball%(Count%)), Bcolor~&(Count%)
  84.         Paint (OBJECTX(Ball%(Count%)), OBJECTY(Ball%(Count%))), Bcolor~&(Count%), Bcolor~&(Count%)
  85.     Next Count%
  86.     Circle (OBJECTX(Paddle%), OBJECTY(Paddle%)), OBJECTRADIUS(Paddle%), _RGB32(255, 255, 255)
  87.     Paint (OBJECTX(Paddle%), OBJECTY(Paddle%)), _RGB32(255, 255, 255), _RGB32(255, 255, 255)
  88.     _Display
  89.  
  90. '------------------------------------------------------------------------------
  91.  
  92. Function OBJECTYVEL (Handle%)
  93.  
  94.     '**
  95.     '** returns the Y velocity of an object
  96.     '**
  97.  
  98.     Shared Object() As OBJECT
  99.  
  100.     OBJECTYVEL = Object(Handle%).Yvel
  101.  
  102.  
  103. '------------------------------------------------------------------------------
  104.  
  105. Sub SETOBJECTY (Handle%, Ypos!)
  106.  
  107.     '**
  108.     '** returns the Y location of an object
  109.     '**
  110.  
  111.     Shared Object() As OBJECT
  112.  
  113.     Object(Handle%).Ypos = Ypos!
  114.  
  115.  
  116. '------------------------------------------------------------------------------
  117.  
  118. Sub SETOBJECTYVEL (Handle%, Yvel!)
  119.  
  120.     '**
  121.     '** sets the Y velocity of an object
  122.     '**
  123.  
  124.     Shared Object() As OBJECT
  125.  
  126.     Object(Handle%).Yvel = Yvel!
  127.  
  128.  
  129. '------------------------------------------------------------------------------
  130.  
  131. Sub SETOBJECTX (Handle%, Xpos!)
  132.  
  133.     '**
  134.     '** sets the X location of an object
  135.     '**
  136.  
  137.     Shared Object() As OBJECT
  138.  
  139.     Object(Handle%).Xpos = Xpos!
  140.  
  141.  
  142. '------------------------------------------------------------------------------
  143.  
  144. Function OBJECTXVEL (Handle%)
  145.  
  146.     '**
  147.     '** returns the X velocity of an object
  148.     '**
  149.  
  150.     Shared Object() As OBJECT
  151.  
  152.     OBJECTXVEL = Object(Handle%).Xvel
  153.  
  154.  
  155. '------------------------------------------------------------------------------
  156.  
  157. Sub SETOBJECTXVEL (Handle%, Xvel!)
  158.  
  159.     '**
  160.     '** sets the X velocity of an object
  161.     '**
  162.  
  163.     Shared Object() As OBJECT
  164.  
  165.     Object(Handle%).Xvel = Xvel!
  166.  
  167.  
  168. '------------------------------------------------------------------------------
  169.  
  170. Function DEFINEOBJECT (Shape%, Radius!)
  171.  
  172.     '**
  173.     '** defines an object (very basic, not finished yet)
  174.     '**
  175.  
  176.     Shared Object() As OBJECT
  177.  
  178.     Dim ob%
  179.  
  180.     ob% = UBound(Object) + 1
  181.     ReDim _Preserve Object(ob%) As OBJECT
  182.  
  183.     Object(ob%).Inuse = -1
  184.     Object(ob%).Xpos = 0
  185.     Object(ob%).Ypos = 0
  186.     Object(ob%).Xvel = 0
  187.     Object(ob%).Yvel = 0
  188.     Object(ob%).Radius = Radius!
  189.     Object(ob%).Gravity = 0
  190.     Object(ob%).Friction = 0
  191.     Object(ob%).Attract = 0
  192.     Object(ob%).AttractedTo = 0
  193.     Object(ob%).Elastic = 1
  194.     Object(ob%).Fixed = 0
  195.     Object(ob%).MaxSpeed = 100
  196.     Object(ob%).Shape = Shape%
  197.  
  198.     DEFINEOBJECT = ob%
  199.  
  200.  
  201. '------------------------------------------------------------------------------
  202.  
  203. Function OBJECTRADIUS (Handle%)
  204.  
  205.     '**
  206.     '** returns the radius of an object
  207.     '**
  208.  
  209.     Shared Object() As OBJECT
  210.  
  211.     OBJECTRADIUS = Object(Handle%).Radius
  212.  
  213.  
  214. '------------------------------------------------------------------------------
  215.  
  216. Function OBJECTY (Handle%)
  217.  
  218.     '**
  219.     '** returns the Y location of an object
  220.     '**
  221.  
  222.     Shared Object() As OBJECT
  223.  
  224.     OBJECTY = Object(Handle%).Ypos
  225.  
  226.  
  227. '------------------------------------------------------------------------------
  228.  
  229. Function OBJECTX (Handle%)
  230.  
  231.     '**
  232.     '** returns the X location of an object
  233.     '**
  234.  
  235.     Shared Object() As OBJECT
  236.  
  237.     OBJECTX = Object(Handle%).Xpos
  238.  
  239.  
  240. '------------------------------------------------------------------------------
  241.  
  242. Sub APPLYMAXSPEED (Handle%, Maxspeed!)
  243.  
  244.     '**
  245.     '** sets the maximum speed of an object (setting too low causes 45 degree movement, need to investigate)
  246.     '**
  247.  
  248.     Shared Object() As OBJECT
  249.  
  250.     Object(Handle%).MaxSpeed = Maxspeed!
  251.  
  252.  
  253. '------------------------------------------------------------------------------
  254.  
  255. Sub APPLYELASTIC (Handle%, Elastic!)
  256.  
  257.     '**
  258.     '** sets the elastic property of an object (setting too low allows tunneling, need to investigate)
  259.     '**
  260.  
  261.     Shared Object() As OBJECT
  262.  
  263.     Object(Handle%).Elastic = Elastic!
  264.  
  265.  
  266. '------------------------------------------------------------------------------
  267.  
  268. Sub APPLYATTRACTION (Handle%, HandleTo%, Attract!)
  269.  
  270.     '**
  271.     '** sets the attration to another object
  272.     '**
  273.  
  274.     Shared Object() As OBJECT
  275.  
  276.     Object(Handle%).Attract = Attract!
  277.     Object(Handle%).AttractedTo = HandleTo%
  278.  
  279.  
  280. '------------------------------------------------------------------------------
  281.  
  282. Sub APPLYFRICTION (Handle%, Friction!)
  283.  
  284.     '**
  285.     '** sets the friction amount for an object
  286.     '**
  287.  
  288.     Shared Object() As OBJECT
  289.  
  290.     Object(Handle%).Friction = Friction!
  291.  
  292.  
  293. '------------------------------------------------------------------------------
  294.  
  295. Sub APPLYGRAVITY (Handle%, Gravity!)
  296.  
  297.     '**
  298.     '** sets the amount of gravity on an object
  299.     '**
  300.  
  301.     Shared Object() As OBJECT
  302.  
  303.     Object(Handle%).Gravity = Gravity!
  304.  
  305.  
  306. '------------------------------------------------------------------------------
  307.  
  308. Sub PUTOBJECT (Handle%, Xpos!, Ypos!, Xvel!, Yvel!, Fixed%)
  309.  
  310.     '**
  311.     '** defines where object resides
  312.     '**
  313.  
  314.     Shared Object() As OBJECT
  315.  
  316.     Object(Handle%).Xpos = Xpos!
  317.     Object(Handle%).Ypos = Ypos!
  318.     Object(Handle%).Xvel = Xvel!
  319.     Object(Handle%).Yvel = Yvel!
  320.     Object(Handle%).Fixed = Fixed%
  321.  
  322.  
  323. '------------------------------------------------------------------------------
  324.  
  325. Function INTERACTION (H1%)
  326.  
  327.     '**
  328.     '** Checks the interaction between objects for a collision then calculates
  329.     '** the new object position based on those calculations.
  330.     '**
  331.     '** H1% - handle of object to test for collision
  332.     '**
  333.     '** Returns: 0 (FALSE) if no collision occured
  334.     '**         >0 the object that was collided with
  335.     '**
  336.     '** Function also updates gravity, friction and repulsion/attraction between the two objects.
  337.     '**
  338.     '** Note: this function is far from complete. Variables need to be updated with variables names and
  339.     '**       types identifiers that make sense.
  340.     '**
  341.  
  342.  
  343.     Shared Object() As OBJECT
  344.  
  345.     Dim Diameter! '                                   the radius of object 1 plus the radius of object 2
  346.     Dim Distance! '                                   the distance from the center point of object 1 to the center point of object 2
  347.     Dim FrictionScale! '                              amount of frictional force to add to an object
  348.     Dim Xdifference! '                                the distance between object 1 X position and object 2 X position
  349.     Dim Ydifference! '                                the distance between object 1 Y position and onject 2 Y position
  350.     Dim H1Xvel!, H1Yvel!, H1Xpos!, H1Ypos! '          object 1's X and Y velocities and X and Y positions
  351.     Dim H2Xvel!, H2Yvel!, H2Xpos!, H2Ypos! '          object 2's X and Y velocities and X and Y positions
  352.     Dim cH1Xvel!, cH1Yvel!, cH1Xpos!, cH1Ypos! '      object 1's X and Y velocities and X and Y positions
  353.     Dim cH2Xvel!, cH2Yvel!, cH2Xpos!, cH2Ypos! '      object 2's X and Y velocities and X and Y positions
  354.     Dim CoefA!, CoefB!, CoefC! '                      object collision time coefficients
  355.     Dim TouchTime! '                                  actual time when object's touched
  356.     Dim MomentumX!, MomentumY! '                      momentum loss of objects when collision occurred
  357.     Dim OB! '                                         center line velocity vector
  358.     Dim Elastic! '                                    amount of elasticity applied to objects
  359.  
  360.     If Object(H1%).Fixed Then Exit Function '                                                if object is in a fixed position no need to continue
  361.  
  362.     For H2% = 1 To UBound(Object) '                                                          cycle through all defined objects
  363.         If (H2% <> H1%) And Object(H2%).Inuse Then '                                         object can't check itself or objects not in use
  364.  
  365.             diam = Object(H1%).Radius + Object(H2%).Radius '                                 calculate the length of both object radii
  366.  
  367.             '** update object position
  368.  
  369.             u = MIN(Object(H1%).MaxSpeed, MAX(Object(H1%).Xvel, -Object(H1%).MaxSpeed)) '    set maximum X velocity of object if needed
  370.             v = MIN(Object(H1%).MaxSpeed, MAX(Object(H1%).Yvel, -Object(H1%).MaxSpeed)) '    set maximum Y velocity of object if needed
  371.             x = Object(H1%).Xpos + TIMESTEP * u '                                            update object's X position
  372.             y = Object(H1%).Ypos + TIMESTEP * v '                                            update object's Y position
  373.  
  374.             ' ** Gravity and Friction
  375.  
  376.             u = Object(H1%).Xvel '                                                           get object's X velocity
  377.             v = Object(H1%).Yvel '                                                           get object's Y velocity
  378.             fricscale = 1 - Object(H1%).Friction / Sqr(1 + u ^ 2 + v ^ 2) '                  calculate the amount of friction needed (if any)
  379.             Object(H1%).Xvel = fricscale * u '                                               apply friction amount to object's X velocity
  380.             Object(H1%).Yvel = fricscale * v + Object(H1%).Gravity '                         apply friction and gravity amounts tp object's Y velocity
  381.  
  382.             '** check for collision
  383.  
  384.             xi = x '                                                                         copy object's updated X position
  385.             yi = y '                                                                         copy object's updated Y position
  386.             xj = Object(H2%).Xpos '                                                          get 2nd object's X position
  387.             yj = Object(H2%).Ypos '                                                          get 2nd object's Y position
  388.             dx = xi - xj '                                                                   calculate X distance between objects
  389.             dy = yi - yj '                                                                   calculate Y distance between objetcs
  390.             dist = Sqr(dx ^ 2 + dy ^ 2) '                                                    calculate center to center distance between objects
  391.             If dist < diam Then '                                                            is center to center distance less than diameter?
  392.                 INTERACTION = H2% '                                                          yes, return object that was collided with
  393.  
  394.                 '** get object vectors
  395.  
  396.                 ui = Object(H1%).Xvel '                                                      get object's X velocity
  397.                 vi = Object(H1%).Yvel '                                                      get object's Y velocity
  398.                 uj = Object(H2%).Xvel '                                                      get 2nd object's X velocity
  399.                 vj = Object(H2%).Yvel '                                                      get 2nd object's Y velocity
  400.  
  401.                 '** move backwards in time until the two objects are just touching
  402.  
  403.                 CoefA = (ui - uj) ^ 2 + (vi - vj) ^ 2 '                                      calculate time coefficiants of actual objects touching
  404.                 CoefB = 2 * ((ui - uj) * (xi - xj) + (vi - vj) * (yi - yj))
  405.                 CoefC = (xi - xj) ^ 2 + (yi - yj) ^ 2 - diam ^ 2
  406.                 If CoefA = 0 Then
  407.                     t = -CoefC / CoefB
  408.                 Else
  409.                     If TIMESTEP >= 0 Then
  410.                         t = (-CoefB - Sqr(CoefB ^ 2 - 4 * CoefA * CoefC)) / (2 * CoefA)
  411.                     Else
  412.                         t = (-CoefB + Sqr(CoefB ^ 2 - 4 * CoefA * CoefC)) / (2 * CoefA)
  413.                     End If
  414.                 End If
  415.                 xi = xi + t * ui '                                                           move object's X location to this point in time
  416.                 yi = yi + t * vi '                                                           move object's Y location to this point in time
  417.                 xj = xj + t * uj '                                                           move 2nd object's X location to this point in time
  418.                 yj = yj + t * vj '                                                           move 2nd object's Y location to this point in time
  419.  
  420.                 '** center of momentum coordinates
  421.  
  422.                 mx = (ui + uj) / 2 '                                                         calculate horizontal loss of momentum between objects
  423.                 my = (vi + vj) / 2 '                                                         calculate vertical loss of momentum between objects
  424.                 ui = ui - mx '                                                               update object's X velocity based on momentum loss
  425.                 vi = vi - my '                                                               update object's Y velocity based on momentum loss
  426.                 uj = uj - mx '                                                               update 2nd object's X velocity based on momentum loss
  427.                 vj = vj - my '                                                               update 2nd object's Y velocity based on momentum loss
  428.  
  429.                 '** new center to center line
  430.  
  431.                 dx = xi - xj '                                                               calculate X distance between objects
  432.                 dy = yi - yj '                                                               calculate Y distance between objects
  433.                 dist = Sqr(dx ^ 2 + dy ^ 2) '                                                calculate center to center distance between objects
  434.                 dx = dx / dist '
  435.                 dy = dy / dist
  436.  
  437.                 '** reflect object veolcity vectors in center to center line
  438.  
  439.                 OB = -(dx * ui + dy * vi)
  440.                 ui = ui + 2 * OB * dx
  441.                 vi = vi + 2 * OB * dy
  442.                 OB = -(dx * uj + dy * vj)
  443.                 uj = uj + 2 * OB * dx
  444.                 vj = vj + 2 * OB * dy
  445.  
  446.                 '** back to moving coordinates with elastic velocity change
  447.  
  448.                 e = Sqr(Object(H1%).Elastic)
  449.                 ui = e * (ui + mx)
  450.                 vi = e * (vi + my)
  451.                 uj = e * (uj + mx)
  452.                 vj = e * (vj + my)
  453.  
  454.                 '** move to new bounced position
  455.  
  456.                 xi = xi - t * ui
  457.                 yi = yi - t * vi
  458.                 xj = xj - t * uj
  459.                 yj = yj - t * vj
  460.  
  461.                 '** set object velocities
  462.  
  463.                 Object(H1%).Xvel = ui
  464.                 Object(H1%).Yvel = vi
  465.  
  466.                 '** set 2nd object velocities and position if allowed to respond to first object
  467.  
  468.                 If Not Object(H2%).Fixed Then
  469.                     Object(H2%).Xvel = uj
  470.                     Object(H2%).Yvel = vj
  471.                     Object(H2%).Xpos = xj
  472.                     Object(H2%).Ypos = yj
  473.                 End If
  474.  
  475.                 '** set object position
  476.  
  477.                 x = xi
  478.                 y = yi
  479.             End If
  480.  
  481.             '** attrack/repel the two objects to/against each other
  482.  
  483.             If (Object(H1%).Attract <> 0) And (Object(H1%).AttractedTo = H2%) Then
  484.                 xm = Object(H2%).Xpos - x
  485.                 ym = Object(H2%).Ypos - y
  486.                 dist = xm ^ 2 + ym ^ 2
  487.                 dist = MAX(dist, Object(H1%).Radius ^ 2)
  488.                 Object(H1%).Xvel = Object(H1%).Attract * xm / dist + Object(H1%).Xvel
  489.                 Object(H1%).Yvel = Object(H1%).Attract * ym / dist + Object(H1%).Yvel
  490.                 Object(H2%).Xvel = Object(H1%).Attract * xm / dist + Object(H2%).Xvel
  491.                 Object(H2%).Yvel = -Object(H1%).Attract * ym / dist + Object(H2%).Yvel
  492.             End If
  493.  
  494.             '** save position of object
  495.  
  496.             Object(H1%).Xpos = x
  497.             Object(H1%).Ypos = y
  498.  
  499.         End If
  500.     Next H2%
  501.  
  502.  
  503. '------------------------------------------------------------------------------
  504.  
  505. Function MIN (Num1!, Num2!)
  506.  
  507.     '**
  508.     '** returns the smallest number passed in
  509.     '**
  510.  
  511.     If Num1! < Num2! Then
  512.         MIN = Num1!
  513.     Else
  514.         MIN = Num2!
  515.     End If
  516.  
  517.  
  518. '------------------------------------------------------------------------------
  519.  
  520. Function MAX (Num1!, Num2!)
  521.  
  522.     '**
  523.     '** returns the largest number passed in
  524.     '**
  525.  
  526.     If Num1! > Num2! Then
  527.         MAX = Num1!
  528.     Else
  529.         MAX = Num2!
  530.     End If
  531.  
  532.  
  533.  

Offline Aurel

  • Forum Regular
  • Posts: 167
    • View Profile
Re: Why dont we collab?
« Reply #13 on: August 09, 2021, 05:41:39 pm »
I have answer ...
i am just lazy lurker here
//////////////////////////////////////////////////////////////////
https://aurelsoft.ucoz.com
https://www.facebook.com/groups/470369984111370
//////////////////////////////////////////////////////////////////

Offline Bert22306

  • Forum Regular
  • Posts: 206
    • View Profile
Re: Why dont we collab?
« Reply #14 on: August 09, 2021, 09:39:12 pm »
Having always been a solitary programmer, overt collaboration is something of a foreign concept to me. I often find other folks code incomprehensible. I take it as a given that it can be done when properly compartmentalized, but I've never attempted it.

Given that if my code were a boat, the Coast Guard would probably impound it, I assume that when others look at it they are wondering what drugs I'm on...

:)

I'm much like OldMoses on this. And also, I've never had any problem getting an expert answer, when I've had questions. So I have zero complaints on the collaboration front. And those few times when I had something to offer as answer, ditto.

But there's another issue - time. To contribute adequately well on a real project, each person on the team has to be able to dedicate actual time, reliably. That's not always something I can guarantee, even if I were a good enough programmer to make a contribution.