View Full Version : My Final Project: and FPS
Ch0pStickS
01-28-2008, 06:50 PM
Go to my latest post to see complete version.
danica
02-09-2008, 02:04 PM
hi, thx for posting your work here.
but the project is so complicated that i cant even understand how you did.
would it be possible for you to post only the camera control part, as its the most important part for a bunch of ALICE user, as i understood.
thx again.
ps: a few explanations would be great too.
Ch0pStickS
02-11-2008, 07:49 PM
alright, turns out i put a half done copy in there, so actually half of it isn't implemented, but the controls are mouse to llok, wasd to move, and 1,2,3 to go to a certain weapon.
Here is a simplified version using only the camera, and movement.
W- move forward
A- move left
S- move backward
D- move right
hold enter and click on the crossfire to calibrate screen.
Look by using the mouse.
To permanently save calibration to your screen setup, go to world properties, and run the world so that you can see both variables, calibrate left and calibrate top.
Calibrate in world, memorize the numbers that pop up, end the world, input the numbers into the reverted calibrate left and top, save the world.
Also in world properties is Sensitivity. Choose 1-10 and by increasing sensitivity, the mouse looks faster.
Calibration just measures if you are pressing enter or not.
danica
02-12-2008, 12:04 PM
thank you, i try it immediately .
Ch0pStickS
02-28-2008, 05:35 PM
any thoughts of it?
lanceA
02-28-2008, 08:41 PM
I'm not into violence so I haven't downloaded it. However I do believe that one of the subscribers made a valid comment when he said he could not understand your code.
Regardless of the project, you should always include comments in your code so that others might understand what your are doing.
Good luck with your continued programming.
Ch0pStickS
02-29-2008, 12:49 PM
no not the game im talking about, the MCD thats a attatchment in one of my previous posts. It's supposed to be a plain demo of how it works without any game. so theres no violence, just a screen that moves with your mouse and WASD keys
DrJim
03-01-2008, 10:04 AM
Actually Lance A would probably like the game if he downloaded it, since it seems impossible to actually hit anything, no matter how much violence you try to use. :)
But I would certainly echo his point about the importance of comments in your code, even if you don’t plan on ever giving the code to anyone else. First, the comments give you a framework to organize the code, and second, the probablility of you remembering what all of the actual, fairly abstract programming details meant a few weeks after the code was written is not too high.
For example, you comment that you can permanently enter the calibration for the center of the screen. Unless you have figured out how to freeze the size of the play window (which I can’t find in the code), this simply isn’t true. I suspect you found this out during development - but either that fact never regisitered explicitly (you undoubtedly had a lot else on your mind) or then, with the more stable code, the fact slipped your mind.
I am not being critical – you said you were pressed for time on this project and it is a very nice piece of code. It’s actually the first time I’ve seen code that was able to relate key and cursor controlled actions to specific points in an Alice world – something both others and myself have tried without your success.
Code that doesn’t work is not worth documenting – and usually if the code works and fills enough of a need, someone will come along and complete the documentation. It has been my experience however, that the easier the latter task is, (i.e., the better internal documentation there is in the code) the better the final result turns out to be.
Ch0pStickS
03-02-2008, 05:15 PM
well for the little thing about freezing the calibration point to a certain degree, i just thought that if you run alice on the same computer, the screen always loads to the same exact position and size, but that's just what ive seen through my version of alice, (windows vista). Alright so here's how i did it, and it's not really a lengthy and complicated code. It uses alot of the world functions, mouse distance from top edge, and mouse distance from left edge. I made a certain box where it wouldnt move if it was in it, because it would be annoying to have to enter the mouse exactly in the center to stop the screen from moving. So i just did If (mouse distance from ___ edge is > than the calibrate left" (which is technically the mouse distance form left edge if the mouse is in the center) minus 15) then you can move the screen. So that technically makes a box where the screen doesn't move instead of a single center point. So now that it wont move in the center, we have to make it move out of the center. To do that i just made it so that the x-axis (which is actually just a sphere that i tried to make as close to the center of the screen as possible, which is invisible) will turn left at speed = calibrate left minus mouse distance from left edge so for example, when you calibrate it, then the calibrate left is the same as the mouse distance from left edge when the mouse is in the center. So calibrate left minues mouse distance from left edge is 0 when the mouse is in the center, so it wouldnt move at all. but if it is at the edge, then calibrate left minus distance from left edge would be calibrate left.. So you would turn left at speed calibrate left. But if you turned that fast it would be crazy... so, i minimized it by. making a sensitivity variable. So that number, would be divided by 11 - sensitivty and multiplied by 400 so it would divide it by that AND 400. I found 400 with guess and check. So if you set sensitivity to 10 it would not divide it at all besides 400, and if it was 1, it would divide it by 10*400 so the greater the sensitivity the faster you would turn. Same thing with the up and down, but instead of x axis, it is the camera, instead of calibrate left, it is calibrate top, and instead of mouse distance from left edge, i made it mouse distance from top edge. I made these methods do together and also had it loop infinitely. So to sum it all up it is, turn "this speed" per second for .05 of a second.
y-axis vehicled to camera which is vehicled to x-axis.
Also, for the movement part, i just made the wasd keys made the x-axis move forward backward, left or right depending on which key you press.
For Calibrate I made it so that when enter is pressed, it changes "calibrate" to true, and when it is let go it changes "calibrate" to false, so it technically measure when enter is pressed. Then i made it so if mouse is pressed on y-axis/cursor, then if calibrate is true, it will set calibrate left to mouse distance form left edge, and set calibrate top to mouse distance from top edge.
The whole aiming part can be found in world method, Aim
Movment can be found in world events
Calibrate can be found in world events/ world method, Calibrate
if there are any further questions, let me know
Ch0pStickS
03-02-2008, 05:19 PM
what do you mean by documenting code?
DrJim
03-02-2008, 08:22 PM
what do you mean by documenting code?
You just did it in your previous e-mail. Just make that a comment and stick it in the code. Don't worry about grammer, etc. - you're doing programming, not writing an English theme. But things like which sreen edge each measurement is referenced to are those you can forget very quickly.
Also re "you run alice on the same computer, the screen always loads to the same exact position". What it actually does is run with the same window size and screen (and camera) postion as you used the last time. You can actually make the camera always start at the same spot by having it move to a fixed position as the first step but I don't know a way to do the same thing with the viewing window. Anyone else have any ideas? :confused:
Ch0pStickS
03-02-2008, 09:08 PM
it doesn't matter, it doesn't need to start in the same position on the screen. It will still stay calibrated so u don't have to press enter and click the dot everytime you load it.
ShaunHBGAcad
04-04-2008, 09:40 AM
Wow, the mouse control is impressive. If you don't mind, I'll be scrapping my mouselook code for yours. I didn't know some of those functions were even there. Excellent!
crick_head
08-12-2008, 06:32 AM
thanks man, i haven't tried it yet, but i need a bit of help on a fps so hopefully it'll help
Ch0pStickS
12-02-2008, 07:32 PM
I have a new mouse-control code here:
http://www.alice.org/community/showthread.php?t=1931
Ch0pStickS
05-02-2009, 10:26 AM
Yeah, so umm i posted earlier a version of the game, which i found was the incomplete version.
Doing some spring cleaning, i found an old flash drive, and it somehow has my final version on it o.o
Anyway here it is
Controls:
WASD - used to move around
Mouse - used to look around
Q- used to switch from single fire to automatic for the pistol
r - used to reload
spacebar - used to scope or aim downsight.
1 - pistol
2- rocket launcher
3- knife
4- raygun
Notes:
You start out without any weapons, so you cannot do anything until you come into the room with the robot. (cutscene until that point)
to beat the big bad robot:
he shoots things out of his head, shoot with the pistol to destroy it. Also, every 21 seconds, he shoots a one hit-kill burst. AFter 15 seconds, you will see him charging it (right arm) so to reset the timer, shoot a rocket at his arm. To actually beat him, you must first shoot the bars surrounding his core (being closer might help) then pull out your raygun and shoot his core once the bars are gone.
This is likely to be the most glitchy game ever created in alice, so be afraid, be very afraid.
GOD MODE: if you're getting tired of losing, try turning on god mode. It prevents you from dying. just go to world>properties and change the god mode boolean variable to true.
HisWorld
05-07-2009, 08:30 PM
Nice work! From the little I've messed around with using the mouse to aim and direct objects. I can tell its not as straightforwards as it could be.
jediaction
11-23-2009, 12:01 PM
YOU JSUT FIXED MY BIGGEST FPS PROBLEM!!!!!!!! THANK YOU THANK YOU...I am going to finish my Modern WArfare Game