Previous Blog Next Blog
Prev/Next Blog
by date

The constant tweak of an RPG

The constant tweak of an RPG
Name:Greg Tedder 
Date Posted:Sep 14, 2008
Rating:4.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Greg Tedder

Blog post
I have been so busy I didn't notice May was my last post here. But before I start rambling about that I had better move on. Anyway, I have been somewhat level building while tweaking several elements of the RPG I am making in TGB. I am in a hurry to get this project done, but I have trouble just letting things go. My biggest nagging concern for the last month has been wall clearance and visibility in dungeons and houses. I tried a really quick distance based fading approach, but it just never felt right and looked sloppy. I finally decided to implement a method of checking the characters wall-side and changing frames to a chopped down wall frame that allows full visibility of the room. I am very pleased with the results and really need to get this code ported over to a slower machine to check the performance hit. On my macbook the performance hit is almost unnoticeable.



If anyone is interested, here is the wall-side check for TGB with y positive to the bottom of the screen. I simply check the angle from the walls sort point to the players sort point, see if it is greater than the upward angle and less than the downward angle of the wall. Since it is a fixed isometric perspective the wall angles are always the same.


        // Get an angle from wall sort point to player sort point
%pos1 = $player.getWorldPoint(($player.getSortPointX()), ($player.getSortPointY()));
%pos2 = %this.getWorldPoint((%this.getSortPointX()), (%this.getSortPointY()));
%vec = t2dVectorSub(%pos2, %pos1);

// get the angle between both positions
%angle = -mRadToDeg(mATan(getWord(%vec,0),getWord(%vec,1)));

//error(%angle);
%frame = %this.getFrame();

if(%frame == 0 || %frame == 2) {
if(%angle > 63.435 || %angle < -116.565) { // full wall
%this.setFrame(0);
} else {
%this.setFrame(2);
}
} else if(%frame == 1 || %frame == 3) { // shrunken
if(%angle > 116.565 || %angle < -63.435) {
%this.setFrame(1);
} else {
%this.setFrame(3);
}
} else if(%frame == 4) { // door
if(%angle > 63.435 || %angle < -116.565) { // full wall
%this.setBlendColor(%this.savedBlendColor SPC "1");
} else {
%this.setBlendColor(%this.savedBlendColor SPC "0.5");
}
} else if(%frame == 5) { // door
if(%angle > 116.565 || %angle < -63.435) {
%this.setBlendColor(%this.savedBlendColor SPC "1");
} else {
%this.setBlendColor(%this.savedBlendColor SPC "0.5");
}
}


As evident I also added some lighting. I did absolutely no programming on lighting, it is all artwork and blending effects available in the scene editor. Every now and then TGB and I duke it out on an issue, but the results always prove to be worth it. I am currently trying to keep myself talked out of trying shadows and "REAL" lighting and effects as I would really like to complete this project before next summer.

Recent Blog Posts
List:09/14/08 - The constant tweak of an RPG
05/25/08 - Flat Tile to Isometric
03/04/08 - Will Macintosh Intel Graphics Work for TGB
03/02/08 - Aeges Road Alpha Testing
12/31/07 - A Thought on Saving the Game
11/04/07 - As it is with Aeges Road
08/26/07 - Aeges Road, The Time Draweth Nigh
07/23/07 - Finding My Way Around

Submit ResourceSubmit your own resources!

You must be a member and be logged in to either append comments or rate this resource.