Alice Community  

Go Back   Alice Community > Alice 2 > Share Worlds

Reply
 
Thread Tools Display Modes
Great mouse aiming engine.
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Talking Great mouse aiming engine. - 03-08-2012, 05:41 PM

X asked me to make this, so I did .
I have made a very promising mouse aiming engine. I'm sure you will like it.

This one is a culmination of previous methods and new methods, to make an all-in-one super engine.
This one:
- Centres the cursor, this is much better than the silly method of capturing it every time it hits an edge.
- Automatically calibrates, so none of that clicking dots rubbish.
- Hides the cursor, so the unnecessary thing isn't whizzing across the screen distorting your view.
- Can be toggled on/off (the cursor can be unlocked/locked with F1 by default), so you don't have to use extreme measures to exit the game.
- Is quite smooth and doesn't jump, unlike some other engines.

Other features:
- Can make window non-resizable (necessary as calibration only happens once)
- Can make window stationary, so it cannot be moved (again necessary, but both these features are only activated after calibration, so time can be given beforehand to make the window perfect).
- Has a method for resizing the window. This is useful if you are rubbish with calibration or need to force certain dimensions.
- Can disable speed bar (not yet optional, variable is just placeholder)
- Can disable restart button (necessary as it causes errors, stop then play to restart).

HELP CAN BE FOUND UNDER INFORMATION METHOD
PRESS F1 TO UNLOCK/RE-LOCK THE MOUSE
Attached Files
File Type: a2w superMouseAiming.a2w (645.8 KB, 403 views)

Last edited by arty-fishL; 03-08-2012 at 05:44 PM. Reason: fixing some grammar
   
Reply With Quote
Old
Mr Kidnapper
Senior Member
 
Status: Offline
Posts: 442
Join Date: Feb 2011
Default 03-08-2012, 07:26 PM

The camera turn is very smooth, especially compared to mine. Yeaah. Found out why. Now to reverse-engineer it.
I don't really see the point in making calibration happen only once if you can have it re-calibrate every ten or so seconds.
Don't quite understand what basicThread is supposed to do. Seems to be unfinished.

Last edited by Mr Kidnapper; 03-08-2012 at 08:04 PM.
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Arrow 03-09-2012, 08:48 AM

Quote:
Originally Posted by Mr Kidnapper View Post
The camera turn is very smooth, especially compared to mine. Yeaah. Found out why. Now to reverse-engineer it.
I don't really see the point in making calibration happen only once if you can have it re-calibrate every ten or so seconds.
Don't quite understand what basicThread is supposed to do. Seems to be unfinished.
Calibration happens only once because I couldn't be bothered moving it to a separate function and messing up the code after I realised I should probably make it calibrate more. I am working on an update where it calibrates again when you press F1 though, every 10 seconds is a waste of resources if the window isn't going to be changed or moved unless the mouse is visible, so it will calibrate upon locking/unlocking the mouse (F1).

Its not unfinished. basicThread uses threading (alas "from threading import Thread"). I called it basicThread as it is a class within a method, so I didn't know what to name it and since it is a basic threading class (using default initialiser) I called it "basicThread". I would expect you to know what threading is, as you seem so advanced, but nevertheless I will explain:
Only one line can be performed at a time in python. While a script is being run the Alice world actually freezes until it finishes. This is OK for most short functions, but for a looping function with a time.sleep in it, it would cause either extreme lag or a complete lockup. By running it in a thread the code runs simultaneously in a separate thread, making it efficient.

By all means just use my code, reverse engineer it if you want, but the script can just by copied and pasted and the Alice code is fairly concise (as scripting does the majority of the work), plus it is documented in the INFORMATION method.
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Default 03-09-2012, 09:03 AM

I am working on an update.

Known bugs:
- window size increases each time the world is played and setupWindow is called. > FIXED
- sensitivity is useless > FIXED, plus I increased the max sensitivity to 100, 100 being max speed and 0 being min. FYI - invalid values perform like so: 101 = no movement, > 101 = inverted turning, < 0 = even slower than min speed (pointless).
- enableSpeedBar var does nothing > WORKING ON IT
- enabling restart button and using it causes errors > WORKING ON IT
- cursor is not properly centred > FIXED
- the INFORMATION method had some incorrect information > FIXED, plus I added an update log comment and a todo comment.

Feature improvements:
- repeatable calibration > WORKING ON IT
- automatically repeated calibration > WORKING ON IT
- add a mouse smoothing option (like when you press F8 in Minecraft). > WILL WORK ON IT


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [-]

Last edited by arty-fishL; 03-09-2012 at 04:15 PM.
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 03-11-2012, 12:04 PM

Is the mouse in the very center of the screen while the engine is running? I tried testing with a makeshift crosshair and it seemed to be a little bit under the center, but since it's invisible, it's hard to tell.


(')>
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Arrow 03-11-2012, 04:38 PM

Quote:
Originally Posted by x2495iiii View Post
Is the mouse in the very center of the screen while the engine is running? I tried testing with a makeshift crosshair and it seemed to be a little bit under the center, but since it's invisible, it's hard to tell.
You are correct, in the version that is posted the mouse is off-centre. I have fixed it, but not released the update yet (see my post above yours).

The problem was I accidentally used half the width for the Y value, rather than half the height, so it was below the middle. It isn't a big issue, since you can't actually see the cursor and it doesn't really need to be dead-centre, but I fixed it anyway.


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [-]
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 03-11-2012, 04:54 PM

The reason I asked you to make the engine was to enable cursor-locked FPS type games, and those have the cursor locked dead center, so for that purpose it does matter.

Thank you for for fixing it, arty. Your wizardry knows no bounds.


(')>
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Arrow 03-11-2012, 05:06 PM

Quote:
Originally Posted by x2495iiii View Post
The reason I asked you to make the engine was to enable cursor-locked FPS type games, and those have the cursor locked dead center, so for that purpose it does matter.

Thank you for for fixing it, arty. Your wizardry knows no bounds.
Here is the partially finished update if you want it.
It has the window size, wrong INFORMATION, sensitivity and centring glitches fixed.

I forgot to mention the play window goes transparent upon losing focus, because that's cool. There is also an (unrelated) glitch that happens upon losing focus; if the window is clicked again the cursor disappears, but is not locked, so F1 needs double tapped, there is sometimes an error too.
Attached Files
File Type: a2w superMouseAiming.a2w (646.5 KB, 57 views)


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [-]
   
Reply With Quote
Old
zeekthegamer
Member
 
zeekthegamer's Avatar
 
Status: Offline
Posts: 23
Join Date: Mar 2012
Location: chicago
Smile 03-12-2012, 01:45 AM

Nice mouse game you made. lt sure does run smooth.

Last edited by zeekthegamer; 03-12-2012 at 01:50 AM.
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Default 03-12-2012, 08:28 AM

Quote:
Originally Posted by zeekthegamer View Post
Nice mouse game you made. lt sure does run smooth.
Thanks. Its not a game, its just an engine, but you can make it into a game if you want.


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [-]
   
Reply With Quote
Reply

Tags
aiming, calibration, cursor, mouse, turn

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.