GeorgeZaharia's Forum Posts

  • see if offset works for you

    OffsetXY example

    by implementing the above offsetXY you also remove lots of events that you duplicated as subevents to check all those leftrighttopbottom etc

    drag the green box around , at around 25pixels overlap left top bottom right it will turn red, if is not overlaping at offset returns to green ... i think this is what you wanted ... all you need is adapt it to your movement behavior.

    rule of offsetDirection: OffsetX +25 is Right, OffsetX -25 is Left, OffsetY +25 is bottom and OffsetY -25 is Top.

    the offset works from the greenbox bboxtop,bottom,left,right ... based on the origin point of the image i think didn't messed with that origin point.

  • objectY on collision with objectX > action = objectY.bulletbehavior = disable.

    see if that helps.

    if your bullet, has bullet behavior on it... all you have to do is add Solid Behavior on the wall, bullets might ricoche tho.

  • not sure if this will work, but you can also try the For Objecting Sorting Ascending by UID or something.

    and do something like:

    For "bullet"
    Compare value : bullet.bulletbehavior.moving = 1 
    sorting ascending
     action > cancel some action ( since is not 0).
    

    the idea is you loop trough all bullets, and if the moment happens in 1 of them, then u cancel whatever you need to be cancel or increase timer waiting or what not... if the loop returns 0 your cancel action won't happen.

    needs testing ....

  • I have lost of things in layout and somewhere I want to restart my layout but I don't know how this restart layout action work. It restarting layout in its current situation, There were some objects out of layout and during gameplay they are inside layout and lots of things. After restarting layout everything is still there current position. How can I actually restart layout where all objects reset to their starting position.

    When you restart layout, if used alone, what happens all non-global sprites, reset in that layout as you designed them in the visual editor.

    However, if your objects have positions saved in dictionary, or by global variables, you have to reset those also.

    Like this:

    Reset global variables,
    Dicitonary clear xYz
    Array empty
    wait 0 
    Restart layout.
    

    hope it makes sense, and maybe helps?

  • like dop2000 said you have to check if previous action completed, the more complicated yet perfect way of doing it is by using functions, not sure if this is still a thing in C3 or it got replaced by the javascript...

    but the idea is if function plugin is still a thing you can do something like bellow pseudo-code

    Solution 1:

    1. on F pressed, 
     1.1 Sub event if function "spawn action F completed" > action call function "spawn action F"
    
    2. On function "spawn action F" > do this actions 0-n++
    

    having a timer from my experience, it delays things and then glitches happen, with a delay... but it depends on how you implement it, the solution 3 shouldn't create any delayed glitches.

    Solution 2:

    have 1 boolean or global variable that u turn on and off while actions happen, and you have something like bellow:

    Global Variable "checkF" = 0;
    
    1. On "F" Key pressed 
     1.1 if checkF = 0 > action > set CheckF = 1
    	 do something
    			 do something
    			 set checkF = 0
    
    

    this will not let you tap super fast and overlap things but will create like a 0.1-0.2 delay in your spawning action when you press "F" it will still overlap but not as fast.

    Solution 3:

    The timer

    Global Variable "timer" = 0;
    
    
    1. everytick (or if timer) > 0 >subtract from timer 1 (this happens everytick or dt, so is closed as being miliseconds and not seconds, to increase delay either increase 2.1 set timer to 1000 or set the value of subtraction to 0.2 or 0.1)
    
    2. On "F" pressed 
     2.1 if timer =< 0 - action
    		 action 
    		 action 
    		 set timer to 100 (in miliseconds if you subtract 1 everytick like we do above)
    
    3. if timer < 0 - set timer to 0 [this is fail safe so the timer never goes under 0]
    
    
  • GeorgeZaharia OP was not asking how to move objects on a grid. The question was about chess.js API - the correct syntax used to promote a pawn.

    if he doesn't know how to move a object on a grid, wouldn't probably know how to implement chess.js API.

    ... also i sort of missed the first 2 pages, was thinking this 3rd page is the 1st page ... lol my bad.. now i seen he knows how to work an array.

    and since C3 now supports JS scripting

    here is a full js tutorial on how to make a chess based on js

    maybe it helps?

    tutorial how to chess js

  • You are welcome

    P.S there is google and youtube really... you wasted 1 hr waiting for a reply, instead of takin 5 seconds to search google.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • what i could find on youtube, looks like Faux 3d, or isometric game type 2.5D you can do it in C3, but requires some trigonometry knowledge for spinning the ground and stuff. i think was a tutorial on C2 that had a 2.5D world test thing, buggy as hell, but yea you could fake that 3d effect. since is not full 3d. but you will need lots of animations and lots of medium/advanced mathematics.

    however easier would be to just make the game in 3D directly using unity or something similar and just tilt the camera... towards that angle... less headaches.

    another way of doing it, is doing it top-view, instead of tilted, as long as you have the story and the gameplay is good, doesn't really matter what camera angle is at.

  • Download example

    in this example you have... 2 rows, 10 coins, 8 coins on the first row 2 coins on the 2nd row...

    they are evenly spaced out, you can control the values etc...

    you can also place a random position on screen using loopindex.. however if objects overlap, you have to add a "condition" to move the top object a bit to left or right until is not overlapping.

  • this is how i learned Construct ... 1st the thing sort of came to be visually easy, as im a front-end developer so knowing html5, css stuff helped.

    2nd i took all the examples in Construct over the years and disect them took apart line by line see what they did etc...

    3rd i played a lot with one example in particular that made me more used to construct (for me was the audio plugin example), i played with it a lot of time... understood a lot of stuff from it and made me more confortable with the interface. started mixing game ideas with the music stroboscope etc... making objects dance on music, fluctuate etc etc.. so in all what people suggested above... is learn by doing and redoing. having a bit of programming knowledge helps you get into that logical thinking part of things in the event sheet, but even without that you can still learn Construct "programming" by doing.

  • try using .ogg files instead ;)

    or if you can... host the audio files on a private website/server... and once the game starts load the assets from there... careful the file link on server must be like this depending on construct plugin you using: www.randomwebsite.tld/filesource/music.mp3 if the file format is not present in the link audio won't import.

    while this won't make your game smaller... since you will download eventually the full size... what this will do... is have your initial game small. so people can download it, and install the launcher fast. then they will wait in the loading screen of your game while the assets are downloaded, as in any major/normal game you will do. but this method helps you if you want your game to be like just the code no assets to be placed on facebook instant games for example where the requirements maximum files size of game is like 800kb... but that isn't for the whole game, that is for the "snapinest" of initial load only.

    if you can't figure the ogg or the server hosting part out, use audacity, and convert your mp3 from 43000Mhz to 16000Mhz mono/stereo single channel, you will lose some quality... like in any compression, but not that big difference for real... unless your device is like full stereo home cinema blueray etc etc etc where sound is a professional thing.

  • Download C2 Example

    image preview

    dop2000 was right :)

    took longer to place the objects in screen by event sheet than to actually make the calculation work ;)

    have fun... initially who ever said something about placing the loop under the start of layout was right... is just you need to get the order of events properly.

    hope this is what you mean.

    .. if you want to use it for coins in screen in a game... just replace the "on start of layout" to some 1 time trigger. you don't need at that point the creation lines... just the counting "for each coing iid ascending" and do the action. just make sure u trigger it once like... on collision with object, or on destroyed, or on score end game custom boolean trigger 1 time.

  • try removing all ur images and deselect the deduplication.... it might be that ur export in this image particular case is hang by the deduplication process... 2300+ images .... 190mb to be removed... lots of stuff... that is dead weight.

    if that speeds things up with minifier selected then u know what you need to optimize.

    Sebastien i think you might be referring to the minifier "hang error" i don't think this is the case. as when the minifier "hangs" u won't get any time expectation it will just freeze atleast for me.

    on the other hand, you might be right... minifier does affected exports in past as well.

  • With some experience now, I have short-listed the reasons, but I need to be sure which ones are more critical than the other. I need to know which one(s) are likely to be causing the heating issue the most:

    1. Numerous collision events (20+ Physics objects, only two of them moving)
    2. High-resolution sprites! 40+ of them! (max is the background 1080p)
    3. 600+ Events (not grouped, all of them in 1 layout/event-sheet) and 30+ global variables
    4. Layout size: 15300 x 1480 (however, scroll-to enabled with viewport of 1920x1080/scale outer)
    5. Other possible factors: Layer Scaling (not constantly), Time-scale set to 1.5, Photon plugin?

    i totally skipped ur list lol... but yea when comes to collisions, it sort of needs to be clutter free. like the more objects interact in the same time glitches will pop depending on device performance now.

    but around 20 objects interacting in screen can be around normal shouldn't create to much issues.

    high-resolution sprites, max quality should be 512px unless u need for 4k screens. but if ur target is mobile, id keep it at 480p or 720p .. for background images for characters i think 128x128 is pretty big and should show up on most devices very sharp and crisp.

    on events like i said, organize them make sure ur trigger the loops when needed and not have them trigger all the time.

    layout size.. doesn't matter that much.. it might take some cpu but only if u are rendering it all at once, if u scroll into it like on a platformer, and u dont need gameplay wise to go back once screen past some area... u can destroy the objects outside screen, id just create the objects when screen is in that area, will spike a bit the cpu every time u move to new area but then should balance to lower cpu usage and gpu, once creation event finished.

    glad it helped u :)

  • I agree with ashely and others, not sure if my response will help, but here is a step by step what to optimize if your game has cpu usage issues.

    So here are my tips:

    1. optimize your event sheet, make sure u trigger once the events and not on a loop or multiple loops.

    (you can use loops, but under a trigger once condition, like generate on a loop a certain amount of monsters in a circle for example, or check on start of layout a array database xy etc)

    2. you don't need 1080p on mobile games... max image quality u need is 512px anything above that is pointless(if you are not releasing for tablets which might need a 1080p resolution so your games graphic doesn't look choppy --- you can separate assets loading based on devices. however id just keep 512px and just stretch content a bit + a zoom in to match the screen of tablet device), and will just ruin ur gpu performance, making the gpu of the device work overtime for no reason.(after u export find the spritesheet or the assets u have and run them trough tinypng.com once... it will clear some "ghost" shades from it, and cut out the extra dead weight that u actually don't need, like pixel perfect shading transparency extra layers etc)

    3. turn the webgl effects off if u can replicate them with normal sprites (webgl heats things very fast in Construct, even if u don't use effects, having webgl activated inside ur game will heat things up for no reason -- there might be a reason but i think this list is just going to be to long ... u can guess what the reason is).

    4. don't use 3rd party wrappers, try and wrap ur APK or IOS launcher as native as possible (latest C3 i think does this pretty amazingly good, any outside wrapper is just overcomplicating ur process and dependencies), don't use 3rd parties like the old ones we had ... they are a mess, learn to wrap ur own with android sdk is rather easy, to sign and release a certificate.

    5. make sure u export for latest android and not some old android version, sure older android versions might make ur game compatible with older devices, but then ... lots of glitches will be reported, cause the android version is out of date or soon to be dumped from the service maintenance, plus old devices = more weird problems.

    6. this sort of goes into nr 2... but is related to audio ... make sure u have the small size exact what u need as sound and music, dont add mp3,ogg,vobb,+++ 1000 other formats inside ur game one game will be huge, 2 u only need ogg for cross compatibility or mp3.

    7. if ur running in app purchases or advertisements... make sure u don't over-call them, this sort of goes into 1).

    8. Optimize ur event sheet ... i noticed that more than 30 event lines per event sheet is going to create a issue.

    9. Optimize ur event sheet ... You can have more event lines by just separating ur events into more eventsheets like (Audio calls, button triggers, global variables, end game, score game, etc), just include them and trigger them when needed.

    10. Optimize ur event sheet ... no more than 5 subevents and 10 actions per event line. the more u have the more cpu will consume cause of how many things the computer has to check in that 1 fraction of a second before he moves to the next condition event.

    If you would be reading the blogs on optimizations, you would see that the longest and difficult part of game development is optimization. and this step is the most important when comes to having a "good product". That is why i always recommended when going into a "big product for public" make sure u design and code your game from the beginning "optimize in mind". otherwise once u finish it 1 year later, you have to go back to beginning and redo all the code.

    Hope it helped, but i doubt i said anything helpful in here that you didn't already knew.

    As per device heating up as Ashley said, and i think newton also.... for every action there is a reaction, so cpu/gpu is used (especially on a 80% usage cpu) u will have a reaction out of ur device = heat ... ur mobile game ideally should sit at 0-15% usage idle (CPU+GPU) and ~50% on triggers and rendering. not 70% all the time.