Register - Login
Views: 99830231
Main - Memberlist - Active users - Calendar - Wiki - IRC Chat - Online users
Ranks - Rules/FAQ - Stats - Latest Posts - Color Chart - Smilies
05-03-22 09:08:58 PM
Jul - Craziness Domain - another thing New poll - New thread - New reply
Next newer thread | Next older thread
Xkeeper

Level: 263


Posts: 17473/25353
EXP: 297157138
For next: 1803315

Since: 07-03-07

Pronouns: they/them/????????

Since last post: 3 days
Last activity: 14 hours

Posted on 08-19-10 06:32:38 PM (last edited by Xkeeper at 08-19-10 03:35 PM) Link | Quote


file (zip as .love)

just a test, getting some basic structures down. if nothing else it's probably more complete than automap asteroids.

____________________
Sails
2800
as a video game‎‎‎‏‏‎ grows old its content and‏‏‎ internal logic‏‏‎ deteriorateÿ
Level: 102


Posts: 2374/2803
EXP: 10922943
For next: 167024

Since: 07-04-07

Pronouns: He/Him
From: MA

Since last post: 120 days
Last activity: 29 days

Posted on 08-19-10 06:40:10 PM Link | Quote
guess what part i made1

____________________
Xkeeper

Level: 263


Posts: 17474/25353
EXP: 297157138
For next: 1803315

Since: 07-03-07

Pronouns: they/them/????????

Since last post: 3 days
Last activity: 14 hours

Posted on 08-19-10 06:48:36 PM Link | Quote
main.lua has all the fun main loop shit.

conf.lua helpfully sets the title bar to "--" for all of a millisecond. :specialed:

ai.lua contains the conglomo-corp fun bonus land functions that I have yet to split into individual areas, which is a shame because it's actually kind of organized outside of the total clusterf@ck that is the main file.


There are some hackishly implemented features, like the 1-3 handling is completely temporary and not at all the future way of doing things, and the collision routine isn't done (I need to figure out how to do it the right way).


If I can figure out how to reliably and easily do collision detection between circles and arbitrarily-sized/rotated rectangles this would be easy. It's a damn shame I forgot just about everything from classes that would've been useful for that purpose.

(circle to circle is easy; dist < (r1 + r2); 0° rectangles are easy too (just checking the corners, though it would fail if they were crossing each other but neither corner was within the other). Other cases = auugh my brain)

____________________
Xkeeper

Level: 263


Posts: 17483/25353
EXP: 297157138
For next: 1803315

Since: 07-03-07

Pronouns: they/them/????????

Since last post: 3 days
Last activity: 14 hours

Posted on 08-20-10 01:17:22 AM (last edited by Xkeeper at 08-19-10 10:17 PM) Link | Quote
Now to dump this in the main forums and see how it goes.

____________________
Miasmir
Member

Level: 50


Posts: 334/528
EXP: 891156
For next: 56161

Since: 07-26-07

From: Lavastone (don't tell the pirate orcs)

Since last post: 87 days
Last activity: 6 days

Posted on 08-20-10 06:13:41 AM Link | Quote
Super tired collision detection ramblings incoming. Haven't played the game or read the source. Probably making huge wrong assumptions. Trying to help anyway.

With a circle represented as a center (x,y) and a radius and a rectangle by four points (x,y) (this choice of representation for a rectangle seems reasonable because it generalizes to convex polygons for this collision detection case, if you've got some matrix-based shenanigans I don't know how I'd do this for that) there's a fairly simple way to determine collisions between circles and rectangles.

Basically, you want to find the closest point to the circle on the rectangle, and see if that point is within the radius of the circle. This closest point is either one of the vertices or a point on an edge; if it's a point on an edge then it's the image of the center when it's projected onto that edge.

So you check to see if any of the vertices is within the circle, and if not, then you take the closest edge (the edge with the two closest vertices as endpoints) and project the center onto that line. If the projection is not between the two closest vertices, there is no collision. In all other cases there is a collision.

Between two rectangles of arbitrary orientation, edge vs edge collisions are uncommon and you may even want to ignore them because it makes things easier and instead check only vertex/edge collisions. There is a vertex/edge collision if and only if at least one vertex is inside the other rectangle. It could be best to apply a coordinate transform so that one rectangle is at 0° and then use your existing bounds check function on each of the vertices of the other. The general convex polygon case generally requires you to identify the edges closest to the center of the other polygon and find the intersection of those edges, then check if that intersection actually lies on both polygons.

The case you mention with two rectangles crossing and no vertex inside another rectangle happens more or less depending on the speeds and shapes of the rectangles. If it's an issue then the line intersection method is more appropriate than bounds checking on each vertex. Heck, just use that anyway, it's not like performance intensive nonsense is likely to be a concern.

if performance intensive nonsense becomes a concern, look into some of the methods that rely on data from previous frames to save calculation time. That's typically how it's done for crazy 3D simulations for science. In that case I'd actually advise you to start with Wikipedia's page on collision detection; it goes into surprising detail on a few of these issues.
Darkdata
Ruins!? ♥
Level: 103


Posts: 1672/2892
EXP: 11446674
For next: 24732

Since: 07-04-07


Since last post: 203 days
Last activity: 11 days

Posted on 08-20-10 07:29:01 AM Link | Quote
Press 4/5 for new weapons!
4: Stardust-Shooter - Shoots a large laggy circle around your ship, or a fast small circle.
5: ??? never gave it a real name, Ringtoss? Shoots a ring weapon from your ship, slowbig, fastsmall again.

____________________
4123
   
Sails
2800
as a video game‎‎‎‏‏‎ grows old its content and‏‏‎ internal logic‏‏‎ deteriorateÿ
Level: 102


Posts: 2377/2803
EXP: 10922943
For next: 167024

Since: 07-04-07

Pronouns: He/Him
From: MA

Since last post: 120 days
Last activity: 29 days

Posted on 08-20-10 05:09:32 PM Link | Quote
I made the ship graphics you all lose

____________________
Xkeeper

Level: 263


Posts: 17485/25353
EXP: 297157138
For next: 1803315

Since: 07-03-07

Pronouns: they/them/????????

Since last post: 3 days
Last activity: 14 hours

Posted on 08-21-10 07:44:55 AM Link | Quote
Hmm, that's actually really interesting. I'll look into it more; I'd already overlooked the obvious ability to skimp on a check if (object1r + object2r) > dist (which is just a simple square root issue) ...

Hopefully I'll get to work on this more later.

____________________
plushifoxed

King Yoshi
la chica dijo...

Mood: The current mood of roxiemika at www.imood.com
Level: 119


Posts: 3371/3990
EXP: 18466834
For next: 462457

Since: 08-22-07

Pronouns: it/its or she/her
From: kamihama city

Since last post: 2 days
Last activity: 1 day

Posted on 08-22-10 06:22:53 AM Link | Quote
:33 < supakitsune
If you're pointing directly at the center of the ship, bullets don't appear when fired.

____________________



~ ~ ~
follow me...
Sukasa

Level: 123


Posts: 2655/4326
EXP: 20936842
For next: 294424

Since: 07-07-07


Since last post: 1.1 years
Last activity: 1.1 years

Posted on 08-22-10 05:54:13 PM Link | Quote

Solution: Don't try to divide by 0

Better Solution: Aim

____________________
* hydrapheetz puts on the kittydunce hat
Tina
Beep boop
Level: 79


Posts: 1451/1549
EXP: 4471849
For next: 107618

Since: 08-10-07


Since last post: 3.4 years
Last activity: 3.4 years

Posted on 08-23-10 02:27:04 AM Link | Quote
Originally posted by Supakitsune
If you're pointing directly at the center of the ship, bullets don't appear when fired.

In future versions doing something that retarded will be treated like a self-destruct command.

____________________
Next newer thread | Next older thread
Jul - Craziness Domain - another thing New poll - New thread - New reply


Rusted Logic

Acmlmboard - commit 47be4dc [2021-08-23]
©2000-2022 Acmlm, Xkeeper, Kaito Sinclaire, et al.

30 database queries.
Query execution time: 0.079936 seconds
Script execution time: 0.027830 seconds
Total render time: 0.107766 seconds