Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 adaptable wall detection
Index -> Programming, Turing -> Turing Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
morgoth




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
AsianSensation




PostPosted: 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




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
morgoth




PostPosted: 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)
I learn more easily if I have a basic guide thanks Very Happy
Dan




PostPosted: 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




PostPosted: 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




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Andy




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
thoughtful




PostPosted: 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




PostPosted: 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




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
thoughtful




PostPosted: 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




PostPosted: 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




PostPosted: 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 Razz Razz . It is the only fun thing to use in turing for me so far Twisted Evil Twisted Evil . I wish i find some more soon though
AsianSensation




PostPosted: 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:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: