Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
1 registered members (AndrewAMD), 599 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Need a help about the algorithm in C-Lite #262499
04/24/09 07:05
04/24/09 07:05
Joined: Apr 2009
Posts: 6
I
idblack Offline OP
Newbie
idblack  Offline OP
Newbie
I

Joined: Apr 2009
Posts: 6
I was planning to make a game using 3DGS and C-lite as my final paper, and i'm good at the modelling and character animation but suck in coding,that's why i prefer to make the game as the game designer not the programmer. But problem appeared when my lecturer force me to be the programmer and reject my proposal on designing the game, he asked me to make the algorithm how to make a movement of character, i've search some about the algorithm and found that Backtracking algorithm are one sample that usually used to move the character, the problem is how to invent this algorithm to C-Lite?? in the litec workshop to make an animate character was so simple and i don't have any idea how to explain them in the pseudo code.

Tomorrow is the deadline, if i can't make it means i'll stay for another year on my campus, :((

Re: Need a help about the algorithm in C-Lite [Re: idblack] #262501
04/24/09 07:17
04/24/09 07:17
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
hehe.. which university ? even i am from academics.

gimme the link to your algorithm i convert in lite-c and explain u.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Need a help about the algorithm in C-Lite [Re: delinkx] #262503
04/24/09 07:43
04/24/09 07:43
Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Cowabanga Offline
Expert
Cowabanga  Offline
Expert

Joined: Aug 2008
Posts: 2,838
take me down to the paradise c...
Take a look at the KingdomHearts movement code! smile

Re: Need a help about the algorithm in C-Lite [Re: Cowabanga] #262505
04/24/09 08:11
04/24/09 08:11
Joined: Apr 2009
Posts: 6
I
idblack Offline OP
Newbie
idblack  Offline OP
Newbie
I

Joined: Apr 2009
Posts: 6
thank you Mr Delinx and Cowabanga smile
here is the pseudo code that i found on

http://www.devarticles.com/c/a/Development-Cycles/The-Backtracking-Algorithm-Technique/2/

function backtracking (current depth)

if solution is valid

return / print the solution

else

for each element from A[] source array

let X[current depth] ß element

if possible candidate (current depth + 1)

backtracking (current depth + 1)

end if

end for

end if

end function

Re: Need a help about the algorithm in C-Lite [Re: idblack] #262506
04/24/09 08:17
04/24/09 08:17
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
ok.. am converting and letting u know.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Need a help about the algorithm in C-Lite [Re: delinkx] #262521
04/24/09 09:50
04/24/09 09:50
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
here u go:

Code:
int no_of_solutions = 0;
int n = 4;
int x[20];

typedef struct
{
	int value[20];
}solutions;

solutions mySolutions[20];

void print(int k)
{
  var i;
  for (i=1;i<k+1;i++)
  		mySolutions[no_of_solutions].value[i] = x[i];
	 
}
int solution(int k)
{
  return k==n;
}
int possible(int k)
{
  var i; 
  for (i=1;i<k;i++)
	 if (x[i]==x[k] || abs(x[i]-x[k])==k-i)
		return 0;
  return 1;
}

void back(int k)
{
	if (solution(k))
	{
		print(k);
		no_of_solutions++;
	}
	 		
  	else
		for (x[k+1]=1; x[k+1]<=n; x[k+1]++)
			if (possible(k+1))
		  		 back(k+1);
}


void main()
{
	level_load(NULL);
	back(0);
	wait(-1);
}


Here, this follows the chessboard example. It computes the possible arrangement of queens on a chessboard 4 x 4. (u can change the size by changing the value of n). In such a way that no two queens are next to each other.

Here, I have saved the results in a struct array. The results is as follows:

mySolutions[1] = {2 4 1 3}
mySolutions[2] = {3 1 4 2}

with n=4, there are only 2 possible solutions.

for {2 4 1 3} this means the queen should be positioned at (1,2), (2,4), (3,1) and (4,3). We dont keep position of the row. the first element corresponds to the first row, second to the second row, etc..

now u can use this function to create a visual. Make a chessboard in 3D. And using the positions here u place them on the chessboard to show the combinations.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Need a help about the algorithm in C-Lite [Re: delinkx] #262523
04/24/09 10:22
04/24/09 10:22
Joined: Apr 2009
Posts: 6
I
idblack Offline OP
Newbie
idblack  Offline OP
Newbie
I

Joined: Apr 2009
Posts: 6
Thank you so much ^_^ it really helps me to convert pseudo to C-lite.
All i have to do now is meet my lecturer and explain the algorithm of the backtracking and use this code as the implementation on C-lite, thank you so much delinx

Re: Need a help about the algorithm in C-Lite [Re: idblack] #262527
04/24/09 11:14
04/24/09 11:14
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
welcome..


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Need a help about the algorithm in C-Lite [Re: delinkx] #262535
04/24/09 13:10
04/24/09 13:10
Joined: Apr 2009
Posts: 6
I
idblack Offline OP
Newbie
idblack  Offline OP
Newbie
I

Joined: Apr 2009
Posts: 6
OMG.... thanx a lot cowabanga and especially delinx... the proposal was accepted after long debate, at least i don't spend extra one year in campus!!!! thanx a lot laugh i'm going to start to learn using 3DGS and Litec through workshop and other tutorials here

Re: Need a help about the algorithm in C-Lite [Re: idblack] #262674
04/25/09 07:03
04/25/09 07:03
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
Welcome 2 the world of Game Development ! Have a nice ride with Gamestudio !

cheers smile


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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