Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Author Message
morgoth

Posted: Sat Nov 22, 2003 7:14 pm   Post subject: adaptable wall detection

So far the only method that I know of for wall detection was using

 code: if x>maxx then x:=x end if

I was trying to experiment with whatdotcolor and such but it is a bit too cumbersome. can someone help me create a wall detector that is adaptable to all diffect shapes (so if I change the shape of the room it will still detect if a wall is there.) thanks

AsianSensation

Posted: Sat Nov 22, 2003 8:20 pm   Post subject: (No subject)

waits patiently for dodge to explain all the merits of whatdotcolor...
.
.
.
.
.
.
ok, nvm, he didn't show up, oh well, I'll explain it.

using edge detection with irregular shapes could be very hard, so therefore, we use wahtdotcolor, it's one of the best way turing could handle these kind of situations.

whatdotcolor would work under simple conditions, where there are like 3 different colors or something, but it will make your program as slow as hell.

if the edge you are trying to detect isn't so irregular, meaning that there exist some kind of equation for that shape, then you can use math for edge detection in that situation.
Tony

Posted: Sat Nov 22, 2003 8:57 pm   Post subject: (No subject)

seeing as you want edge detection for rooms, I assume you're writing a game of sords. The best way to go would be to create a 2D array holding positions of walls, and basically use tileset aproach towards movement.

in other words, before your character makes the move from one tile to the next, it first checks if that spot allows movement - such as it is not a wall.

When moving from a room to room, you just reload your map array with new values of walls, other objects and what not.
Tony's programming blog. DWITE - a programming contest.
morgoth

Posted: Sun Nov 23, 2003 9:25 am   Post subject: (No subject)

hmm.. that is a good idea, and I understand the concept but how exactly would you make it work for example can you create this wall detection idea on this box
 code: drawfillbox (1,1,300,300,black)
Dan

Posted: Sun Nov 23, 2003 2:10 pm   Post subject: (No subject)

well we got info on noraml closion dection here:

http://www.compsci.ca/v2/viewtopic.php?t=75

for whatdotcolor it whould be somting like this:

if whatdotcolor(x,y) = black then
code for what to do when hit wall
end if

where x and y is the loaction of the object that could hit the wall

NOTE: where "black" is you may have to replace with the num eqelivent of the color.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Andy

Posted: Sun Nov 23, 2003 3:25 pm   Post subject: (No subject)

HEY! juss cuz i took a day off, you guys stealing my job of teaching the secrete arts of whatdotcolor? azn ur dead... lol
ok, if u want to edge detection, use only one color for each type of object, then mask a good picture over that with ur desired patterns, so when you're checking collision detection, check on the simple one, then apply the change to both pictures, and voila! the smrter way to detect collision
Tony

Posted: Sun Nov 23, 2003 6:07 pm   Post subject: (No subject)

exsept that it would suck to have the screen flicker with weird colors each time you check for collision.

You're better off drawing your simple template onto a vertual buffer - create array 1..maxx, 1..maxy and draw your pixels onto it. This way you check color values (which represent different objects) in an array rether then visualizing the same values onto the screen.
Tony's programming blog. DWITE - a programming contest.
Andy

Posted: Sun Nov 23, 2003 6:51 pm   Post subject: (No subject)

no.. it wouldnt flicker, offscreenonly man, draw it on the offscreen, check it, and clear the offscreen, and make it nooffscreenonly

thoughtful

Posted: Sun Nov 23, 2003 6:57 pm   Post subject: (No subject)

i dont know but i think dodge way might even be faster than yours tony, because writing to an array of maxx * maxy takes some time, where as whatdotcolor rocks!
Andy

Posted: Sun Nov 23, 2003 6:58 pm   Post subject: (No subject)

you've learned well my young padawan... pss, use it on the ccc jr 5 sr 3
Tony

Posted: Sun Nov 23, 2003 6:59 pm   Post subject: (No subject)

heh. Why dont you try it out?

time it takes for whatdotcolor * number of times executed in game vs. how long it takes to load the 2D array with map info.
Tony's programming blog. DWITE - a programming contest.
thoughtful

Posted: Sun Nov 23, 2003 7:04 pm   Post subject: (No subject)

Oh you meant to load it jus at the start or after every move?
becuase you were talking about the flickering last time i thought you meant loading it every time the program executes. Loading it just one time wouldn't take that long, but in faster games, where one needs collision detection of irregular objects very often whatdotcolor will be better
Andy

Posted: Sun Nov 23, 2003 7:07 pm   Post subject: (No subject)

efficency is for losers... in a couple of years, we're all gonna be running turing on comps with clock speeds of a cople of yodahertz, so why learn the efficent way? learn the fun way!
thoughtful

Posted: Sun Nov 23, 2003 7:14 pm   Post subject: (No subject)

True bro, i mean when i did some of those font effects, also they were slow but after that i just love what dot color and i go to trouble just trying to invlolve it in all my programs some how . It is the only fun thing to use in turing for me so far . I wish i find some more soon though
AsianSensation

Posted: Sun Nov 23, 2003 7:27 pm   Post subject: (No subject)

dodge you drug dealer! getting innocent people hooked onto that whatdotcolor stuff, shame on you!

next thing you know, compsci would be banning the use of whatdotcolor, but then again, like marijuanna, we are going to legalize it in the end anyways.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 2  [ 17 Posts ]
Goto page 1, 2  Next
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: