[SOLVED] Works on Flash, broken on Windows/Android

Fraz

  • Posts: 159
Hello fellow stencylers,

I'm running into an issue where I've got a behaviour working perfectly on Flash however it's totally broken on Windows/Android. I've got a ghost system where every time you jump the time you spent waiting is added to a list, and the X of where you landed is saved to list as well.  Platforms are creatd and saved in a similar fashion. Basically at the end of a run when you die if you choose to save these lists are then added to a global list (a list of lists). I can then retrieve these sub-lists and 'load' a ghost to play against later. This works like a charm in Flash, it's 100% however when I build to Windows or Android when I go to play my ghost a few things happen:

1. My ghost is dropped in and a 'land' event is triggered it's X position immediately moves to an X of 0. The ghost is dropped in at an X position of 33, so either the value he's getting from a list is null or it's getting a 0 somehow.
2. The first platform in my list seemingly disappears.
3. The ghost never jumps. The behaviour starts counting as soon as he lands but the jump is never triggered.
4. If the player(not the ghost) executes a jump it generally results in a crash or at least MASSIVE slowdown/locking up

I've attached the two behaviours where I think the problem may lie. Let me know if this doesn't make sense and I can try to clarify anything.

Thanks for taking the time to help :)

« Last Edit: March 09, 2015, 01:36:17 pm by Fraz »
Fraz
     Google Play:
    
   "Platform Panic!"          Platform Panic! Thread

Fraz

  • Posts: 159
I've been banging my head against this all night to no avail. I did some sleuthing and noticed something though...

When I draw the lists they actually appear differently in flash and windows... Possibly important?

Flash: Loaded List   [32,200,400]
Windows: Loaded List    [[32,200,400]]  <--- Notice the double brackets

Both have a global list that looks the same. This is the list of lists: [[32,200,400],[32,218,420]]
Fraz
     Google Play:
    
   "Platform Panic!"          Platform Panic! Thread

yoplalala

  • *
  • Posts: 1632
Hi ! I haven't really look into your code. But I already had this kind of problem. The problem was with default lists (global or not). The think is that Flash  looks the value 0 and think it's a zero. Windows sees 0 and take it as 0.0. 0.0 isn't a number so it causes multiples problems.
The resolution was to use the"as number" block.

What code did you use to obtain

Flash: Loaded List   [32,200,400]
Windows: Loaded List    [[32,200,400]] 

?

Where did you define the game attributes PlateformSpeed PlatformUpDown ?

« Last Edit: March 06, 2015, 12:40:11 am by yoplalala »

Fraz

  • Posts: 159
The list of lists referenced above are saved in the 'scene event' screenshot. The list item is split into a list then copied into the appropriate loaded list using the following code
Fraz
     Google Play:
    
   "Platform Panic!"          Platform Panic! Thread

yoplalala

  • *
  • Posts: 1632
So PlatformSpeedAll is in fact a strin ( or text) which is written like [[[x,x,x,x],[x,x,x,x]],[[x,x,x,x],[x,x,x,x]]] ?
What is his form ?

Fraz

  • Posts: 159
So PlatformSpeedAll is in fact a strin ( or text) which is written like [x,x,x,x],[x,x,x,x] ?

The items in PlatformSpeedAll would be considered strings, yes.

I was assuming when I split that item using the comma separator and copy the created list (which should only contain numbers at that point) it would grab the nested items as numbers.
Fraz
     Google Play:
    
   "Platform Panic!"          Platform Panic! Thread

yoplalala

  • *
  • Posts: 1632
Can you just copy the string PlatformSpeedAll so I can visualise more ? :)

But I think it's indeed ( at least ) one of the problem. You should get them " as number"

When we read

1. My ghost is dropped in and a 'land' event is triggered it's X position immediately moves to an X of 0. The ghost is dropped in at an X position of 33, so either the value he's getting from a list is null or it's getting a 0 somehow.

it matches.

Fraz

  • Posts: 159
PlatformSpeedALL when drawn appears like this: [[33,209,330],[33,218,420],[33,210,330]]

I'll try the as number suggestion
Fraz
     Google Play:
    
   "Platform Panic!"          Platform Panic! Thread

yoplalala

  • *
  • Posts: 1632
I'm sure there  is something else
so when PlatformSpeedAll is split , it will be
 [[33,209,330]          [33,218,420]                    [33,210,330]]
Flash and WIndows must interpret them differently specially the first and the last.


Fraz

  • Posts: 159
I'm sure there  is something else
so when PlatformSpeedAll is split , it will be
 [[33,209,330]          [33,218,420]                    [33,210,330]]
Flash and WIndows must interpret them differently specially the first and the last.



Yeah, I can't actually GET to the last platform to tell you for sure, but the first platform is broken, every other platform after that works just fine. So it must be what you said, Flash and Windows/Android interpret the lists differently. As for the as number, it didn't actually make any difference as far as I can tell.

Thanks for your help so far!
Fraz
     Google Play:
    
   "Platform Panic!"          Platform Panic! Thread

Fraz

  • Posts: 159
I changed the code to add the numbers that are split to the list as opposed to copying  the list verbatim. I've attached the updated code. I still get the same issue, however when I draw my lists I get a strange results. As opposed to writing it out I've attached a screenshot of all the lists.
Fraz
     Google Play:
    
   "Platform Panic!"          Platform Panic! Thread

SadiQ

  • Posts: 1795
NaN is Not A Number, so something was added to that list by mistake.
When ever you use the Split lists...don't you need to clear them of any value before you add things in them?(I'm not sure you do, but you could try)
In this last image you posted...mind naming the lists the same as you have them in your pictures? I have no idea what speed and speedA refer to.

LandA, TimeA, SpeedA and IndiA are 2d Lists. That's why they get printed out like this: [[1,2],[3,4],[5,6]].
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

Fraz

  • Posts: 159
Tried to create a new list before adding, no luck :(

Speed and SpeedA are just PlatformSpeed and PlatformSpeedALL. InDi and InDiA is short for InitialDirection which is actually PlatformUpDown I shortened them to save space.

I attached a new snippet with the create new list and fixed an error in the earlier one
Fraz
     Google Play:
    
   "Platform Panic!"          Platform Panic! Thread

letmethink

  • *
  • Posts: 2545
Could you try setting the lists just to the item from the ALL list rather than by splitting it. I have a feeling that the square brackets would be read so you would get items such as [1 or 0].
~Letmethink

SadiQ

  • Posts: 1795
Do they still show up as 2d lists when you print them?
How about putting a picture of the code where you actually try to use the values from those lists?
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.