Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/18/24 10:45
StartWeek not working as it should
by Zheka. 04/18/24 10:11
folder management functions
by VoroneTZ. 04/17/24 06:52
lookback setting performance issue
by 7th_zorro. 04/16/24 03:08
zorro 64bit command line support
by 7th_zorro. 04/15/24 09:36
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:48
Zorro FIX plugin - Experimental
by flink. 04/14/24 07:46
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (SBGuy), 712 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
EternallyCurious, howardR, 11honza11, ccorrea, sakolin
19047 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[CODE] Better c_move (with game template in the works) #396114
03/02/12 21:34
03/02/12 21:34
Joined: Jan 2005
Posts: 330
USA
M
MatAllum Offline OP
Senior Member
MatAllum  Offline OP
Senior Member
M

Joined: Jan 2005
Posts: 330
USA
Edit to this post: The template provided on this first post only provides a c_move workaround script and not the "better c_move" mentioned in the title of this thread. See my post below (containing the player_move() function) for the code snippet you probably came here for.

*****************

I've seen a number of rants on this forum about the OBB collision system that's been forced on us since A6.40, and having had insane amounts of trouble with collision under any settings myself, I've come up with a solution for simple games.

I created a simple c_trace-based collision detection system for first-person games. Simple is the key word here - it allows climbing of steps and slopes, but Z movement is otherwise restricted (there's no gravity and no jumping). The system is also a little glitchy at the moment (but certainly better than what I've done with the new c_move), but I'm sure someone could check that out if there's enough interest in this project.

I wrapped up the collision system inside a well-documented template for adventure/stealth/horror games (inspired by Amnesia: The Dark Descent). It includes the following features:

-Movement. Obviously. Player and camera movement are smoothed and feel professional as far as I can see.
-Crouching (with un-crouch collision detection/avoidance)
-Leaning around corners
-Displaying short messages on the screen
-Interaction with level objects - tiny center dot turns to a hand in one of two positions depending on how you interact with an object
-Player's visibility is tracked, and can be passed to monster scripts so that the player can hide in the shadows.

It can be downloaded here:
http://www.mediafire.com/file/v42eclp7mz21mu7/XYhalfZCollision.rar

Does anyone find this helpful? Should I add or fix anything before I drop this into the user contributions board?

Last edited by MatAllum; 03/06/12 18:48.
Re: Simple template for A6 users who hate the collision system [Re: MatAllum] #396122
03/02/12 23:38
03/02/12 23:38
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Works very smooth, tested it with A8 COM!! laugh Why don't you add jumping, that way it will be more useful!
Will you make lite-c version? If no, I could try to convert it into lite-c, I think it'll be easy.


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Simple template for A6 users who hate the collision system [Re: 3run] #396128
03/03/12 00:11
03/03/12 00:11
Joined: Jan 2005
Posts: 330
USA
M
MatAllum Offline OP
Senior Member
MatAllum  Offline OP
Senior Member
M

Joined: Jan 2005
Posts: 330
USA
I will indeed attempt to add proper Z support if you think that would be useful. (I agree it would be, just not sure my scripting is quite good enough yet - my previous attempt was a bit glitchy)

I have no experience with lite-C, but you're welcome to do that - maybe wait until it's all ironed out first?

Anyway, glad you had success with running it!

Re: Simple template for A6 users who hate the collision system [Re: MatAllum] #396131
03/03/12 00:35
03/03/12 00:35
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Yeah, I better wait till it'll be ironed out first laugh Waiting for update!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Simple template for A6 users who hate the collision system [Re: 3run] #396186
03/03/12 19:25
03/03/12 19:25
Joined: May 2009
Posts: 5,370
Caucasus
3run Offline
Senior Expert
3run  Offline
Senior Expert

Joined: May 2009
Posts: 5,370
Caucasus
Leaning around corners should be improved mate, players leans throw the objects without any problems laugh Sorry for double post, keep this up!!


Looking for free stuff?? Take a look here: http://badcom.at.ua
Support me on: https://boosty.to/3rung
Re: Simple template for A6 users who hate the collision system [Re: 3run] #396205
03/04/12 01:40
03/04/12 01:40
Joined: Jan 2005
Posts: 330
USA
M
MatAllum Offline OP
Senior Member
MatAllum  Offline OP
Senior Member
M

Joined: Jan 2005
Posts: 330
USA
Whoops! I thought the default lean distance (11) averted that issue, but I guess it's still too much.

Anyway, still working (on and off) on decent Z movement, so we'll see where this goes.

Edit: You know, when I released this I felt pretty good about my programming. Now seeing how difficult it is to implement Z movement into this particular script makes me doubt that a little bit. I'll keep working at it, but currently it's.... nauseating at best.

Last edited by MatAllum; 03/04/12 02:07.
Re: Simple template for A6 users who hate the collision system [Re: MatAllum] #396416
03/06/12 18:44
03/06/12 18:44
Joined: Jan 2005
Posts: 330
USA
M
MatAllum Offline OP
Senior Member
MatAllum  Offline OP
Senior Member
M

Joined: Jan 2005
Posts: 330
USA
Okay, so the setup provided here works for simple adventure titles, I guess, but it's inadequate for plenty of projects, and the collision is buggy and it's really not a replacement for a c_move (just a workaround).

So I did a little searching around this forum and found an algorithm for calculating GLIDE from a simple trace. If anyone still wants a complete "horror template," I can still do that - but until then, enjoy this quick single-trace move.

NOTE: It still needs work! Touching two solid surfaces at once allows you to phase through walls in this script - I still need to add another trace or two to make it perfect.

Code:
var move_vel;
var move_dot;
var move_vec[3];
var move_vec2[3];

function player_move(&velocity)
{
	vec_set(move_vec, velocity);
	move_vel = vec_length(velocity);
	if(move_vel == 0)
	{
		vec_set(my_speed, nullvector);
		return;
	}
	vec_set(temp, my.x);
	vec_add(temp, move_vec);
	
	result = c_trace(my.x, temp, ignore_passable+ignore_passents+ignore_me+use_box+ignore_push);
	if(!trace_hit)
	{
		vec_set(my_speed, temp);
		vec_sub(my_speed, my.x);
		vec_set(my.x, temp);
	}
	else
	{
		move_dot = vec_dot(move_vec, normal)/move_vel;
		vec_set(temp, normal);
		vec_scale(temp, abs(move_dot)*move_vel);
		vec_set(move_vec2, move_vec);
		vec_add(move_vec2, temp);
		
		vec_add(my.x, move_vec2);
		vec_set(my_speed, move_vec2);
	}
}



I swapped out c_move for this function in my other hobby project (rewrite of my Halo clone) and it worked almost flawlessly.

Last edited by MatAllum; 03/06/12 19:47.

Moderated by  adoado, checkbutton, mk_1, Perro 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1