DrMeowEyes

Member

13

1 Neutral

• Rank
Member

Personal Information

• Role
Game Designer
• Interests
Programming

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

2. Using Lerp For Camera Movement Smoothing. Help!?

I figured it out! I just had to make a slight change from this... position.x = position.x + (player.x - position.x) * lerp * time; position.y = position.y + (player.y - position.y) * lerp * time; to this... position.x = position.x + (player.x - (position.x + GetScreenSize().x/2)) * lerp * time; position.y = position.y + (player.y - (position.y + GetScreenSize().y/2)) * lerp * time;
3. Using Lerp For Camera Movement Smoothing. Help!?

Hello Everyone of the Angelscript Forum, I am back with yet another weird situation. I am sure you guys know the answer to this one. I am baffled right now. 😀 So, I am trying to get a camera in a 2D game follow the player with smooth movement. I got the camera following with smooth movement part working, but the problem I have now is that the player character is at the top left corner of the screen. I cannot seem to get the camera to center the player to the screen. I am not sure what to do. The camera smoothing part is working! How do I get the camera to be over the player character so he is near the center of the screen? Here is my code: float time = UnitsPerSecond(10.0f); float lerp = 0.1f; vector2 position = GetCameraPos(); <- I think this is a problem because to center the camera on player, I would need this to say "vector2 position = PlayerPos - ScreenSize / 2". But if I use that code with PlayerPos - ScreenSize/2 the camera becomes jittery, but I dont understand why that happens? position.x = position.x + (player.x - position.x) * lerp * time; position.y = position.y + (player.y - position.y) * lerp * time; print(position.x); SetCameraPos(position); Anyone have an idea on what im doing wrong here? Thank you, DrMeowEyes
4. Angelscript Shaders? Post Processing Effects Help!

Hi MrFloat, I am a bit lost, I admit! I am using an obscure game engine called, "Ethanon". It is a 2D dynamic lighting system with box 2d physics. I was trying to augment the lighting system by looking into writing some shaders for special lighting effects etc. I just don't know where to begin on how to create a shader. I wanted to start relatively simple by just creating a shader that could blur a portion of the game screen, for example. Does anyone have experience with how to write a shader and use Angelscript together somehow? Do people use GLSL? C++? Any hints would be great. Thank you, DrMeowEyes
5. Angelscript Shaders? Post Processing Effects Help!

Hello again! This is DrMeowEyes. I am currently writing a 2D top down game using Angelscript. I am new to Angelscript and wondered if there is a way to post process the screen. I can't find documentation on how to apply a shader to a real time scene using Angelscript. A simple example would be to blur the scene or create a basic lighting system to create soft shadows for objects. Does anyone have some information they can point me to on how to go about creating shaders for post processing affects using Angelscript? Or is there a different way of doing it not using Angelscript? The game is written in Angelscript so I assume I have to use Angelscript to create the shaders. Perhaps not? Thank you, DrMeowEyes
6. Steering Behaviors written for Angelscript?

Hello DekuTree64, I tested the sqrt(x*x + y*y) against my "length" function and the results are the same. The result is the number of pixels between the enemy position and the target position. Which can be several hundred pixels at any given time. In line 4, T = 200 to 500 pixels and this is multiplied by velocity(1.5) and then added to Target Position to get FuturePosition. The final result doesn't seem to make any sense. I'm supposed to add it to the "steering" variable. I tried adding it to the steering but the velocity goes way too high. There must be something wring with the equation. Not sure what it is. The units are pixels per frame like you mentioned. Frame rate is around 60FPS. Thanks, DrMeowEyes
7. Steering Behaviors written for Angelscript?

Hello WitchLord, I am using an obscure game engine called, "Ethanon". A 2D game engine that works best with top down and side platform type games. I have been struggling to convert the linear Algebra seen in various steering behaviors using Angelscript and Ethanon. I think I need a crash course in math again. So far, I have gotten A*, Seek, Flee and Arrive to work successfully. However, my attempts at Wander, Pursue and character turning have failed as I cannot seem to supply the correct math those routines are looking for. For example, here is the pseudo code for Pursuit from a well known site on steering behaviors: public function pursuit(t :Boid) :Vector3D { 2. var distance :Vector3D = t.position - position; 3. var T :int = distance.length / MAX_VELOCITY; 4. futurePosition :Vector3D = t.position + t.velocity * T; 5. return seek(futurePosition); } I admit, i'm no math wiz. LOL! Can you decipher what this code actually means? I put in line numbers for convenience. Here is my 2 cents at a conversion of this code. Tell me where I go wrong. Line 2 says...Distance vector = current position - target position. <-- Both are vector2 Line 3 says...Int T = Length of distance vector / max velocity. <-- I have a command "Length" for vector2's, but I'm not sure it is actually calculating right because T ends up being a really large number. I am using pixels for the target and current position. Line 4 says...FuturePosition = target position + target velocity * T. <--- T ends up being like 500, which makes no sense. I thought A* was challenging to code till I started working on the steering behaviors. I would be curious about your mathematical interpretation of the above code. Thank you!
8. Steering Behaviors written for Angelscript?

Thanks DekuTree64. I assume the code above is for "Limit"? I am not that familiar with C/++ mathematical commands. Do you know what the equivalent manual code would be for SetMag?
9. Steering Behaviors written for Angelscript?

What is the equivalent of the mathematical commands "SetMag" and "Limit" from C to Angelscript? Those commands are in the examples you posted above. Angelscript doesn't have those commands. DrMeowEyes
10. Steering Behaviors written for Angelscript?

Hello All, I am new to Angelscript and I am wanting to create steering behaviors for enemy AI. I haven't found any Angelscript examples on the web for Seek, Flee, Follow, Arrive, Collision avoidance, etc so far. I have successfully written an A* routine, but that's about it. Does anyone know of any steering behaviors written in Angelscript ? Can you post a link? Since I wasn't able to find any steering behaviors written in Angelscript, I decided to try to convert a "Flee" behavior written in C. Unfortunately there is a command I can't seem to find in Angelscript that the C code uses. Specifically, the "Limit" command. I think it is equivalent to a "SCALAR" command? I am not sure. Anyone know? Thanks in advance for any help. This is the code for the "Flee" behavior below: class Vehicle { PVector location; PVector velocity; PVector acceleration; Additional variable for size float r; float maxforce; float maxspeed; Vehicle(float x, float y) { acceleration = new PVector(0,0); velocity = new PVector(0,0); location = new PVector(x,y); r = 3.0; Arbitrary values for maxspeed and force; try varying these! maxspeed = 4; maxforce = 0.1; } Our standard “Euler integration” motion model void update() { velocity.add(acceleration); velocity.limit(maxspeed); <<<------------ THIS LINE USES THE COMMAND "LIMIT" location.add(velocity); acceleration.mult(0); } Newton’s second law; we could divide by mass if we wanted. void applyForce(PVector force) { acceleration.add(force); } Our seek steering force algorithm void seek(PVector target) { PVector desired = PVector.sub(target,location); desired.normalize(); desired.mult(maxspeed); PVector steer = PVector.sub(desired,velocity); steer.limit(maxforce); applyForce(steer); } void display() { Vehicle is a triangle pointing in the direction of velocity; since it is drawn pointing up, we rotate it an additional 90 degrees. float theta = velocity.heading() + PI/2; fill(175); stroke(0); pushMatrix(); translate(location.x,location.y); rotate(theta); beginShape(); vertex(0, -r*2); vertex(-r, r*2); vertex(r, r*2); endShape(CLOSE); popMatrix(); }