Archived

This topic is now archived and is closed to further replies.

world of lines

This topic is 5309 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello, in creating a top-down 2D game, people usually use tiles. has anybody tried to create a top-down 2D game using lines for the world and objects? kind of like asteriods but the whole world. im waning to do so, and also having the ability for explosions to modify the world. (bomb would blow hole in wall - like the game worms.) in games like scorched earth and worms they seemed to use a pixel by pixel approach, but the memory requirement for such a system is too much for my large worlds i want. i think i could work out the physics for collision detection and blowing holes in walls in such a "line-made world". however, im interested in how to make it look well. would it work if we created a repeating pattern texture to draw inside the walls? how could we quickly draw this inside the walls - standard polygon drawing? the walls and borders in the game could have well over 50 sides(lines) that make up the overall polygon. and would it be too difficult to give it thick borders? - jeremiah inlovewithGod.com

Share this post


Link to post
Share on other sites
perhaps my first post was a bit confusing. basically im wanting to know any fast ways to draw non-convex and complex polygons with the possibility of drawing thick lines for the polygons edges.

ideas, suggestions, links?

- jeremiah

inlovewithGod.com

Share this post


Link to post
Share on other sites
I''m thinking that you mean "vector graphics". Yes, such a system can and has been done, but properly done it is a nice effect.

No, I can''t suggest anything, but I have helped others understand what you want...

Share this post


Link to post
Share on other sites
gdi/gdi+ can do polys for ya with different styled lines. i dont know about the speed though, wont be very fast. id say drop the lines and use dx/opengl and just draw polys.

Share this post


Link to post
Share on other sites
even if i drop the lines (polygon edges), does anybody have any links or search terms or anything on how to quickly draw non-convex and complex polygons?

- jeremiah

inlovewithGod.com

[edited by - keethrus on June 4, 2003 8:29:17 AM]

Share this post


Link to post
Share on other sites
changing a regular convex polygon drawing function into a concave more-than-3-sides polygon drawing function seems possible after searching the net. im also wanting polygons to be able to have "holes" in them. like a concave polygon would be a hole inside another concave polygon. has anybody ever attempted such a thing? if so, is it too slow for real-time gaming (2D top-down game)? any suggestions on going this route?

- jeremiah

inlovewithGod.com

Share this post


Link to post
Share on other sites
You don''t need to worry about concave polygons, or polys with holes if you define your polygons properly. Just make sure every polygon is a triangle, and create your shapes via groups of triangles.

If you plan on using only lines (ala asteroids original) you can forget all about scanline conversions and convex/concave polygons.

Just define your poly as a set of points in a specific order (clock wise or counter clock wise) and connect the points using your favorite line drawing algorithm.

Will

Share this post


Link to post
Share on other sites
quote:
Original post by RPGeezus
You don''t need to worry about concave polygons, or polys with holes if you define your polygons properly. Just make sure every polygon is a triangle, and create your shapes via groups of triangles.

If you plan on using only lines (ala asteroids original) you can forget all about scanline conversions and convex/concave polygons.

Just define your poly as a set of points in a specific order (clock wise or counter clock wise) and connect the points using your favorite line drawing algorithm.

Will


thanx for the response, but its not exactly what i need. i want to define the world using lines - concave polygons with possible concave polygon defined holes. i want more than just to draw the outline of the polygons though, so im going to need to draw some sort of texture inside and outside the polygons that comprise the world.

- jeremiah



inlovewithGod.com

Share this post


Link to post
Share on other sites
Might be overkill, but OpenGL can be used very easily just to draw lines. (in 2d or 3d)
And once you''re doing it in OpenGL, you''ve got free(well, very cheap) scaling/rotation/anti-aliasing.

Line width isn''t a problem (easy to set), but it''ll look much nicer if you have line anti-aliasing on.
And it has nice filled-polygons as well.

Anyway, just another option to consider.

Share this post


Link to post
Share on other sites
Ok,

Once again look for "polygon scan conversion"
It''s quite simple and holes are automatically handled with an even/odd scheema.

Basically, you use a scanline algorithm where every vertex of your polygons is an "event" point.
Sort the event points by increasing Y value.
Loop all you event points and keep an "active edge list".
Add edges to the list when their lowest point is the same as the eventpoint and remove them from the list when the top point is equal to the event point.
Now Between two of these event points you sort all the edges in your active edge list from left to right. Then you draw super fast horizontal lines between the first and second line and between the third and fourth line etc...

You should get "Computer Graphics, Principles and Practice" by Foley, van Dam.

Cheers,



Share this post


Link to post
Share on other sites