Computer Science Canada

RPG Walls..Collison Detection?

Author:  .hack [ Thu Apr 22, 2004 8:31 am ]
Post subject:  RPG Walls..Collison Detection?

I'm making an RPG for ym school project..not a text based RPG, but an actual GUI RPG (like Final Fantasy 2, FF3, Chronot Trigger etc). I need some way of mapping (Photoshopto build the map) but I need it so that the character CANNOT move thru walls.

How should I do this. I thought of a background fill where u acn't walk on it, but it would engulf the entire map. Suggestions are most appreciated.


Author:  Flashkicks [ Thu Apr 22, 2004 8:38 am ]
Post subject: 

The only ways I know of detecting for walls is using whatdotcolor commands; but I dont know if that is wut you are particularily looking for with your proggy Confused [by whatdotcolor I mean checking for Colors that lie InFront of you...]

Author:  .hack [ Thu Apr 22, 2004 8:43 am ]
Post subject: 

yea I was thinking about whatdotcolor, but it wouldn't work seem how that wall colors would be the same.. I couldn't use black as an out line for the wall, cause black is too commonly used.

I was htinking of drawing a "frame" around my map using tring commands, then makig them completely opaque, and using an obscure cure liek Magent, at 0% Opactity so its invisible. Would turing still beable to detect the dot color as Magenta even thos its invisible?

Author:  Flashkicks [ Thu Apr 22, 2004 8:47 am ]
Post subject: 

If Turing is as good as I KNOW IT IS[lol] it definately should.. if not- then maybe Tony could help you- he even has a whole Lesson on it.. Maybe you should read that- id put the link to it here but class is done and i g2g Shocked

Author:  Delta [ Thu Apr 22, 2004 9:23 am ]
Post subject: 

ya... ummm... as far as I know... and this help file I have here... it doesn't even allow you to make images transparent... but maybe this version is just out of date. But ya... I say with walls... have a completely coloured area outside of the map... all black or something... I'm not sure if you understand because I'm horrible at explaining things... but ya... if you private message me I'll send you a picture of what I mean... or you could (more lines of code but just as effective) use if statements...

if playerX < 100 then
playerX += 10
end if

Hopefully that helped :S

Author:  Flashkicks [ Thu Apr 22, 2004 9:33 am ]
Post subject: 

Shocked Thats a lot of If's Shocked ....

Author:  Andy [ Fri Apr 23, 2004 10:15 am ]
Post subject: 

what you could do is draw the walls in some weird color then mask it ovr with your real wall, then when u check for collision detection, use whatdotcolor on the monocolored walls, by drawing that in the offscreen, then pasting ovr ur real walls and then View.Updated. ofcourse you'll have to set the screen to offscreenonly by View.Set("offscreenonly")

Author:  AsianSensation [ Fri Apr 23, 2004 11:06 am ]
Post subject: 

OR, instead of using whatdotcolor, you could have a textfile like this:


where 0 is spaces you could pass through, and 1s are the spaces you can't.

The benefit of this is that it's better then whatdotcolor in terms of speed and efficiency. And it would always give you the correct detection, assuming you scaled it right. Where as whatdotcolor is not that accurate if you have colors that are very close to each other.

The bad part of this is that you have to make a customize txt file for each one of your map that you plan on using. So if you have alot of maps, it's alot of work.

Author:  zylum [ Fri Apr 23, 2004 1:09 pm ]
Post subject: 

im pretty sure most rpgs are made with tile based worlds so you may want to look into that... basically you have an imaginary grid with your picture ontop of it... and as asiansensation said have a text file for where the user can or cant go or just assign each type of tile a different number

eg: 0 for normal ground
1 for wall
2 for higher ground
3 for slope that leads to higher ground
4 water (cant go through)
5 for marsh and character walk/run speed slows down


and each grid size would be as big as the thickness of your walls or w/e

here's a simple example that just has walls... choose random as map type unless you want to make one yourself:

(check the last post on the first page)


Author:  Dan [ Fri Apr 23, 2004 1:31 pm ]
Post subject: 

i worte somting up about this awhile ago but where Thinking

any how title system whould deftely be the best way to do things.

Edit: i just looked for it and it is at the bottom of this turorial:

it is a good read for poleop making rpgs

Author:  .hack [ Tue Apr 27, 2004 6:17 am ]
Post subject: 

Alrighty Gus and Girls, thanks for all the help. I'm convinced that a tile method would be the easiest.

After I'm done the mapping its pretty much smooth sailing, jus writing up procedures etc.

Author:  .hack [ Tue Apr 27, 2004 11:16 am ]
Post subject: 

ALrigty, I'm only making a short demo,a s this is my final project, so I'm making arrays for Monster types, then labelling them as part of an array, then commetning above their name etc, you'll see. ANyways for some reason Monster (1).charHP := 9 gives me an Assigned Value Wrong Type error. And I'm not sure why, it worked in the first Monster Array Cell, and the Player record, just now it breaks. Check out the code.

type VarList :
charName : string
charStr : int
charHP : int
charMP : int
%(about 50 more variables listed Underneath, just not spamming the post with them)

end record

var Monster : array 1..50 of VarList
var Boss : array 1..50 of VarList
var Overlord : array 1..50 of VarList

%Monster 1 = Hell Rabbit
%Monsters Stats,Some Are Calculated During Battle Procedures
Monster (1).charAP := 5 %<<--Line is fine
Monster (1).charHP := 10 %<--Line Is fine? Same variable as below.
Monster (1).charStr := 2
Monster (1).charDef := 2
Monster (1).charEvaMod := 0
Monster (1).charEva := 5
Monster (1).charStkRate := 0
Monster (1).charEvaRate := 0
Monster (1).charMagDef := 5
Monster (1).charStk := 30
Monster (1).charLuck := 5
Monster (1).Spec1 := %+20% Str(temp)For Enemy

%Monster 2 = Avion
%Monsters Stats,Some Are Calculated During Battle Procedures
Monster (2).charHP := 9 %<---Error Line (charHp is highlighted Black)
Monster (2).charAP := 5
Monster (2).charStr := 3
Monster (2).charDef := 1
Monster (2).charEva := 6
Monster (2).charEvaMod := 0
Monster (2).charStkRate := 0
Monster (2).charStk := 28
Monster (2).charMagDef := 5
Monster (2).charLuck := 5
Monster (2).charEvaRate := 0
Monster (2).Spec1 := %Stk - 2(Temporary)

%Boss 1 = Assasin
%Monsters Stats,Some Are Calculated During Battle Procedures
Boss (1).charHP := 30 %<<<-----Error Line(charHP his highlighted black)
Boss (1).charAP := 10
Boss (1).charStr := 4 + 2 %Katana
Boss (1).charDef := 3 + 1 %Leather Armor
Boss (1).charEva := 8
Boss (1).charEvaMod := 0
Boss (1).charEvaRate := 0
Boss (1).charStkRate := 0
Boss (1).charMagDef := 9
Boss (1).charStk := 38
Boss (1).charLuck := 7
Boss (1).Spec1 := "3" %100%escape, used when near death
Boss (1).Spec2 := "4" %Eva - 1(Temporary)

Any Help is appreciated, Not sure why, it works in the the Player stats I made, the 1st Monster Array but not the Monster (2) or Boss (1).


ps(I hit 500 lines, wheeee)

Author:  Delta [ Tue Apr 27, 2004 4:43 pm ]
Post subject: 

this is your problem.... these two lines don't have values

Monster (1).Spec1 := %+20% Str(temp)For Enemy

Monster (2).Spec1 := %Stk - 2(Temporary)

Author:  .hack [ Wed Apr 28, 2004 8:37 am ]
Post subject: 

WOw, Delta, good job.

I can't believe I missed something that stupid >.<

Author:  doey55 [ Wed Apr 28, 2004 9:02 pm ]
Post subject: 

can u post ur whole program i would liek to check it out so far looking good man