Asmodeus's Recent Forum Activity

  • Well, ideally I want to avoid using collision objects in favor of randomly generated Y coordinates as the bouncing axis for an arbitrary # of items.

    However, I might be able to borrow the bullet idea if I decide to go the route of creating 3-4 invisible sprites at slightly randomized Y locations about the base of the enemy's sprite. Then I'd have to ensure that different items only bounce against specified sprites.

    Which method do you think has more performance overhead?

  • Imagine you want to drop a load of coins on the ground in a top-down, 2d world using 2d physics. How would you do it?

    Attached is a capx showing several attempts I've made to bounce an object a set amount of times on an arbitrary Y coordinate.

    The advantage to setting Y coordinates as collision axis is that you can create 5 coins that randomize where this Y collision will be and each bounces in a unique place. If you tried to do this with invisible immovable physics objects, you would not get the desired FX.

    bouncingObject.capx

    Tips: try increasing and decreasing the bounceStrength instance variable of the green physics ball. The blue ball is just a graphic that is pinned. In a real game you'd probably make the physics object invisible.

  • 'doh, thanks. Will try it later. Also noticed that I need to manage the size of the array..

  • I would like to count the number of text elements using XML.NodeCount but nothing I try is working. The action slightly below it saying Set LastParam3 to "I got here" never fires.

    EDIT: I changed the loop to start at 0 and changed loopindex to loopindex + 1 and that at least fires "I got here".

    See highlighted action:

    <img src="https://dl.dropbox.com/u/7439411/errorImages/errXML123.jpg" border="0" />

    Example Data:

    <?xml version="1.0" encoding="UTF-8"?>
    <root>
       <TalkToImoen>
          <normal>
             <blocks>
                <element>
                   <portrait>Imoen</portrait>
                   <text>
                      <element>I'm so glad to be out of that place..</element>                             
                   </text>
                </element>
             </blocks>
          </normal>
       </TalkToImoen>
       <TalkToMinsc>
          <normal>
             <blocks>
                <element>
                   <portrait>Minsc</portrait>
                   <text>
                      <element>I'm Minsc.</element>
                      <element>I love my hamster, Boo!</element>
                          <element>I</element>
                          <element>can</element>
                          <element>talk</element>
                          <element>for</element>
                          <element>days! :D</element>
                   </text>
                </element>
             </blocks>
          </normal>
       </TalkToMinsc>
    </root>
    
    

    What I've tried:

    1. Wrapping the expression with int( )
    2. Adding 0 to the end of the expression
    3. Ensuring ".../element[1]" instead of beginning with element 0 in XPath strings
  • That's exactly what I'm doing now, actually.

    I'm making use of XPath predicates and saving all the text for the current variable "DialogueBlockIndex" into an array.

    The initial hesitation to do this was based on performance concerns, but I've since decided to just do it and see what happens.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I think the objective here is to have an easily readable text file to edit for creating dialogues, and to avoid re-querying with Xpath just to advance from one text block to another.

  • Right, that sounds like the array idea, where you bring the file data into memory for processing. Instead of arrays though, you would use a single string variable and use TokenAt to navigate it. I may end up having to do something like this if there's no way to remember where I left off in the XML file and avoid re-querying with XPath.

    So then, what if your conversation looks like this?

    <?xml version="1.0" encoding="UTF-8"?>
    <root>
       <TalkToImoen>
          <normal>
             <blocks>
                <element>
                   <portrait>Imoen</portrait>
                   <text>
                      <element>I'm so glad to be out of that place..</element>
                   </text>
                </element>
             </blocks>
          </normal>
       </TalkToImoen>
       <TalkToMinsc>
           <nextDialogue>EscapeFromTheCity_Minsc_001</nextDialogue>
          <normal>
             <blocks>
                <element>
                   <portrait>Minsc</portrait>
                   <text>
                      <element>I'm Minsc.</element>
                      <element>I love my hamster, Boo!</element>
                   </text>
                </element>
           ??   <element>
                   <portrait>MainCharacter</portrait>
                   <text>
                      <element>Minsc, you and Boo are in trouble.</element>
                      <element>You have to get out of here!</element>
                   </text>
                </element>
           ??   <element>
                   <portrait>ShadowyFigure</portrait>
                   <text>
                      <element>I've found you...</element>                  
                   </text>
                </element>
             </blocks>
          </normal>
       </TalkToMinsc>
    </root>
    
  • How would you step through a dialogue with an NPC, if your conversation is in XML? The screenshot is of a work in progress, but hopefully you get the gist. Would you store the dialogue text into an array from the xml first? Or can you somehow pause the file traversal until more user input is received?

    Example logic:

    <img src="https://dl.dropbox.com/u/7439411/stepThroughXML.jpg" border="0" />

    Example data:

    <?xml version="1.0" encoding="UTF-8"?>
    <root>
    <TalkToMinsc>
          <normal>
             <blocks>
                <element>
                   <portrait>Minsc</portrait>
                   <text>
                      <element>I'm Minsc.</element>
                      <element>I love my hamster, Boo!</element>
                   </text>
                </element>
             </blocks>
          </normal>
       </TalkToMinsc>
    </root>
    
  • For now I've just decided to move on with XML.

    If anyone is interested in writing their logic in JSON, you can convert it to XML just by clicking a button: freeformatter.com/json-to-xml-converter.html

  • I'm trying to design a dialogue system, and I believe I'd prefer to use JSON over XML. I feel like I need the ability to use nested structures, but from what I understand C2 supports a limited dialect of JSON which can be seen when using the Download action on Arrays and Dictionaries.

    It appears I can get nesting in XML, so I will use it as a last resort.

    scirra.com/tutorials/354/xml-parsing

    However, if anyone knows how one could load the following JSON dialogue and parse it let me know. I tried loading it into a Dictionary but it never worked for me.

    Also, here's a link explaining why JSON is better than XML: json.org/xml.html

    {
        "fallingFromTheMountain001": {
            "normal": {
                "blocks": [
                    {
                        "portrait": "Kain",
                        "text": [
                            "I'm fine, thank you..",
                            "You know you really didn't have to do all of this.."
                        ]
                    },
                    {
                        "portrait": "Tellah",
                        "text": [
                            "Oh no worries at all.  A life is a valuable thing.",
                            "I'm just glad these old bones were still up to such a task, haha.",
                            "So tell me, why were you trying to climb that mountain?"
                        ],
                        "options": [
                            {
                                "response": "It's none of your business.",
                                "goto": "fallingFromTheMountain002",
                                "type": "wary"
                            },{
                                "response": "Something terrible happened there..I'm looking for answers.",
                                "goto": "fallingFromTheMountain002",
                                "type": "normal"
                            }
                        ]
                    }
                ]
            }
        },
        "fallingFromTheMountain002": {
            "normal": {
                "blocks": [
                    {
                        "portrait": "Tellah",
                        "text": [
                            "Oh?  Well then take this..."                      
                        ],
                        "itemGet":"OldCaveKey"
                    }
                ]
            },
            "wary": {
                "blocks": [
                    {
                        "portrait": "Kain",
                        "text": [
                            "I don't know who you are and there are people after me for what I know.",
                            "So I don't trust you yet."
                        ]
                    },
                    {
                        "portrait": "Tellah",
                        "text": [
                            "Fine by me. Take as much time as you like."
                        ]
                    }
                ]
            }
        }
    }
  • I have the opposite problem with Chrome. Fullscreen (F11) is 60 FPS, but otherwise it drops to the 25 - 30 range and gets jumpy.

    Firefox has no issues in either case.

    I tried updating my Radeon HD 4800 graphics driver to fix the Chrome issue but it didn't help.

  • JeZLee, this is a great start! The overall package seems solid. The background FX are a very nice touch.

    If this were intended to be more than a test project, I think it would benefit from a joystick control scheme, as pressing spacebar to shoot is noisy and awkward.

    I have also just recently acquired a personal license for C2, and I have a microproject in mind to help me learn the ropes.

Asmodeus's avatar

Asmodeus

Member since 29 Dec, 2012

None one is following Asmodeus yet!

Trophy Case

  • 11-Year Club
  • Email Verified

Progress

12/44
How to earn trophies