jobel's Forum Posts

  • Hi,

    I'm using positional audio and the first thing I do is set the player as the listener. My player shoots objects that make an explosion sound that is played "at object".

    The very first object that explodes is always silent..in fact, I can hear the very tail end of the explosion, so I know it plays. Then every one after is fine. I assume it takes some computing to figure out the position but isn't that what Set Listener supposed to do??

    My work around was to fire a positional sound off at -20 volume somewhere really far away from the player (xypos:20000x20000) at the START of LAYOUT and this has totally fixed the issue... I'm just wondering if there's something else I am supposed to do to avoid this problem?

    anyone else have this problem?

    thanks..

  • blackhornet This is SO awesome.. thank you - thank you - thank you!

    if my game is ever released I will be sure to give you credit!

  • Adding wait is not best way to do it. Most efficient way to build certain chain reactions is state machine. Unless you have some massive array to deal with, like a big level, arrays are fast enough.

    right..just illustrating a point...

    I've loaded data using the CSV plugin, when loading that information into memory that process takes longer than a tick, so you have to "wait" for it to be loaded since the game loop happens every tick... you have to build in something that will not execute code that assumes the data has been refreshed (especially if that code only happens once, like in an OnClicked Event for example)...you have to wait for the data to be finished loading. You can do this with flags or in some cases a simple System Wait might work, but it obviously needs to be tested. The Wait command is less reliable since all machines have different speeds and it greatly depends on the size of your data; a 0.1 Wait on one computer might not be long enough on another. However, there are simple cases where a Wait would suffice depending on what you are doing.

    I think the OP was probably just asking what is faster to build...

  • I like your site.. pretty cool.. and a non obvious cheat for Scrabble!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • just setting each value using actions, on startup is faster?

    oh I assumed you meant "faster" as in, which happens quicker..i.e computer speeds. Information I've loaded from tables are slower than loading information from variables or direct assigning. I've had to add Waits before executing certain code blocks because loading data from a table is slower than a tick. Whereas assigning table data through direct assigning happens in 1 tick.

  • traditionally file I/O is slower than things done in memory.

    I haven't used anything with JSON yet but I have used the CSV plugin by rexrainbow and I know that is definitely "slower" than events.

    So it would make sense that Events are fast since this is done in RAM opposed to going to a file and opening it etc..

  • Nebulas are irregularly shaped with wispy edges, assuming I could make a tilemap that would look good. I'm thinking 4x4 or 5x5 tiles (each tile 128x128 pixels?).

    and I'd make a bunch of these in the game, different shapes and different colors (webgl).

    so which is more efficient? five 1920x1080 images spread throughout the game that require 1 draw call each (requiring 8MB x5 of memory), or a 5x5 tilemap (totaling 640x640 pixels) requiring 20 draw calls (requiring <4MB of memory)?

    There's probably no easy answer.. I guess my confusion is about draw calls versus memory...and how best to add background images to my game...sort of how they fill the background in SPAZ.

  • I'm trying to optimize the game I am working on. It's a space themed game and has an unbound layout. My stars and "radiation" layers are tiledbackgrounds using parallax. And to dress things up a bit I've added sprites of planets and nebulas.

    My question is about the nebula. I've had my artist draw up a 1920x1080 image of a nebula on a transparent background. This doesn't seem very efficient to me. I'm only using the 1 nebula in the game, and its always in the same place on the unbound layout. So sometimes the player is over it and other times not.

    I'd like to add a lot more nebulae and swirls of gaseous anomalies... would using a tilemap be effective for this? or are tilemaps for games with less detail? like blocky tile images?

    I've read posts like: "It is not appropriate to use the Tilemap object to display large images. The tilemap object draws tile-by-tile, but can optimise if there are areas of the same tile. " So I was thinking I'd like to make a generic nebula tile map and then be able to draw a bunch of different shaped nebulae from it.

    Anyone have any suggestions on how to do this? How to add more background elements efficiently?

  • interesting.. totally makes sense that you could do it since all the technology is in place. I could see MS locking that down though since it's a potential risk to play a bunch of free games...or games that have nothing to do with microsoft.

  • I'm having problems with my suggestion.. now I'm not sure of the best way to do it.

    The first problem is my method requires monospacing (a font like courier). The second problem is for some reason C2 won't recognize "newline" as a carriage return (enter) in the replace() function. The ascii character is 0x13 or 'CR' but I don't know how to reference that in C2...

    also it seems the text object resize during runtime doesn't wrap the text...

    There must be a better way to do this..

    here is the capx I was working with...

  • yes, that's what I meant about "newlines" or "carriage returns". You need to count them as a full line by themselves.

    I'm not that great at string parsing in C2 but maybe the best way would be to replace all the "newline"s or "enters" with spaces (or any character for that matter) just so you can count all the characters to make the correct amount of lines.

    so let's say your TextBox's line height is 7 (pixels) and your line width is 20 (characters)...

    Set TextBox1 Text to ("This is my text." & newline & newline & "And this is a new paragraph.")
    Call Function AutoTextHeight("This is my text." & newline & newline & "And this is a new paragraph.")
    [/code:2m5u4q9r]
    and in the Function do this:
    
    [code:2m5u4q9r]
    Function AutoTextHeight-------------
    replace(Function.Param(0),newline,"XXXXXXXXXXXXXXXXXXXX")  //this will replace all your "enters" with Xs
    
    Set TextBox1 Height to (len(Function.Param(0) / 20) * 7 // divide by the linewidth and multiply by lineheight[/code:2m5u4q9r]
    
    you would need to pass the UID of the Text Object to "pick" it.. or you don't even need it in a function.  Just make sure to set the Text with the "enters" then make a copy of the string to replaces the "enters" for counting only. You don't want the actual Xs in your text.
  • so you basically want to "wrap" your text? Meaning make it so it doesn't cut off or not display text if it is too long for the height you gave it in the editor?

    Never tried it before but here's an idea:

    Account for which font and how many "W"s (or your font's widest letter) would fit in the given width; check how many characters are in your text string (making sure to check for newlines) then just do the math... Also you need to figure how much height to add with each newline.

    if 50 is your letter width max and you have 150 characters (including spaces) you add (3 * lineheight) to your TextBox's height.

  • Audacity is great because it's free... although not exactly user friendly for the audio novice. But there are some cool plugins for it like PaulStretch. Make sure to watch Youtube How-To videos.

  • Inkscape.. it does crash sometimes, but I like it a lot better than Illustrator. Unless you are a serious art producer, I'd say Inkscape is more than you'll ever need.

  • doesn't srand() get the runtime time and use that as a seed? I think that is plenty random enough, pseudo or not.

    as someone mentioned - maybe if you are dealing with casino style games for actual money you might need "true" randomness. But I would think the majority (if not 99.99%) of the games created with C2 will be more than adequate with Random().

    Believe it or not, I've actually tested C2's random function against some dice while I was in the design phase a while back. The game was only on paper at that point; I wanted to know how long it would take a player to collect item drops that were only dropped based on a random number range. The percentages were basically the same. I ran the test many times until I was comfortable with C2's randomness. Now I use it all the time without hesitation.