[Behavior] Grid based sight

Post your completed addons to share with the community

Post » Sun Oct 09, 2011 12:20 am

[QUOTE=Wastrel] Rez, that is really cool. I haven't played with it yet, so this may be obvious, but can the LightCell be any shape and color, or does it need to be a black square.

Also, please develop a game using DrunkGuy. I would play that game! :D

Seeing all of these new behaviors is really giving me the itch to start making my own plug-ins. I do know some JavaScript, although it's mostly been for one-off admin tasks at work. Did you find it easy to figure out?[/QUOTE]

Haha yeah the lightcell can be anything its just a way of showing a "seen" cell. The basics of javascript are easy I've come from C#/Python/LUA/GameMaker/a few other programming side of things. I'm not massively great at programming although I love it. The plugin system Ashley has designed is really good, just use the latest Firefox with the Firebug add-on. This will help alot. If you get stuck I create an alert, assert2 (as Ashley does) or even an expression so you can return a value you want to check out. When I design a plugin such as a "container" or inventory behavior I found I could use parts of the storage plugin to save the contents of the container/inventory. Can't wait for Families then I can make a fully functional item system...

Believe you me it does click eventually!

Anyway thanks for the feedback Wastrel.
B
21
S
7
G
2
Posts: 185
Reputation: 3,280

Post » Sun Oct 09, 2011 12:32 am

[QUOTE=Kyatric] I know the question is aimed at Rez, but I was a bit in the same situation. I didn't know much about JS (but I knew other languages: VB, notions of C/C++, PHP, Lua/python) and found JS quite straight forward to get into.

Especially in the goal of plugin developpement for C2, Ashley made an awesome SDK with links to JS guides and references and from there it was almost like "follow the guide".

In the end, I found it pretty easy and fun to developp plugin or behavior for C2 even if sometimes you will encounter your fair share of headaches, but that's what dev is about in my experience [/QUOTE]

Thanks for answering for me Kyatric, appreciate it!

On another subject I'm currently incorporating pathfinding into my behavior. You had any luck with a method of smooth movement? I can have it move easily with 'set position' but thats a bit crap looking. I've made it so you can find or move to the previous, current and next position in the path list by using a position counter which as a behavior works perfectly.

Finally, does anyone here play Dark Souls!?00Rez2011-10-09 00:32:58
B
21
S
7
G
2
Posts: 185
Reputation: 3,280

Post » Mon Oct 10, 2011 2:42 pm

Hey 00Rez. I've been playing with behaviour, but I can't quite get it to work. Could you have a look at where I could have been going wrong?

http://dl.dropbox.com/u/1378330/gridProblem.capx

The pertinent events are in the "Terrain" and "Player" event sheets I believe.
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Mon Oct 10, 2011 4:21 pm

I also have a problem Rez, no light is appearing at all!
My Problem
Changing the lightcell to XOR doesn't make a difference.bowiz22011-10-10 16:24:47
B
40
S
8
G
6
Posts: 61
Reputation: 5,941

Post » Mon Oct 10, 2011 7:17 pm

[QUOTE=bowiz2] I also have a problem Rez, no light is appearing at all!
My Problem
Changing the lightcell to XOR doesn't make a difference.[/QUOTE]

It seems you got x,x instead of x,y. I'll let you figure that one out and the shadow object effect needs to be set to "destination out."

One last thing if you select an object with the Sight behavior attached make sure you look at the properties on the left hand side because you set the tile size, the default is 32 pixels which means usually to keep all objects at no more than 32x32 pixels or whatever (just a recommendation). I noticed your dirt object is 16x16 which would probably look weird.00Rez2011-10-10 19:21:34
B
21
S
7
G
2
Posts: 185
Reputation: 3,280

Post » Mon Oct 10, 2011 7:28 pm

[QUOTE=cow_trix] Hey 00Rez. I've been playing with behaviour, but I can't quite get it to work. Could you have a look at where I could have been going wrong?

http://dl.dropbox.com/u/1378330/gridProblem.capx

The pertinent events are in the "Terrain" and "Player" event sheets I believe.[/QUOTE]

I'm getting a check failure when I try to open I'm using the latest [r61]
B
21
S
7
G
2
Posts: 185
Reputation: 3,280

Post » Mon Oct 10, 2011 9:28 pm

[QUOTE=00Rez] [QUOTE=cow_trix] Hey 00Rez. I've been playing with behaviour, but I can't quite get it to work. Could you have a look at where I could have been going wrong?

http://dl.dropbox.com/u/1378330/gridProblem.capx

The pertinent events are in the "Terrain" and "Player" event sheets I believe.[/QUOTE]

I'm getting a check failure when I try to open I'm using the latest [r61][/QUOTE]

Hey 00Rez. Reuploaded.
B
55
S
12
G
8
Posts: 339
Reputation: 9,314

Post » Mon Oct 10, 2011 9:59 pm

[QUOTE=cow_trix] [QUOTE=00Rez] [QUOTE=cow_trix] Hey 00Rez. I've been playing with behaviour, but I can't quite get it to work. Could you have a look at where I could have been going wrong?

http://dl.dropbox.com/u/1378330/gridProblem.capx

The pertinent events are in the "Terrain" and "Player" event sheets I believe.[/QUOTE]

I'm getting a check failure when I try to open I'm using the latest [r61][/QUOTE]

Hey 00Rez. Reuploaded.[/QUOTE]

Fixed to what you need (I think.) I've noticed a rounding problem my end which I'll have to fix. Anyways, when you have a for loop for the sight you *must* use the CurPixelX/Y or CurGridX/Y on both sides to pull and place the correct values! Hope this makes sense! Another thing is this is grid based therefore all objects must be in divisions/multiples of whatever the tilesize is which is 32 in your case. I noticed you had an offset of 300 which placed the generated tiles wrong. I set this to 320 and this fixed it. When you check sight and choose "in pixels" all this means is the plugin works out the grid position for you.

Hope this helps Cowtrix! Nice demo by the way!

Fixed version00Rez2011-10-10 22:03:52
B
21
S
7
G
2
Posts: 185
Reputation: 3,280

Post » Mon Oct 10, 2011 11:36 pm

Actually, in the actual program, the dirt is 32x32. About the destination out, in the demo project, its set to XOR. Your talking about the LightCell, right?
Anyways, I fixed what you told me to fix, and it still doesn't work...
Problem, Again
B
40
S
8
G
6
Posts: 61
Reputation: 5,941

Post » Tue Oct 11, 2011 9:04 am

[QUOTE=bowiz2] Actually, in the actual program, the dirt is 32x32. About the destination out, in the demo project, its set to XOR. Your talking about the LightCell, right?
Anyways, I fixed what you told me to fix, and it still doesn't work...
Problem, Again[/QUOTE]

Ok sorry about that must have been zoomed out or something. Anyway I forgot to mention you need to set the for loop to seen rather than hidden this will sort out the opacity issue. Using hidden is inverted, so the cells' opacity are full or invisible, which is why it shows nothing. Before changing anything Toggle disable the opacity setter and preview this will show the LightCells that are created so you will get a better idea of how it works! One last thing is due to the whole grid based approach it's best to have everything snapped to the grid of whatever tilesize you are using in your case 32 pixels. This can be set in the properties of the Sight behavior and set with the snap to feature in construct!

I hope this helps Bowiz 00Rez2011-10-11 09:05:00
B
21
S
7
G
2
Posts: 185
Reputation: 3,280

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 2 guests