nimos100's Forum Posts

  • nimos100, where can i find the audio object source in order to change the path?

    You can't that's the whole problem. So you have to make a "fictional" source to bypass it. That's why I wrote in the original post, that its a mystery why you can't access the source of an audio object, because it should be fairly easy to do.

    But here is how you bypass it:

    The folder setting can be ignored, so doesn't matter if its "Sounds" or "Music" so don't worry about that.

    Notice that in the variable Audio_filename = "Sound_effect.ogg", it actually need to be "Audio_filename = "Sound_effect" otherwise it wont work. I just added the ".ogg" so you could see it was the filename. Since you can't load files without the extension you will always get the filenames with it, so you have to extract just the filename from you sound files which you can do with Tokencount and Tokenat if the files are in different locations, or just with tokenat if all the sounds are in the same folder.

    Since you say you have 10000 sounds, you of course have to add some functionality that can automate this for you. So you have to update the variables rather than trying to change the source of the audio object. But again its not a elegant solution, but the only way I have made it work.

  • I know the engine already does this per layout, but the option to do it manually for a sprite that we want when we want it is what allows more flexibility. Sure, people can mess up if they don't know how to use it, but that's a poor excuse to not have that level of control at all.

    Completely agree with this. Its no different in my opinion than people can screw up loops, that doesn't mean that loops should be removed as well. Almost everything can be screwed up if done wrong, but what matters is the ability to be able to do something when its actually needed and to use it where it doesn't hurt performance, which should be a decision made by the person designing the game and not those making the software, because sure in some cases it would be a bad idea, but that doesn't justify that then its bad in every single case and therefore shouldn't be an option.

  • nimos100

    Thanks again man. Now I could finally understand what you mean. But the thing I can't see is how I would store de UID or retrieve it when I need it. I mean, until now i'm using the system condition "compare two values" when I need the game to know some global value. I'm still crawling around the expressions. I would guess that that's how you do it? Which the expressions?

    I don't know even the basics of logical programming... That must be the reason it gets so hard for me to communicate with you.

    Aaand is there anyway I could give you guys some prestige? Like an upvote or something.

    Sure no problem.

    You can store the UID in a global variable, "Pressing V" while not in an event and you just name this "Last_created_UID = 0" this can then be used to store any number you want.

    Since its global it means that its available to you from anywhere in the project. So when you need it you just do like this:

    Pick Object.UID = Last_created_UID
    [/code:ioxwfbzv] 
    
    "Compare two values" doesn't make the system know anything, its simply compares two values and you can use the result to trigger whatever you need to. But maybe that was what you meant? But more important which is a normal mistake new users make is that they think that compare two value picks something, so it results in bugs, normally in the sense that suddenly more objects do things, where they thought it was only the one they "Picked". But "Compare two values" simply compares two value nothing more. So you have to pick the correct objects to compare before hand or it will cause problems.  For instant:
    
    [code:ioxwfbzv]
    Compare Object.UID = Last_created_UID
    ----> Object.destroy
    [/code:ioxwfbzv]
    
    This would destroy all Object and not only one.  So therefore you need to pick the correct Object first:
    
    [code:ioxwfbzv]
    Pick Object.UID = Last_created_UID
    Compare Object.type = "Rabbit"
    ----> Object.destroy
    [/code:ioxwfbzv]
    
    Here you first Pick the object which UID is equal to the global variable "Last_created_UID" and if that Object have a type which is "Rabbit" it will be destroyed. 
    
    The reason I changed the compare to "Type" is because it doesn't really make sense to compare UID using "Compare two values" as it doesn't pick anything and because if "Pick Object.UID = Last_created_UID" is true you already know that they have the same value and you have already picked it. So when you pick something you are at the same time performing a comparison automatically.
  • Your desire for better pathfinding or smarter pathfinding is in fact seeking the holygrail of RTS AI. Many many big-time RTS still struggle with smart pathfinding. What they achieve, it's all logic from "hacks and work-arounds", thinking outside the box.

    I doubt we will ever get a smart pathfind AI out of the box. It's gonna require a lot of logic.

    Think you have a point there, but also in defence of Scirra, its not easy to meet every ones demand on which path finding method should be used, they use A* which is fine I think but of course if they can improve it somehow it would be good.

    But now that they have added a path finding behaviour and you start working with it, you quickly realize that its very basic and lots of details are missing in it. Like the single collision mesh, which of course is a design issue, but also there could be an option to make the path finding good for grid based games. And an option to make it move as close to an object as possible if you try to path find to a closed off area and that it would be able to path find correctly when in comes to diagonal movement etc. Besides the collision mesh, these things are details that should have been added to the behaviour to increase its functionality. So having to make work around is fine, but it shouldn't be that you have to spend 80-90% of the time doing this, because its obvious that its stuff that should have been in C2 by default, but aint.

  • Think these concerns have been made a few times before and agree with what you are saying. C2 can do a lot of things which are great, but as mentioned you always have the feeling that only the basics have been implemented and all the details needed to really complete it are skipped. The examples that you give are good examples of that. But think one of the most obvious examples of this are something as simple as text object and the fact that its not possible to change alignment during runtime even though you can do it in the editor. I mean its a very common functionality in any form of application, where you work with text. Still after using C2 for such a long time, its still a huge mystery why such details are not seen as important to add. And there are loads of such issues which again underline what you are also mentioning.

    So my hope with C3 is that Scirra release a much more polished application from the beginning, where all these details are added. So rather than spending so much time having to adding new functionality that should be there from the release, they spend a lot more energy listening to the community of dedicated users, that in my opinion comes up with a lot of very good ideas that could really improve the program and that they spend time adding those things instead. Most of the people that come up with these ideas are not newcomers to the program, but suggest stuff because they actually have used the program a lot and see gaps in it, that should be fixed. So really hope they keep a list of suggestion made through the years of what people are really missing in C2 so they can make sure its not the same issues C3.

  • Here is something I wrote some time ago for another post, Thought it might be useful for you as well when it comes to organizing large projects or just project in general that I as least find useful.

    [quote:2q4w5gpc]Here are some advise that might be useful.

    1. Clean up

    Objects that you don't need to be there from the start, by this I mean sprite objects that would be "Units", "Bullets" etc. you should destroy at the beginning of the game. This is simply to make sure that you don't have rogue objects in your program.

    2. Precise functions

    Make as small and precise functions as possible. Even though some of these functions might seem to simple for it to make much sense.

    An example of why this is a good idea. Imagine you have a "Car" object and in you code you might change the speed to whatever you think is fine. like "Car.speed = 100". This would be fine until the point you decide that it could be fun to add something like, if the speed gets above a certain value the car should start loose control. If you add it in your code you would have to change/test for it every time you changed speed. But with a function you can simply add the test here and update it for the whole program at once. So using loads of functions is in my opinion one of the best ways to maintain an overview of your project, but they are very easy to replace, maintain and bug fix as you know what inputs and outputs they have.

    3. Global constants

    This can be very useful for reducing spelling errors, and to quickly change things in your game. Imagine in the above example, that you have several "Car" objects, which are categorized by a type, "Cheap car", "Normal car" and "Expensive car"

    If you in your code manually add checks if ( Car.type = "Cheap car" ) and then do something, at some point you might figure out that the name "Cheap car" weren't that good an idea after all and something else would actually have been better, then instead of having to go through your whole code and replace "Cheap car", you can just update one global variable instant.

    4. Use several event sheets

    Don't be afraid of using event sheets even though you might not add a lot to them. It will really help you maintain an overview of your game.

    5. Split events and functions

    Unless you are 100% sure that an event sheet should only be used one place, its always a good idea to split events and functions, even though they work on the same object. So an event sheet called "Car events" and "Car functions" would be a good idea. You can always move functions later on, but think it good practice to just get used to splitting them. The reason for splitting them is that Functions wont execute without being called, so if you suddenly figure out that the functions in a event sheet could be useful in another, but have mixed a lot of events into it. You will have to move all the functions to a new event sheet to avoid unwanted problems of events suddenly executing when they shouldn't.

    6. Requirements and returns

    When making functions I find it very useful to add comments above them with requirements, and potential return values. This will make it very easy later on as you move along and might forget what a function actual does when you return to it.

    An example could be like this:

    7. Bug sheet

    Make an empty event sheet, that you just use for comments. You don't include it in your program. But the purpose is that as you test your game and might be testing something, suddenly notice that something else is not working as intended. Then instead of fixing it straight away, you just in your "Bug event sheet" add a comment explaining what you noticed. And if possible the cause for it. Then you can always fix it later and you wont forget about it.

    8. Quick reference function sheet.

    This can be a bit time consuming but very useful. The idea is again to add an event sheet that you don't include in your program. But you simply add function calls to it, with the required amount of parameters.

    This can speed things up quite a bit as you can just copy/paste function calls from this sheet to wherever you need them, and just update the parameters, and you don't have to remember the name or how you spelled the function name etc.

  • nimos100

    But anyway, now I understand that this first method of "1= true and everything else = false" is the methoted that Asmodean presented to my on his .capx exemple. Right?

    Yeah pretty sure that was the idea behind it.

    [quote:2tttmvz9]But how about the other method? It's still unclear to me how could I store the uid for the specific object on the circunstances that I need. And despite the solution that I already have, it's always good to understand the options and really learn about stuff instead of just copying... Of course if you could take your time again and try to explain it

    The reason you can do it, is because as you create an object you have already picked it. So you can store the UID. Simply by doing "Stored_UID = Object.UID" So in this case you can say that the condition for the picking is that, its the last object created.

    Compared to a "normal" condition like "Object.Name = James" would pick all objects which name are "James". This would just store the UID of the last object created, and you can then pick it later on using this.

    "Object.UID = Stored_UID"

    Which would be the same as doing "Object.Last_created_Object = true" but when using the UID you don't have to change "Last_created_object" to false all the time, because there can only be one last created object at the time. So you know that the "Stored_UID" will always be the UID of the last one created.

    [quote:2tttmvz9]By the way do I need to close this topic or something? I don't really know how to do that.

    You don't need to close topics it will "close" by it self when no one answer to it anymore

  • I do have a few questions though, to see if my plan is feasible:

    1. Would my pool of labor be limited to people who are already familiar with C2? Could any old programming freelancer pick up my project and do what I need, or would I have to look for help specifically within this community?

    2. How much would such a thing cost? How long should it take for the freelancer to complete his task?

    3. Is there any big hole in my plan that I'm not seeing here? Like I said, I don't have a background in this type of thing, I'm kinda feeling my way through the dark here.

    This ended up being pretty long. Sorry about that.

    Thanks for any help!

    1. I would assume that you are best off with getting someone that knows C2 or at least have a fairly good understanding of it and then someone that knows how to work with web content in general, to avoid running into security problems with account information, buying content etc if you plan on having a website as well.

    2. Well that's a difficult question to answer as the full scale of the game are not know, but only a rough overview. But wouldn't assume that its cheap.

    3. I think its fine that you wonder about this. But if I were you I wouldn't spend to much time on this at the moment until your game is closer to being finished. Because as you work on it, you might get enough experience that you can actually make it yourself.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi all. I've recently decided to start selling animated characters and effects on the Scirra Store and I have a quick question. What size do you like to get your art in?

    You don't really have to make the graphic the power of 2, its mostly due to older graphic cards, where the power of 2 were faster than using some odd numbers and some cards needed that scale. But most graphic cards today will handle it just fine as they have a dedicated GPU, memory and of course better in general.

    However it used to be that you made graphic in the sizes of 64x64, 128x128 etc. Because the graphic was converted to these dimensions anyway, as far as I know. Which means you don't save any memory anyway and might cause worse performance If not the power of 2. but anyway not 100% sure about whether that still the case with newer graphic cards. Would probably need Ashley to explain how it works, to be certain. But personally I wouldn't worry to much about it.

    Also regarding sizes, its generally a good idea to make the graphic the correct size so no scaling is needed. Regardless of whether you scale up or down, it will hurt quality. But in general its always better to scale down than up in my opinion.

  • Hi Community,

    I am working on a Quiz project that needs to work with 1000's of sounds (i will not be able to import all these sounds for obvious memory and loading time reasons). Since this quiz game will be played on iOS devices, the "streaming audio plugin" or "play by url"option will not work due to the playback delay caused by safari when you stream outside audio. My best option would be to first import select sounds ON RUNTIME AND INTO the game and play them as standard imported local audio.

    Ashley, newt, How would i be able to achieve this?

    Thank you in advanced for the assistance.

    There are no good way to do this as far as I know as you can't access the source of audio object for some weird reasons. So you need to make some workarounds to make it work.

    The only way I have figured out to do this, is to setup a variable path in the audio object and then you use this as the path to your audio files.

    However since the source requires a non extension path meaning the file can't be "sound.ogg" for instant, as C2 wont accept that it needs to be just "sound". So you need to make a functionality that extract the filename without the extension and then you add it together with the rest of the path so you get the complete path to the file.

    So the source when you are done should look like this:

    Path = "C:\Sounds\"  <--- Variable where you store the path to the files.
    Filename = "Sound1"  <--- This being the filename with the extension removed.
    
    In the Audio object source you add it together:
    Source: Path & Filename   <--- Read as (C:\Sounds\Sound1)
     [/code:50wmquii]
    
    So every time you want to load an audio file you have to update these two variable or just add it all in one depending on what you prefer. Its not really elegant but can't see any other way to do it.
  • 4 players assigned to a single object that differs only by instance variables have to control each one with their controller and/or keyboard. You'll need the following code:

    > Function "Move Left"
    Function "Move Right"
    Function "Jump"
    
    // Function Param 0 on all of them is instance variable "Player"
    //Then you'll need to call these functions for each Player, so you either have to do it manually
    
    Get "Object" with "Player" = 0
        On Gamepad "0" Button "D-pad Left"  Pressed
            OR
        On Keyboard "A" Pressed
            -> Call function "Move Left"
        On Gamepad "0" Button "D-pad Right"  Pressed
            OR
        On Keyboard "D" Pressed
            -> Call function "Move Left"
        On Gamepad "0" Button "A"  Pressed
            OR
        On Keyboard "Space" Pressed
            -> Call function "Jump"
    
    // Then repeat 3 more times for the other players
    // Or use a Loop
    
    For each "Object"
         On Gamepad "Object.Player" Button "D-pad Left"  Pressed
            OR
        On Keyboard "A" Pressed
            -> Call function "Move Left"
    // but oh, it doesn't work...
    // First we're assigning key button A as "left" for all players, so if we really want to go with this approach we still need to use an array and call "left" by Object.Player as X and keyboard key codes as Y
    // Second and to be fair more importantly, you cannot have triggers inside a loop, so the whole idea is out the window
    [/code:1hxotwd5]
    
    I think you're missing the point that every gamepad key has a key on the keyboard that mimics it. You CAN do it manually, but it will be a lot of repeating code and if something needs to be change it'd be a headache.
    
    I really need to take a break...    I'll leave everything for the weekend or even a whole week and come back to it with fresh mind later. Thanks @nimos100 for the great suggestions!
    

    Im not sure I fully understand the issue. Because does it matter which player is using which device? If I understand you correct. There are 4 players in total, 2 players are using the keyboard and 2 are using gamepads?

    But since the keyboard and the gamepads use different inputs, i don't really see what the problem is. You make a control set for each of them, sort of like you have done already. Controller 1 to 4.

    Group Controller 1 and 2 will always be keyboard

    Group controller 3 and 4 will always be gamepads

    But whether a player presses A on the keyboard to move left or a gamepad they use the same action right?

    But you are correct that you will need 4 groups for the controlling of the players to figure out which type of input is getting used. That being keyboard or one of the gamepads. But you will only have to set this up once. All the functions etc can be reused. But you already have this in your current design so why is that any different?

    [quote:1hxotwd5]First we're assigning key button A as "left" for all players

    This confuses me a bit, all players can't push the same button at once or what do you mean?

  • There is a rotate towards position I think its called, you can add the X,Y position of the picked object in here. Also Angle(X1,Y1,X2,Y2) will give you the angle between two objects. But sounds like the first option is what you might be looking for.

  • nimos100

    You are right. But I don't think the problem comes from the "Controls" group/function. I really don't think that it is that complicated. Just pull inputs from devices and store them in an array.

    It's the "Player" function (yes there were 2 conditions that didn't do anything - leftovers from previous testing). I think it's not comparing enough stuff and needs more conditions, that's all.

    Look at this (it's the exact same function, but Player0 and Player1 branches are split and it works just fine):

    As I said it was just my advice to you. Of course you can make it whatever way you think is best and it will most likely end up working.

    The reason I gave you that advice is because as your project grows, you are really not interested in "complicated" solutions, you aim for the most simple, optimized solution that you can make, because it makes it so much easier to troubleshoot, add and change later on when you might not have focused on the controlling parts for a while. So you want to be able to quickly go back and read the code and quickly find out where you have to change things. As I wrote in the first post, I think you are making a very complicated solution and its even hard for you to troubleshoot it, so imagine someone having to do it, that don't know the thoughts behind it.

    Looking at the screenshot to give you an example:

    You call the function "Player" which then calls another function called Control, so I assume that you aim to add something else to this function such as Shooting etc? Because otherwise it would be better to simply call the function "Controls" directly from where you call Function Player.

    You then depending on the Player parameter (0,1,2,3) duplicate the same functionality, only difference is whether the passed parameter is (0,1,2,3). But before that you call the function "Controls" which doesn't really handle all the controls, but only part of it, the actual control is done in Function Player depending on a value in the array.

    But in each of these events (Value at (Function.Param(0),0) > 0) etc. You have the simulate behaviours. But your code doesn't make sure that for instant (Value at (Function.Param(0),0) > 0) and (Value at (Function.Param(0),20) > 0) and (Value at (Function.Param(0),21) > 0 can't all be true at the same time. So if the array screws up then the movement will bug as well.

    So what im saying is if you for instant have a function called "Player Move Left", then already at this point you know what the function does. Its doesn't handle anything else. So to make it work you just need to pass the correct Player and all of them can use the same code.

    Function Player Move Left
    Pick Platformer.Player = Function.Param(0)
    Platformer Simulate Pressing Left
    [/code:3l9nmrgh]
    
    This would be able to handle left movement for all players. So the only thing you have to do, is to add events like:
    
    [code:3l9nmrgh]
    On key press A
    Function.call("Player Move Left", <Player nr, that is linked to this control>)
    [/code:3l9nmrgh]
    
    And that would be it. No need to store anything in arrays or anything, its very easy to read the code and it does exactly what you would expect. 
    
    I can read your code, but going through all the values stored in the array, following all the function calls. Making sure that the value in array actually match what it should etc. Just take to long time that I think you are making things a lot more difficult for yourself than it needs to be, you have to troubleshoot and track so much code to figure out where it goes wrong. 
    
    Ps. You don't need a Trigger once in functions, as it will automatically only trigger once, when you call it. But anyway, its not causing the problem, its just that it makes no difference whether its there or not.
  • To understand the problem run the capx and do this: "if you press A a couple of times you'll see Player0 moving a few pixels to the left. If you repeat this with the LeftArrow the Player1 will do much of the same. However if you hold on A and press the LeftArrow Player1 will go left as if the "trigger once" does not exist." This should not happen. It means that while Player0 button is pressed the function continues to return TRUE and Player1 instead of moving a pixel to the left and stopping is shooting through the screen.

    I think your have a picking problem some where, so the players get mixed up. However I can't seem to figure out where it goes wrong. Anyway you have some code in your program that doesn't really do anything.

    Function Parameter 0 = Function.Param(0) I assume this should compare towards the function "Control"? However you never return any value from this function. In case its not that function, then you might as well remove the check as it doesn't do anything.

    But overall, I would strongly consider redesigning the way you want the control system to work. The way I would do it is something like this:

    1. Make a separate event for each direction or button. So one for Left, Right, Up, Down whatever you need.

    2. Make a function for each direction/button, that requires the Player_number as input and in these function you apply the actual functionality. Like Platform.Simulate Pressing Left etc. Which is to avoid problems and confusion with function return values etc. Which aint really needed. Its a lot easier to work with simple functions that handles very specific things rather than making functions taking care of a lot of things.

    All this will be a lot less code than you currently have and doesn't require an array. My guess is that unless you need the array and to make the controls the way you are for some very specific reasons. You are causing a lot more problems for yourself than you have to and there is a big chance if you need to change it later on for whatever reason, you might run into some huge problems. Besides that redesigning it, will most likely be faster than solving the one you currently have set up, and a lot easier to maintain.

    Anyway think that the best advice I can give you.

  • I know it has something to do with the way the Player function is designed and/or called, but I really have no clue where.

    Any ideas?

    Not really sure what the problem is. but I downloaded the Capx and is a bit confused as it must be the most complicated control setup I have ever seen

    What exactly are you trying to achieve?

    Why do you store all the activity in an array?