Problems with Cloneindexes in Non-Level Editor Games

You must understand the Game Editor concepts, before post here.

Problems with Cloneindexes in Non-Level Editor Games

Postby DST » Fri Jan 21, 2011 8:20 pm

This is a question for all the authors/programmers of Game Editor.

I was working on the wiki, and i wanted to deal with the section entitled 'doors'. However, i have a problem:

When you compile an exe in GE, the cloneindexes and ZDepths do not stay constant to the objects in editor mode. This is only in exe - they work normally in editor.

Now doors usually work in pairs, right? Each side of the door takes you to the other side, to an area somewhere else in the editor/game.

Now when you create a level editor of your own, you can assign doors however you wish; but for people who use Game Editor itself to design the levels, how can we pair doors together if the cloneindexes are unpredictable?

The simple script of collision with door
Code: Select all
mydoor=collide.cloneindex;

+ keydown(up) event>
Code: Select all
int which=mydoor%2;
int nextone;
Actor * this;
switch(which){
case 0:  //even door
nextone=which+1;
break;
case 1:
nextone=which-1;
break;
}
this=getclone2("door", nextone);
x=this->x; y=this->y;


Will work in editor, but will be completely unpredictable in the final exe.

What is the recommended solution to this? 95% of all your users are not going to be making their own level editors....


There are methods such as using separate sequences made from the same animation and assigning those, but there has been trouble in the past with spawning using sequences - not sure what the status of that is now. If sequences spawn properly, then that may be the simplest solution, because a player can then get the animindex and use that in place of cloneindex.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Problems with Cloneindexes in Non-Level Editor Games

Postby lcl » Fri Jan 21, 2011 8:45 pm

I have done simple door system just like this. See the code there -> viewtopic.php?f=4&t=9806
It works well in GE and also exported version.
SABRE (semi-3D engine) official development topic: viewtopic.php?f=6&t=12644
A game project that utilizes SABRE: viewtopic.php?f=4&t=13297
User avatar
lcl
 
Posts: 1971
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 209 Give a positive score

Re: Problems with Cloneindexes in Non-Level Editor Games

Postby DST » Fri Jan 21, 2011 10:04 pm

Yes, that's a good door script, however it still doesn't address the issue. Your script still relies on cloneindex to work.

In my experience, Cloneindexes cannot be relied upon in exe mode. And i have a lot of experience.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Problems with Cloneindexes in Non-Level Editor Games

Postby skydereign » Sat Jan 22, 2011 12:05 am

That problem really should be fixed, but what I have done before is use different animations, as I believe animindex does not have that problem. So instead of cloneindex, use animindex, and make all doors have different animation names. That, or using xy coordinates, relative to all the others, setting a variable on create... but that way is tedious and not worth using.
User avatar
skydereign
 
Posts: 3465
Joined: Mon Jul 28, 2008 8:29 am
Score: 571 Give a positive score

Re: Problems with Cloneindexes in Non-Level Editor Games

Postby lcl » Mon Jan 31, 2011 9:06 am

I have to say that I'm not having any problems with cloneindexes.
My game has now something like over 80 doors meaning 40 pairs of them and the door pairs
stay the same in exported version as well as in GE's game mode. And I have land actor that has 3 clones and everyone of them acts differently according to cloneindex and they've always worked as they should. So, as skydereign said, it seems that this problem has been solved.
SABRE (semi-3D engine) official development topic: viewtopic.php?f=6&t=12644
A game project that utilizes SABRE: viewtopic.php?f=4&t=13297
User avatar
lcl
 
Posts: 1971
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 209 Give a positive score

Re: Problems with Cloneindexes in Non-Level Editor Games

Postby skydereign » Mon Jan 31, 2011 10:03 pm

Well... what I meant was it should be fixed, not that it has. Some people seem not to experience it, but it definitely happens, just not consistently. For the menus in apalia, I've had to use animindex, as cloneindex was only reliable in the editor. It worked fine when I exported it to linux, but the testers using windows found it flawed.
User avatar
skydereign
 
Posts: 3465
Joined: Mon Jul 28, 2008 8:29 am
Score: 571 Give a positive score

Re: Problems with Cloneindexes in Non-Level Editor Games

Postby lcl » Tue Feb 01, 2011 10:59 am

Ok sorry sky. I understood you wrong. :)
SABRE (semi-3D engine) official development topic: viewtopic.php?f=6&t=12644
A game project that utilizes SABRE: viewtopic.php?f=4&t=13297
User avatar
lcl
 
Posts: 1971
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 209 Give a positive score


Return to Advanced Topics

Who is online

Users browsing this forum: No registered users and 0 guests