tulamide's Forum Posts

  • Tips'n'Tricks #4: Urges

    Unlike the other tips, this one is more about actual gameplay. Sometimes you may want to give more life to your npc to gain atmosphere. A lot of designers decide to script such behaviour. But it's not very convincing if the same npc type does exactly the same and in the same order than every other npc of the same type (like walking from a to b, looking around, walking back to a, etc.)

    With a simple but effective technique you can give a much better impression of life. Let the npc be urge-driven.

    The math behind this is simple, which means you can add a lot of urges - and the more the better. You can even get something like

    Subscribe to Construct videos now

    or maybe a simple 'The Sims' - just by setting up enough urges.

    An urge is nothing more than a variable that raises over time from 0 to 1. As soon as it reaches 1, all other urges are pending and this one will be executed. It is still a scripted life, but this time you only offer a bunch of premade actions, and the npc decides when and where it executes them.

    Below is a very simple example, where 5 npc each knows of 4 urges: Hunger, thirst, curiosity and rest. They all start with a 10-second idle part, but you will soon see, that their actions differ from each other. They start living. Of couse, this would be much more impressive with a dozen of urges and beautiful graphics, but it shows the math behind it and how to setup the events.

    Bring life to your games!

    urges.cap

  • no one loves it anymore....That's just because everyone thinks he/she has to jump on the casual game market (instead of using the best tool for their game idea).

    I'm still in love with CC, and the more serious applications you can create besides games still are without competition among free game creation tools.

  • I don't know of any limit besides RAM. But I also use globals only sparely. Most of the data is stored in arrays, hashtables and dedicated sprites (invisible ones, that never appear on screen, only their PVs are used). It is much easier to work with and less vulnerable.

    1 million values per map? Be careful then to not convert them from the string to the array in only one tick, like in my example. Setting up such a huge array will take minutes, and if you do it in one tick the app is known to the system as "not responding", which might irritate users. Instead, use a routine that shows the progress while only converting a smaller part of the array, until done.

  • Of course.

    If you use the "on collision" trigger, both objects that are colliding are picked. So if you use that trigger with a family, only that member of the family is picked. Instead of bullet('damage') you'd use family('damage'), that's it.

  • AH! I had read on the Wiki that hashtables could only store strings, but I had stored numbers in them before so I just assumed that this was old news. I think I had determined that with input from a textbox, which must default to being a string even if it is a number? hope to not confuse more than helping, but you are talking about storing. And the value to store can be of any type. It is just the key that has to be a string.

    -> Insert key "1" with value 2

    the key "1" is created with the value number 2, accessible as HashTable("1")

    -> Insert key "1" with value "2"

    the key "1" is created with the value string 2, accessible as HashTable("1")

    -> Insert key 1 with value 2

    no key is created, because 1 is a number, not a string.

    And a textbox indeed only knows strings, but CC is helpful enough ro autoconvert for you.

    -> Set Text to str(1)

    -> Set Text to "1"

    -> Set Text to 1

    all three examples lead to the same result: A textbox with the text/value "1" (string)

    As for your point about why I care I'm not too sure if it's rhetoric or not so I'll answer:

    This isn't a game, it's a map editor! So I expect myself and whoever else uses it to move files around. As I make maps they pile up pretty fast. If I were to split the file out of wanting to take the easier route I would end up having to make 3 files each per map (not including the optional tileset save file)... so it just starts to get kinda messy.

    And I could use folders, but I think it is just easier if I want to share a map with someone to just send one map file.

    The second thing is that while I'm mostly making this for me (maybe a couple of friends, and I plan to share it on the forum) I'd rather not have to code for an exception if one of the files is missing. Just easier, once I hit the bug squashing phase I'm going to have my hands pretty full anyways.I see. Apart from the possibility of compressing such folders in an archive before sharing it, I think you have an argument with the exception code. The one-file-route should be easier to maintain.

    If you are heading for one final file containing the map structure with all its levels and the like, you may want to develop a naming convention for the keys. Something like

    "countL" (number of levels)

    "01_tiles" (the tileset of level 01)

    "01_countM" (number of maps of level 01)

    "01_01" (map 01 of level 01)

    could easily be retrieved again. And instead of storing one key per array value, I would convert the array to a string and store the array in one key. In the example above the key "01_01" would contain a string with all the array data of map 01 of level 01. I made an example cap showing how this can be achieved: array2hashtable.rar

    You make a great point about spending more time helping people too. I find when I look (and I do whenever I'm on here) I don't have anything to contribute to questions about physics, or controller issues, or AI. This will change when I'm done this map editor and actually focusing on making games, but in the meantime I am constantly amazed at the frequency that you and Jayjay and R0j0hound help people.

    If I haven't said it before, thank you so much. hope I didn't offend you, because my words weren't addressed at you but at the people that didn't help although they could have. I was just a bit disappointed coming back here after two month just to see, that so many questions are unanswered for weeks. There are so many talented developer out there, and even those who got help themselves don't contribute. It's not the way a community works: If most of the people are only leeching then the system breaks. And that would be very sad...

    Please don't think that I meant you, it was just the first thread that I answered in <img src="smileys/smiley1.gif" border="0" align="middle">

  • What exactly do you mean? An invisible sprite, that represents the focus of the camera? If so, then just add a sprite, set it to invisible and use the system object's "Scroll to" actions to always scroll to the sprite's position.

    Another way would be to use Magicam, a plugin made by linkman2004

  • Not really. You could post an example cap here and we could then see, if the problem remains (which would mean, it is independent from your pc) or not.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Been away for quite a while, and it seems that the CC help section has more people needing help, than people willing to spend a few seconds to help...

    To help with your specific example:

    For Each Element -> HashTable: Insert key Array.CurrentX with value Array.CurrentValue

    This won't work because the key of a hashtable entry has to be a string. Construct doesn't autoconvert to a string here (I guess it simply was forgotten). So by simply adding str() it will work:

    +For Each Element

    -> HashTable: Insert key str(Array.CurrentX) with value Array.CurrentValue

    But why making it so complicated? Who cares if the savegame consists of one file or a folder with several files? The gamer won't! In fact, if you have a look at today's games, they often have a complex tree-structure, with a folder named after the game slot or profile name or whatever and lots of files and sub-folders, containing other files and sub-folders. And why not? It doesn't make a difference in the gameplay-experience <img src="smileys/smiley2.gif" border="0" align="middle" />

  • I'm sorry to say so, but you are wrong indeed <img src="smileys/smiley2.gif" border="0" align="middle" />

    random(i) will return a number greater or equal 0 and lower than i

    random(f) will return a number greater than 0 and lower than f

    (i = int, f = float)

    random(6) returns 0-5

    random(6.0) returns 0.x-5.x

  • Errr..wouldn't random(22)+1 only give you 21 of your frames?

    random starts at zero meaning random(22)+1 is numbers,1-21.

    also adding random int to ensure you get random whole numbers may be an idea,as not sure if not,getting a whole number would stop a frame change?.....but it may.

    No, random(22)+1 will return 1-22

    -> random(22) returns 0-21, 1 added results in 1-22

    Also, random returns the same type that you pass. (I already explained it in another thread). If you pass a whole number then the return value is also an integer, if you pass a float, the return value will also be a float.

  • Layer inheritance is a fragile thing. The way it works quite good (and how it worked in your cap, too, when I tested it) is:

    1) Create a new layout (no copy of an existing one, but with the same dimensions than the one where you want to inherit the layer)

    2) Create a new layer (and name it)

    3) Create unique objects on that layer (not re-using global objects or copies of objects from other layouts)

    4) Only after being finished with the above points, set a layer in another layout to inherit the new one.

  • Wouldn't that require having to make copies of the same sprite for each of the letters? I've actually had an idea similar to that, but it sounds like it'd be both annoying and inefficient as well considering that there'd be a lot of small sprites in the layout at once (though I'm not sure if SpriteFont is particularly efficient either).That's exactly what SpriteFont does too. The only difference is, that the C++-Code may be executed a few milliseconds quicker than events. So, if you don't have any framerate problems using SpriteFont, you also won't have them using clones of a "letter sprite". It's just a bit painful knowing that one has to recreate all the work that lucid already did for us.

  • The bullet's hotspot wasn't centered, but way off. Just center it, and it should work.

  • When working with anything 3D, it is always a good idea to use power-of-two textures.

    Redo the textures for power-of-two sizes. By just quickly cropping the top face to 32x32, there was no such problem anymore.

  • From what I see, the names of the globals are causing the problem. You need to use the global-tag:

    global('GMoteForest1-1') + global('GMoteForest1-2'), etc.

    But there might also be a problem with the naming itself. Try to abandon the dash, use something like

    global('GMoteForest1_1')

    Hope it helps <img src="smileys/smiley1.gif" border="0" align="middle" />