Jump to content

conceptgame

Members
  • Posts

    30
  • Joined

  • Last visited

  • Days Won

    4

Posts posted by conceptgame

  1. Hi again,

    What is the status of the following features:

    - SubEntities

    - Events (Triggers)

    - Sounds

    - Variables (I saw that there is a Meta class but it does not seem to be used at all and no parsing in SCMLReader)

    - Tags

    If not implemented I will look to make my changes so that I can push the changes back into to trunk afterwards.

  2. I removed the pivot inversion in loadFiles from SCMLReader and finally all keyframes are placed correctly but the interpolation seems to be broken.

    Did I forget something related to my specific coordinate system?

    Edit: I found that the deltaTime between each update is not working properly. It happens often that asking for help is rising new ideas for debugging.

    Thanks for those who took time to read my questions.

    I can now go forward with the Android port.

  3. Thanks for the help Trixt0r,

    I tried the obvious possibilities (1-pivot.y and -y) in SCMLReader but with no luck.

    protected void loadFiles(ArrayList<Element> files, Folder folder){
    		for(int j = 0; j < files.size(); j++){
    			Element f = files.get(j);
    			File file = new File(f.getInt("id"), f.get("name"),
    					new Dimension(f.getInt("width", 0), f.getInt("height", 0)),
    					new Point(f.getFloat("pivot_x", 0f), 1.0f-f.getFloat("pivot_y", 1f)));
    			
    			folder.addFile(file);
    		}
    	}
    
    
    protected void loadTimelineKeys(ArrayList<Element> keys, Timeline timeline){
    		for(int i = 0; i< keys.size(); i++){
    			Element k = keys.get(i);
    			Curve curve = new Curve();
    			curve.setType(Curve.getType(k.get("curve_type", "linear")));
    			curve.constraints.set(k.getFloat("c1", 0f),k.getFloat("c2", 0f),k.getFloat("c3", 0f),k.getFloat("c4", 0f));
    			Timeline.Key key = new Timeline.Key(k.getInt("id"), k.getInt("time", 0), k.getInt("spin", 1), curve);
    			Element obj = k.getChildByName("bone");
    			if(obj == null) obj = k.getChildByName("object");
    			
    			Point position = new Point(obj.getFloat("x", 0f), -1.0f*obj.getFloat("y", 0f));
    			Point scale = new Point(obj.getFloat("scale_x", 1f), obj.getFloat("scale_y", 1f));
    			Point pivot = new Point(obj.getFloat("pivot_x", 0f), 1.0f-obj.getFloat("pivot_y", (timeline.objectInfo.type == ObjectType.Bone)? .5f:1f));
    			float angle = obj.getFloat("angle", 0f), alpha = 1f;
    			int folder = -1, file = -1;
    			if(obj.getName().equals("object")){
    				if(timeline.objectInfo.type == ObjectType.Sprite){
    					alpha = obj.getFloat("a", 1f);
    					folder = obj.getInt("folder", -1);
    					file = obj.getInt("file", -1);
    					File f = data.getFolder(folder).getFile(file);
    					pivot = new Point(obj.getFloat("pivot_x", f.pivot.x), 1.0f-obj.getFloat("pivot_y", f.pivot.y));
    					timeline.objectInfo.size.set(f.size);
    				}
    			}
    			Timeline.Key.Object object;
    			if(obj.getName().equals("bone")) object = new Timeline.Key.Object(position, scale, pivot, angle, alpha, new FileReference(folder, file));
    			else object = new Timeline.Key.Object(position, scale, pivot, angle, alpha, new FileReference(folder, file));
    			key.setObject(object);
    			timeline.addKey(key);
    		}
    	}

    The current result is in attachment. What we cannot see on screenshot is that the hands are going away from body when this one is going down although it should be the contrary in the original spriter file for the grey guy.

     

    I tried also all the combinations with angle (360-angle) and spin (-spin) but there is always something not working.

    From what I can see, all seems ok in the animation excepting the y axis which seems to go in the wrong direction. But as explained before just changing this:

    Point position = new Point(obj.getFloat("x", 0f), -1.0f*obj.getFloat("y", 0f));

    does not help.

    I cannot figure out what is going wrong. I guess I need to debug with Android Studio, which is really a pain on my "little" configuration.

    EDIT:

    ok, i compared with my implementation in generic C++ importer and changed the right-handed transformation in Point to the left-handed system and it seems better (I replaced the last attachment before edit with the new screenshot) but still not perfect. Any ideas?

    public Point rotate(float degrees){
    		if(x != 0 || y != 0){
    			float cos = Calculator.cosDeg(degrees);
    			float sin = Calculator.sinDeg(degrees);
    			
    			//float xx = x*cos-y*sin;
    			//float yy = x*sin+y*cos;
    			/*
    			// Left Handed rotation in CF2.5 (Direct3D convention)
    			p'x = p.x * c + p.y * s;
    			p'y = -p.x * s + p.y * c;*/
    			float xx = x*cos+y*sin;
    			float yy = -x*sin+y*cos;
    			
    			this.x = xx;
    			this.y = yy;
    		}
    		return this;
    	}

    Screenshot_20170320-121859.png

  4. Hi all,

    Thank you Trixt0r for your implementation. After adapting the generic C++ reference implementation for the Windows platform on the CF2.5 game engine, I am now porting this implementation to Android.

    I used your code to perform this but I have got the usual first nightmare which is the coordinate system which is not really standard on this game engine.

    I got this on grey guy standard example (see attached image).

    From your experience, where do you think I need to investigate first and where in code?

    - reverse Y on Load?

    - reverse angle on Load?

     

    bug_drawing.jpg

  5. Hi SHinfan,

    The videos I made were rather memos without any explanation to get quickly an answer for a particular topic. The idea was to make them as short as possible to only get the essentials. I agree that it is not really for beginners. I planned to make some more in-depth tutorials but I prefer to invest time solving bugs at the moment.

    Can you give more explanation or send me a file so that I can solve your particular problem?

     

  6. Related to the issue of callofAS, is it now possible to change current entity on the fly with void EntityInstance::setCurrentEntity(int newEntityId)?

    Or is the only way to delete and recreate from top API?

    For example, instead of this:

    SpriterEngine::EntityInstance * inst = scmlModel->getNewEntityInstance(0);

    delete inst;

    inst = scmlModel->getNewEntityInstance(1);

    just this:

    SpriterEngine::EntityInstance * inst = scmlModel->getNewEntityInstance(0);

    inst->setCurrentEntity(1);

  7. It is more how can I use atlases in the current implementation. If I understood properly, by creating image file, I can use the sprite sheet image files instead of all single files and then by rendering I can use the AtlasData container from AtlasFile to locate the sprite on the spritesheet and draw it properly.

    Did I understood correctly that I only need to change the rendering method to get it work? In other words, is the loading of atlases already implemented. I saw Labsin's commit but I did not check in Details.

    This change can improve the performance of the game engine and it is really cool if we can already use it.

     

  8. Hi Lucid,

    1) I did not generate the file myself. I will forward the answer to the user who is using my extension for Clickteam Fusion 2.5. If he wants to keep this option checked, what should be done?

    2) For the atlases, I just merged the last commit and noticed that the code was not retrocompatible anymore. Nothing serious but it makes me wonder what I can do with it.

    Thanks for your answer.

  9. Hi Lucid,

    I did not follow all the updates but it seems that there are changes that are not applied to comply with new releases.

    1) First one of my user has some nodes with "realname" attribute. For example in void SpriterDocumentLoader::getObjectInfoFromEntityElement(SpriterFileElementWrapper *entityElement, Entity *entity, PointMap *defaultBoxPivotMap), no attribute realname is read. Is it as simple as replacing the name by realname if it exists? SOmething like this:

    SpriterFileAttributeWrapper *att = objInfoElement->getFirstAttribute("realname");
                if (!att->isValid())
                {
                    att = objInfoElement->getFirstAttribute("name");
                }

    I suppose that it leads to the problem I have that collision boxes used do not appear anymore. This user released with r7 version. Are there any other nodes which have this "new" attribute?

    2) I saw that atlases were added? Do you have any example code which overrides this new feature? I must admit that I did not try this feature in Spriter itself and does not know exactly how it works.

  10. I began to find some bugs in Easing curve. First the obvious ones in getEasingCurveFromKeyElement in spriterdocumentloader.cpp:

                    while (i < MAX_CONTROL_POINTS)
                    {
                        att = element->getFirstAttribute("c"+std::to_string(i+1));
                        if(att->isValid()) {
                            controlPoints = att->getRealValue();
                        }
                        i++;
                    }

    After these fixes, Bezier Curves still do not work. The sprites are at completely wrong places by rendering. Without easing they are correct.

    I am searching for the source of the bug but if you have any idea, I could save some time.

  11. Thanks for the commit lucid.

    I have implemented almost all of these changes in my current build.

    I have found one other critical point though:

    If the current animation is finished, there is no rendering anymore. That is weird since the position of the object can be changed or if there is a scrolling the display on the screen should be changed.

    I have changed void EntityInstance::setTimeElapsed(real timeElapsed) so that it is not checking the isPlaying flag and it is working properly.

  12. After some time spent on a tricky bug, I definitely think that the setCurrentAnimation should stop any animation blending like this:

    void EntityInstance::setCurrentAnimation(const std::string & animationName)
        {
            currentEntity->setCurrentAnimation(animationName, &currentAnimation);
            blendedAnimation = 0;
            blendCurrentTime = 0;
            blendTotalTime = 0;
            isPlaying = true;
        }

    Otherwise it can happen that a call to it during an animation blending will just be ignored.

  13. 35 minutes ago, lucid said:

    I meant to put this in the documentation, but it won't do any checks to make sure the hierarchies are equal.  I suppose it could be done with a separate function (that can be optionally called on command), but the reasoning is that it would be very slow (relatively speaking) to verify that both hierarchies are exactly the same.  I think it's best to just advise users that blending is made for two equal hierarchies, unless you have a use case where it makes sense to do otherwise.

    Ok I did not think about this. I understand the point. I need to explain it well for beginner users in my documentation

    35 minutes ago, lucid said:

    Someone else reported this, but I can't get it to crash with variables at all.  Does this happen every time for you?  If so, please send me a project where it does this if you can, so I can see if it's specific to certain projects.

    It happens every time. I used the last version of the Brutus Boss of the AdventurePlatformer full package and just add a variable.

    35 minutes ago, lucid said:

    This is in Spriter?  Please send me a project where the bones are not drawn on top as well. I've never seen this.

    Sorry this one is in the current C++ implementation, not Spriter. I cannot explain why it should come from my implementation: it is working with BrutusBoss, WonkySkeleton and others but not for the GreyGuy for example. Weird issue. I am not sure that it is the ZOrder which is the problem.

    Edit: I cannot attach screenshots (even smaller than 378Kb) to show you.

  14. It completely makes sense lucid. I removed these functions in my current implementation when they are taking me more than 5 minutes to integrate.

    On another hand, I experienced some issues which would be really useful:

    - Blending animation where boxes exist in the second one but not the first one (and vice versa) gives an inapropriate result when getting position of the boxes. Is there a way to know that the box positions are valid or not when blending between two animations in the currrent implementation?

    - Variables are crashing Spriter (I tried both last released version and beta version I think) when closing the popup window.

    - Depending on the scml file, the bones are not drawn over the sprites.

    - I cannot always delete a sound on the timeline. The sound stays even if alll the keyframes are deleted. Closing and opening again Spriter does not help.

    I know that the 3 last ones are related to Spriter itself and should be moved to another thread.

  15. Happy New Year 2016!

    I have just few general questions about the interface with this implementation which can benefit others. What is the easiest and most performant way to do the following:

    1) How to switch to another key frame (instead of changing time) from the current animation of an EntityInstance?

    2) How to change entity (setCurrentEntity) by name instead of by index?

    3) How to get name of the current animation or an animation by id and the number of animation for the current entity?

    4) How to get the current key frame number in the current animation?

    5) How to know if an animation is playing by name?

    6) How to know if an animation is finished (animation not looped)? How to know if one loop was finished (loopable animation)?

     

  16. 54 minutes ago, lucid said:

    @conceptgame There's no setting to do this (will add one if this solves your problem), but can you add this line:

    
    spin*=-1;

     

    Thanks lucid, it has fixed the issue.

    55 minutes ago, lucid said:

     

    Doesn't that cancel the effects of the reverse angle setting?
     

    I don't know anymore for what purpose is this setting. I will you use something similar for flipping but it is not a global but a dynamic use.

    This change is for me compulsory otherwise it is completely wrong. It makes sense since most of the conventions are using right handed systems but not Direct3D.

    I will be pleased to switch to OpenGL for the Android port.

  17. 1 hour ago, lucid said:

    Which animation is that?  Also it looks like the legs are in the normal position - does the animation play stably, or is there constant rotation and flipping of the whole character?

    It is animation 0 (walking). With the animation 1 (idle), the first frame is correct (elapsedTime==0) but then the rest is going strange: parts of the body are  always turning in the same direction, no flipping. Here is how it looks like when it is the first frame by animation 1:

    CF25LeftHanded2.png.9d1abe20c8fded4a368c

    1 hour ago, lucid said:

    Is this code used somewhere?

    Yes, just below in the code posted above:

     childPosition.x = (preMult.x * angleCos) + (preMult.y * angleSin);
     childPosition.y = -(preMult.x * angleSin) + (preMult.y * angleCos);

    I am also using it for bones to debug and I will certainly use something similar for points and boxes.

  18. Hi lucid,

    I am working on the CF25 and I am facing again against the same problem. I solved it with my old implementation but this time with the new implementation I cannot figure out which part I missed. The windows port on Clickteam Fusion 2.5 is based on Direct3D that is why I needed to change this to have left handed convention:

    void TransformProcessor::transformChildObject(UniversalObjectInterface *childObject) const
        {
            point parentScale = parentObject->getScale();
            childObject->setScale(multiply(childObject->getScale(), parentScale));
            if (parentScale.x*parentScale.y < 0)
            {
                childObject->setAngle( - childObject->getAngle());
            }
            childObject->setAngle(childObject->getAngle() + parentObject->getAngle());
            childObject->setAlpha(childObject->getAlpha()*parentObject->getAlpha());
            point childPosition = childObject->getPosition();
            point preMult = multiply(childPosition, parentScale);
            // Left Handed rotation in CF2.5 (Direct3D convention)
            // p'x = p.x * c + p.y * s;
            // p'y = -p.x * s + p.y * c;
            childPosition.x = (preMult.x * angleCos) + (preMult.y * angleSin);
            childPosition.y = -(preMult.x * angleSin) + (preMult.y * angleCos);
            childObject->setPosition(add(childPosition, parentObject->getPosition()));
        }

    In settings.cpp, I have set the following:

        bool Settings::reverseYOnLoad = true;
        bool Settings::reversePivotYOnLoad = true;
        bool Settings::reverseAngleOnLoad = false;

    Did I forget something obvious? At the moment it looks like this (top left it is another object):

    CF25LeftHanded.png.acbefe698163684106f3b

×
×
  • Create New...