Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - cydalone

Pages: 1
1
Hi!
I'm learning how to use the global custom blocks (aka static functions) to clean up my codes. Here's a problem I got.

To keep in one same place various parameters I use in the game, I'm keeping 5 different lists that were defined as game attributes. One is a list of actor types, another is a list of layers, and so on.
During the game, I want to update/empty/change these lists when I switch scenes.

I've built a global custom block to reinitialise these global lists, with the blocks "set MYLIST to create new list". And it works great.
I've also built another global custom block to refill these global lists, using input parameters (for instance "add [ACTOR TYPE] to actortype global list") with the block "add [something] to [some list]". But this fails. When I test it from within my behaviour "list of all static functions", it works, but not anywhere else. The static function is not even called. No error message either.
I tried to create a local copy of the global list, to add the new value to this copy, and then overwrite the global list with the updated temporary list... but I cannot create a local copy (a local attribute) within a global block; and making the temporary list a game attribute also fails.

My question is thus: can we fill a game attribute list with global blocks? if not, how could we do that?
(right now, I'm rebuilding entirely the lists with "when created" events, for each scene, with copied-pasted checks and safeguards... always a few pages worth of code, when I'm sure it should take far less if I could write these static functions)

Any idea? Thanks in advance!

2
Ask a Question / Batch generation of lots of actors
« on: August 29, 2015, 05:18:18 am »
Hi!

I need to create quite a few different actors for my game (about 200!). Each one of them will have 8 animations, the same behaviours, similar collision shapes. (I explain hereafter why I do not say "identical" collision shapes)

I found one way to do this: with TweakPNG I've extracted the metadata from one actor I defined by hand. Then I wrote a routine (outside Stencyl) to create all PNG of all the other actors I need, and I reinject the metadata within each PNG file so that I can import these new actors more quickly.

It works not too bad, except for two details:
- the name of the new actor is always the same as the one I created by hand. It's not hard to rename one actor, but I have to do that 200 times, while Stencyl allows for the simultaneous import of several actors! (but not when they have the same name, obviously)
- the sizes of my actors are not always the same, and the collision shapes also. Meaning the automated extraction of the animations, and definition of the collision shapes both fail. The latter effect is due to the fact that collision shapes are defined in pixels, while mine would be homothetically similar to each other (i.e. 50% of the sprite width, horizontally centered, 50% of the sprite height, centered on the bottom half... whether the sprite is tall, short, wide, etc)

My question is thus (if it's possible and not a top secret of Stencyl inner workings): how can I edit the metadata within the PNG files that Stencyl exports/imports? (for instance to automatically change the name of the actor and sizes of animations/collision shapes) Would there be a tool for that?
OR: Since I can edit the metadata with any text editor, what is the encryption/compression method used for this tExt?

Thanks!

3
Resolved Questions / build 8529: can't test or publish game anymore
« on: August 22, 2015, 11:10:55 pm »
Hi!
I've updated my version of Stencyl to the latest build available, and I can't test/publish the game I was making.
At first I thought the game was too large (30Mo) so I built a new sub-game to test what I was currently writing (the new part is only 1-2M). But still it won't launch anything, and the logs do not help :
[neko] C:\Program Files (x86)\Stencyl\plaf\haxe\std/flash/_std/Xml.hx:28: lines 28-418 : Field parent has different property access than core type
[neko] C:\Program Files (x86)\Stencyl\plaf\haxe\std/flash/_std/Xml.hx:28: lines 28-418 : XmlType should be XmlType
[neko] C:\Program Files (x86)\Stencyl\plaf\haxe\std/flash/_std/Xml.hx:28: lines 28-418 : Field nodeType has different type than in core type
Process 'neko' exited with code: 1
Failed: Building for Flash. (Return code: 1)

Er, I do not even know what this NEKO process is, and even less if I can debug it!

Any help or insights would be appreciated. Thanks!

PS: running Stencyl as an admin did not help either

EDIT: I reinstalled Stencyl from scratch, and now it works. It seems I cannot remove this post, though. Sorry for the inconvenience!

4
Bug Archives / Messy imported actor
« on: July 30, 2015, 05:23:31 am »
I exported an actor as a PNG file. In the metadata the behaviours seem well saved, but when I try to re-import that same PNG, the animations are messed up:
I still get 8 different animations (four "Walk" and four "Idle"), the parameters for the behaviours are OK. But the contents of the animations are wrong: the "Idle" ones are OK, but the "Walk" expect four frames, and only 8 are uploaded (instead of 16) in total. "Walk D" takes two frames from the initial "Walk U" plus two frames of the initial "Walk D", "Walk R" and "Walk L" are filled with four empty frames,  and "Walk U" takes two frames from both initial "Walk R" and "Walk L".
(I re-exported it, and re-re-imported it, with the same conclusion: the non-still animations are messed up)
It seems that, instead of loading a line of 4x1 frames, it's loading a block of 2x2 frames, omitting completely the rest of the lines, and filling the blanks with empty frames.

The only way I found to get over this is to change the shape of the PNG to load. And then I must insert back the metadata with Tweak PNG. Er, that's complicated. But it works.

5
Hi!

I'm building this RPG-like game with Stencyl. The Player roams through 2D scenes, and interacts with other actors (mobs, switches, etc). Zelda-like, if you want. I'm using Box2D because I want collision shapes to be more specific than full squares.
For all my actors, I've disabled Continous Collisions, rotation, gravity.

My regular/test scenes are 30x23 tiles, i.e. 960x736 pixels. I have about 7 layers per scene : two layers for the terrain/background, two layers for the furniture/obstacles/decorations, one layer for the player/actors, two layers for the canopy/foreground. I'm drawing only with tiles, 5% of them being animated (by the way, I don't understand the quote "break up concave polygon into 2 or more convex polygons instead" when defining collision shapes for tiles explained in the Stencylpedia, since the collision shapes of tiles above override the ones existing below)
For such scenes, the FPS is OK (20-25) until I get too many actors on screen at the same time. I hard-coded a limitation: there can only be 20 of them at any time, and I'm fine with this.

But I decided I wanted one big scene, for the main village, not divided into quarters/suburbs. It's 100x100 tiles (i.e. 3200x3200 pixels), and it should be OK, as I've read around here that scenes would tend to bug mostly when the width is bigger than 16k pixels. Again, 7-8 layers of tiles (most of them moderately populated). After 4 days of work, my scene is completely drawn, with tiles only.
Now I put actors in it, and I place my Player to test it (no point in testing it beforehand, as the collision shapes were not finished, right?).
Lo! Even without Debug Drawing, with a single actor (and only 3 behaviours: "Camera Follow", " Reload on Exit", and "4-way Movement"), the FPS plummets to 4-5!!!! I cannot sensibly add all the other actors I planned until I've solved this issue.

Would you have any idea to investigate what could cause this massive lag?
I'll test replacing parts of my layers (the ones with non-collidable non-animated tiles) with plain images as back/foregrounds, but this means I must change these images each time I modify a single item in the scene. Switching one tile would have been so much more convenient!

Thanks in advance for any hint or insights you could give me!

6
Hi!
On build 3.2.7994 when I edit one tile from a tileset (Select tile > Edit Frame > Edit Image...) then save it, the whole tileset image gets replaced with the edited tile (the tileset dimensions are the same, but it's filled with transparent tiles except for the upper-left tile showing the newly edited tile; still the collision shapes are kept for the whole set)
One  workaround: if you happen to have a copy/image of the tileset, you can still re-paste it onto the newly erased tileset. If you don't...
Thanks!

7
Fixed Bugs (3.x) / Animated tiles do not save/load correctly in 3.2
« on: December 16, 2014, 10:45:58 am »
Hi guys!

I'm updating this tileset I have used without a bug in 3.1. Its ID is 186, but the newest tiles (with animations) return an error message "Source 'C:\Users\me\AppData\Roaming\Stencyl\stencylworks\games\mygame\resources\186-160.png' does not exist
"
Indeed, in this folder, I found the right image, but its name is 186-1601.0.png
I cloned this image in the same folder, gave it the expected name, and it worked. But I'm not sure I'll do that too often  ;)

8
Hi!
I've been playing a lot with the "toggle fullscreen" block so that the user of my game could define the scale he/she wants to play.
Here is a configuration that works well:
Scale = 2x
Scale Mode = Scale to Fit/Fullscreen
Max scale = 2x
Start in Full Screen = No

But as I said, that's not what I want, as the game starting in 2x is too large. (But this proves that the visuals were indeed saved in 2x resolution). This is the first screenshot (in a degraded resolution)

Here's what I have been trying to setup:
Scale = 1x
Scale Mode = Scale to Fit/Fullscreen
Max scale = 2x
Start in Full Screen = No

So this time, the game starts fine in 1x, small enough to my taste, and it works well. But then, when I switch to fullscreen, everything goes awry: the grid is indeed scaled to 2x, but neither the tiles nor the actors are. This means I have all my visuals (Tiles and Doodads) stuck in the upper-left corner, with all the Actors all over the screen, not interacting anymore with the tiles the way they should. That's the second screenshot.
What do I do wrong?

(I do spot something funny in the logs:
 
Quote
[LOG] [Flash] Universal#initScreen(162): Stage Width: 640
[LOG] [Flash] Universal#initScreen(163): Stage Height: 480
[LOG] [Flash] Universal#initScreen(164): Screen Width: 640
[LOG] [Flash] Universal#initScreen(165): Screen Height: 480
[LOG] [Flash] Universal#initScreen(166): Screen DPI: 72
[LOG] [Flash] Universal#initScreen(302): Theoretical Scale: 1
[LOG] [Flash] Universal#initScreen(314): Max Scale: 2
[LOG] [Flash] Universal#initScreen(315): Engine Scale: 1x
[LOG] [Flash] Universal#initScreen(381): 1920
[LOG] [Flash] Universal#initScreen(382): 1080
[LOG] [Flash] Universal#initScreen(383): true
[LOG] [Flash] Universal#initScreen(464): Algorithm: Scale to Fit (Full Screen)
[LOG] [Flash] Universal#initScreen(617): Scale X: 1
[LOG] [Flash] Universal#initScreen(618): Scale Y: 1
[LOG] [Flash] Universal#initScreen(162): Stage Width: 640
[LOG] [Flash] Universal#initScreen(163): Stage Height: 480
[LOG] [Flash] Universal#initScreen(164): Screen Width: 1920
[LOG] [Flash] Universal#initScreen(165): Screen Height: 1080
[LOG] [Flash] Universal#initScreen(166): Screen DPI: 72
[LOG] [Flash] Universal#initScreen(197): Widescreen (Aspect Ratio > 1.5)
[LOG] [Flash] Universal#initScreen(302): Theoretical Scale: 2
[LOG] [Flash] Universal#initScreen(314): Max Scale: 2
[LOG] [Flash] Universal#initScreen(315): Engine Scale: 2x
[LOG] [Flash] Universal#initScreen(381): 1920
[LOG] [Flash] Universal#initScreen(382): 1080
[LOG] [Flash] Universal#initScreen(383): true
[LOG] [Flash] Universal#initScreen(464): Algorithm: Scale to Fit (Full Screen)
[LOG] [Flash] Universal#initScreen(617): Scale X: 1.125
[LOG] [Flash] Universal#initScreen(618): Scale Y: 1.125
why is the final scale factor 1.125 when it should be 1080/480=2.25 ? )

Thank you in advance!

9
Abandoned Bugs / Toggle fullscreen
« on: June 04, 2014, 02:04:05 am »
Hi!

I've been using a button to toggle fullscreen on and off at will.
My settings for this game are :
Scale = 2x
Scale Mode = Scale to Fit/Letterbox
Max Scale = 2x
Start in Full Screen ? OFF

When I click on that button successively, I witness the following behaviour:
-start in windowed mode
-switch to fullscreen Letterbox
-switch to windowed
-switch to fullscreen Fill
-switch to windowed
-switch to fullscreen Letterbox
-switch to windowed
-switch to fullscreen Fill
-switch to windowed
-etc...

OK, I found a solution fitting my need: instead of Letterbox, specifically ask Scale to Fit / Fullscreen. But is the behaviour I reported a bug or a feature?

10
Hello Stencyl!

I'm new to Stencyl 3.1.0, but for a pedagogical project I started about one week ago, and I have finished the prototype of a "game".
I must simulate a fishtank, with four Types of fishes (Actors group), weeds (Doodads), and bubbles (Doodads).
In realtime, the fishes go back and forth in the fishtank (sides represented by full-collision tiles) with no depth variation.
At a tunable frequency, I update the numbers of fishes of each Type with a few mathematical laws.
"Every 1 sec" I update the samples of fishes to be drawn (I create some if they are too few, I kill randomly some when they are too numerous) : obviously, the samples are significantly smaller than the "true" but hidden numbers of fishes.

With Box2D, everything works fine, but the game lags a lot (I draw about 100 fishes+weeds in total, is this too much?).
Then I switched to SimplePhysics, it does not lag any more, but I randomly get this error:
Quote
Il s'est produit une erreur de code ActionScript :
TypeError: Error #1009: Il est impossible d'accéder à la propriété ou à la méthode d'une référence d'objet nul.
   at com.stencyl.models::Region/innerUpdate()[/.../Region.hx:320]
   at com.stencyl::Engine/update()[/.../Engine.hx:2459]
   at com.stencyl::Engine/postUpdate()[/.../Engine.hx:2732]
   at com.stencyl::Engine/onUpdate()[/.../Engine.hx:2725]

I say "randomly" because I could not find which event systematically caused this. The game could run normally for ten minutes, or crash at once. It seems there is a collision recorded with a non-existent Region or Actor.
When I update the numbers of fishes, it's all in Attributes, and I do not modify any Actor.
When I update the samples, in particular when killing an Actor, I make sure that this Actor is alive before kiling it.
Now, I'm printing a lot of values, collision detections, to find the cause of this error, and I'm still stuck.
It's the first time I code with a GUI (but I did not have the time to learn haxe from scratch), and it's quite frustrating for me not to be able to understand where in my behaviours/events line #320 of Region.hx is called.

Before I post the whole game (or at least the offending part) to Stencylforge, are there any tricks that you veterans can advise me, so that I can try and learn how to debug this?

Many thanks in advance !

Pages: 1