News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Help with game design?

Started by Scott_Bro, August 24, 2019, 06:25:43 AM

Previous topic - Next topic

Scott_Bro

Dear Kevin,

Hi, How's it going? I am in need of your expertise. I'm working on a new project and the first part went very well but now having trouble moving on.
I'll post the source code but I would like it to be private because it's a lot of hard work.  So I don't know if you can lock it or something or I'll place it and really only want you to take a look at it for now please I hope this get's respected.

What I need help with is collision detection within the game while the screen always changes it's shape. box collision would be great but I need reflectance angles to be correct for everything it touches in the screen_buffer_1 array.

I am satisfied with the rest of the program for now just need to be past collision detection with the right reflectance angles as the screen changes.


Thanks,

And as always thanks for all the help.

Scott_Bro


kevin


QuoteWhat I need help with is collision detection within the game while the screen always changes it's shape. box collision would be great but I need reflectance angles to be correct for everything it touches in the screen_buffer_1 array.

   erm ??   -  you'll need to describe what your doing and how your currently doing it and ultimately what it's meant to do.. 

Scott_Bro

Kevin,
The above game works great while doing all areas though the food-fill is slow.
but the real problem I am having is getting that dang thingy THE QIX to bounce around and not go off the boundries.
It's real weird how that thing moves it's zangy really but It must stay inside the boxed out areas and screen and that's where I'm stuck.
Reflectance?
Though flood-fill needs optimization too.

If you can help I would appreciate it and thanks for modding some of my apps!
Scott_Bro

stevmjon

i know you want this private, can i take a peek at the game to check-out the collision routine you have?

not too long ago i researched 2D & 3D collisions, and i am interested to see your code.
if i came up with an idea that helps, i will share it.

  stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

Scott_Bro

You go for it.  Download the link above but please remember it's my hard work also...
So please don't give it out unless you ask me before you share with someone.

If you want you can help me if you decide you want too.

P.S.
Thanks for you help too.
Scott_Bro

stevmjon

#5
hey scott_bro

i have looked through half your code already, focused on just the main loop. you have done a lot of work too, especially in the gosubs.

> i have modified the opponent (qix) to always stay within the screen bounds (need to check all 3 points on the qix line).
> also a speed boost for the 'draw game field' too.  fx text is also faster.  seperated code into tabs for easier navigation (saves scrolling down huge single pages).

i have written a list at the top of the main tab to see the modifications.
the qix changes direction if it collides with the screen border(like you originally set), but i also added a rotation change too so the qix looks like it bounces off the border.
change that back if you like.

hope this helps you, and i have some ideas for qix collisions with player made boxed areas:
> set collision boxes around player made boxed areas (make as few collision boxes to cover player made areas)
> make a 2D vector perpendicular to qix line (pointing in direction of it moving to keep consistant calc)
> use dot product between qix line 2D vector & each collision box corner point, each set as a vector from the qix line. need to check every box seperately too
> if find collision then check from that box borders & qix line to refine check (this check is easier as all boxes are aligned/perpendicular to the screen. no dot product needed)
> if still collision then rebound qix

this is all in my head, i may need to draw it out. anyway, the qix should stay outside boxed areas (fingers crossed).
i will have a go at this in code and post it when done. i need to go through the gosubs draw routines first.

this is a good challenge. gets the mind calculating. clears the cobwebs.

 stevmjon

*** the code below is private (please ask scott_bro for permission to download) ***
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

Scott_Bro

Thanks for helping and can't wait to see what you do with the code.

Let me clearify something if I can.

Ultimately,  We would want The QIX to move around randomly in at different speeds, different directions, different distances, and rotate either clock-wise or counter-clockwise and Yes! Stay! Inside empty space.

One way I think might do it is...

A.) At one (end) it moves around and reflects.
B.) At other(end) it chnages bounces as it changes direction (not) reflection but direction changes.

C.) Then we could also swap these around from time to time.

Why? Because I think what is happening is what looks like double bounce Or when It bounces It hits again because the other side did. So...
Double reflectance which is (not) good.

That is why I think we need something like the above A.) B.) and C.).

Can you help?
Thanks Again
Scott_Bro


kevin

#7
  I've never really looked at the original but i suspect it's no coincidence that things seem use separate/unique colours.    So when drawing the Qix you could look for any intersections if colours other than black.    The spark thing seems like it could just trace the white colour with a few exceptions.  

 



  Links:

      *  Custom Draw Line Function


stevmjon

#8
hey scott_bro

> i have just added collisions with the qix & player drawn boxes/lines.

i will modify this as requested by you. i got excited and posted this. it ended up being easier than the method i posted earlier.
i am thinking of making the rebound smarter using move vectors & collision surface vectors? this should only change 1 direction, instead of both...

> added a test routine to visually see your data in the buffer arrays on screen (press t in game, then make a shape. make at least 3 shapes for better view).

i added this because there was a lot of data changes and exchanges going on. i am better at visualising how things work.
i hope you like it, i thought it looked cool to keep in game. i love your fill routine when expanding layers around the qix. clever.
also a 2nd add on to slow down the expanding layers around qix and see each cell being calculated individually, see Init.pba > go to very bottom and see option to change a variable to ' animate_test=1 ' .
i recommend you change this at least once and check it out, as it is VERY SLOW, but look cool.

  gettin there, stevmjon


kev, i will check out the video to get some more ideas. thanks for that.


*** the code below is private (please ask scott_bro for permission to download) ***
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

Scott_Bro

Nice Work I especially liked the break-down to all the code.  Your getting to know how I made it by doing so.
I don't need to fix The QIX no more I finally figured it out well enough. It took going over a few times. but...
I you still want to help me make this game It could be ours if you are willing to work hard with me on it because that's what
I'm doing or I would not be moving on myself.  Are you interested?  If so I could use someone to design some graphics / sprites / fonts just for
this program because I don't want to pay to use someone elses.  I don't know if you good at those things? I am more a programmer myself.
but is there anything you can bring to the table?  I see you good at breaking things up and figuring them out as to what they are that's a plus!

I will share with you an updated version once you contact me or leave you email address. I want to keep this off the board a bit. In other words I want to work closely with others not post stuff on the board at lease not the big picture but questions and work-outs yes.

My E-mail address is now

Scott_Bro_1@outlook.com

Let me know what you think?

P.s. You can post yours here so I can send you an update if you are serious but if not please don't waste my time.
Thanks
Scott_Bro

stevmjon

hey scott

i removed the code from my posts above as requested. also, i sent an e-mail to you a few days ago, to Scott_Bro_1@outlook.com (maybe check your junk folder).
in the e-mail i sent qix v3, with qix to player lines collision and some extra player animations (death & re-spawn like in the video kev posted).
the collision is only on the leading line of the qix. it is easy to set-up to read collision with all the qix lines though (i think it is supposed to be this way).

if you didn't get my e-mail, i can modify the qix further to collide with all it's trailing lines with the player, and send v4.

i have been doing 3D modelling lately, where i am re-creating the millennium falcon replica model. i bought the 32 inch model, so decided to make it in 3D. big project...
i am about 40% complete.

i can assist with code, when needed, but i am not really a graphics person/artist. this is where blinkok was great. he was a natural at it.

  stevmjon

It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

Scott_Bro

Dear Kevin,

Happy Holidays!  I see you've done some with the QIX clone.

Here is an updated file.  I've been putting lots of work into it.  It is still not done and I am seeking more help.

I've optimized the flood-fill algorithm and it works great but I am having trouble figuring out which area to fill.
It would be even faster if I had a way of determining the proper one right away.

So, I'm posting an updated version and I hope credits can be respected.

Thanks,
& Merry Christmas! To the playbasic community.

Scott_Bro

kevin


  Here's method for detecting if a point(s) is inside a shape, which can be done by counting the number intersections on a projected line from the test point to the right or left od that point.  Even number of intersections and it's outside, odd and it's inside.