Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pokémon-like movement #764

Closed
ghost opened this issue Nov 22, 2018 · 55 comments
Closed

Pokémon-like movement #764

ghost opened this issue Nov 22, 2018 · 55 comments
Labels
👌good first issue Good issue if you want to start contributing to GDevelop

Comments

@ghost
Copy link

ghost commented Nov 22, 2018

Hi!

I'd like to submit a new example to be added to GDevelop.
The project file is an attachment.

I confirm that any assets can be used freely by anybody, including for commercial usage.
They are all made by me.
game.json.zip

@4ian
Copy link
Owner

4ian commented Nov 23, 2018

Seems like you've not included any of the images in your zip. Can you modify your game so that images are in the same folder? Thanks!

@ghost
Copy link
Author

ghost commented Nov 23, 2018

Oh yeah, sorry. Here it is:
Pokémon Movement.zip

@Wend1go
Copy link
Contributor

Wend1go commented Nov 24, 2018

There were still wrong paths in your second upload, I corrected them here:
Pokemon.Movement.zip
Could you do a little more polish please? There is an empty Scene "Inside" without any content and the character doesn't show an animation when two direction keys are pushed at once.
Having some grass, bushes and walls in the background would make the example more visually appealing.

@ghost
Copy link
Author

ghost commented Nov 24, 2018

oh yeah sorry. I'll see

@ghost
Copy link
Author

ghost commented Nov 26, 2018

Here it is!
Pokémon Movement.zip

@ghost
Copy link
Author

ghost commented Nov 29, 2018

Is there anything you want me to change?

@4ian
Copy link
Owner

4ian commented Nov 29, 2018

Some images are still referring to your computer (../../Desktop/...): you must move them in your game folder. To see why, try to move your game in another sub folder and the image of the player won't be available.

Also, I tried and there are large pans of the game area that were grey. Is that normal? It's important that we have high quality example, so that it reflects professionally on the game engine :)

@ghost
Copy link
Author

ghost commented Nov 29, 2018

Ok, I'll see

@ghost
Copy link
Author

ghost commented Nov 29, 2018

Ok, here it is. Anything else?
Pokémon Movement.zip

@ghost
Copy link
Author

ghost commented Dec 6, 2018

anything you want me to change?

@4ian
Copy link
Owner

4ian commented Dec 6, 2018

There are a few things:

  • Could you remove the "Do =0 to the direction of Player" which are not useful.
  • There are a bunch of unused images in the resources, can you remove them too? (Project Manager > Game Settings > Resources > Right click on a resource > Remove all unused images).
  • Also would be interesting to have at least a house (object House) and handle collision with it (add an event without conditions, and with an action "Separate two objects". First object should be player, second object should be the House). Ideally put the House in a group called "Solid" and do the action between the Player and Solid.

You can also remove Nitro Bugz Main Character.png from the folder as it's not used it seems.

Trying to get the example as tiny and useful as possible ;)

Thanks! :)

@ghost
Copy link
Author

ghost commented Dec 6, 2018

Alright! Here it is, I made a fence instead of a house because I thought it'd be weird if there was a house and you couldn't go inside.
Pokémon Movement.zip
Anything you want me to add or change? I'm up for making a house that you can go inside of, but it'd be a bit longer.

@ghost
Copy link
Author

ghost commented Dec 6, 2018

Anything else?

@ghost
Copy link
Author

ghost commented Dec 8, 2018

Are there any other things you want me to change or add?

@ghost
Copy link
Author

ghost commented Dec 20, 2018

Now it looks like I'm spamming XD. Anything else?

@ghost
Copy link
Author

ghost commented Dec 25, 2018

Hey! I updated it a bit, anything you'd like me to change? I made it so the pixels aren't smoothed out so it has a Pokémon feel to it.

Pokémon Movement.zip

@4ian
Copy link
Owner

4ian commented Dec 25, 2018

Let me check :)

@4ian
Copy link
Owner

4ian commented Dec 25, 2018

Thanks for the update! Could you make the size of the game smaller? And replace the grass (and maybe path tile too) with some pixel art that is higher quality, like the character?
Also for the character and the fence, the size of the pixels are not the same:

image

"pixels" of the fence are smaller than pixel of the character.
I know that I'm a pain, but if we include an example with these things, this will reflect badly for new users on GDevelop as they will see it as something that is not polished. :)

@MercurioC
Copy link

MercurioC commented Dec 25, 2018

If I can add my two cents on the matter, it's not really a Pokemon movement example if there's not a tile-based movement in act 😄
You can freely move in the four main directions in your example, while in PK you mostly tap the arrows to change direction and hold to make one step at the time. Take a look at this example: https://www.youtube.com/watch?v=bwP4Mxb3vJA

@ghost
Copy link
Author

ghost commented Dec 27, 2018

Yeah, OK. I'll see what I can do. Thanks.

@GeeDot
Copy link

GeeDot commented Jan 25, 2019

Great work, Zeph-dev. I have been looking for something like this. But it is like MercurioC mentioned, one tap on the arrow key should move the player one tile unit, not continuously. The player always end up precisely in a tile instead of partially in it. Sorry if I am not making sense.

@ghost
Copy link
Author

ghost commented Jan 31, 2019

I know what you mean. It's kinda hard to make it work.

@GeeDot
Copy link

GeeDot commented Jan 31, 2019 via email

@zatsme
Copy link
Contributor

zatsme commented Jan 31, 2019

I'm currently working on an rpg type example with exactly this kind of movement 👍. Might be ready for the next beta 😁

@Lizard-13
Copy link
Contributor

Crap, I was going to do the same, so this example can be finally added, but with a cool idea behind for the style/theme.
Happily haven't started it yet, I'll check your example and if my way to do the movement and collision is different I will do it, two examples are better than one 😄

@4ian
Copy link
Owner

4ian commented Jan 31, 2019

Sure two examples are better than one 😄

@zatsme
Copy link
Contributor

zatsme commented Jan 31, 2019

I'm using a gridsize variable and moving the character until it's reached the cureent position + gridsize. If the player presses once then it moves until gridsize pixels is reached, if still pressed it adds another gridsize pixels and continues. This seems to work well.

To keep the player on a path or in an area I put an invisible object and check if the next movement will keep the player inside the collision bounds of the 'path' object.

I'll hopefully get the example up tonight or tomorrow so you can have a look 👍

@Lizard-13
Copy link
Contributor

I can't start to work on it in the next days anyway, so don't hurry for me please :)

@Wend1go
Copy link
Contributor

Wend1go commented Feb 1, 2019

That's funny, I also have an unpolished example of grid movement lying on my hard drive. ^^
I placed the sprites on the scene manually and converted their positions into a grid within a scene structure. Movement is done via lerp function iirc. Could probably polish it up at the weekend.
Three examples are better than two. 🤣

@zatsme
Copy link
Contributor

zatsme commented Feb 1, 2019

Here's first draft, I'm going to add a second indoor area and some interaction, in time could update with a dialog example when we have the new extension 👍

See Below!

Suggestions very welcome 😄

@zatsme
Copy link
Contributor

zatsme commented Feb 4, 2019

New zip below!

New example which reminds me about the screen guide in the editor is never the size when running the preview, is this a bug? See the GUI background which is supposed to be covering the bottom of the window/screen.

@4ian
Copy link
Owner

4ian commented Feb 4, 2019

@zatsme That's surely because by default, the width of the game is adjusted to the size of the window. Disable this option in the game properties and see how it goes.
It's also possible that the size of the window of the preview is not exactly the size of the game, might have to look into this.

@4ian
Copy link
Owner

4ian commented Feb 4, 2019

@zatsme I've tested and that looks really nice!
A few comments that could help improve the game and maybe at some point even make a starter with it! (I know that it's not finished though - but it's a great start).

  • The maps are a single sprite. While GD does not have a tiled map object (for now), I think it would still be useful to use a few tiled sprite to create the map:
    • Green background and roads are easily doable using tiled sprites objects
    • Same for walls, you can have tile sprites for user facing walls or side walls. Note that tiled sprites can be larger than a single tiles, so that there is a bit of variety when repeating the tiled image.
      image
    • In the same idea, this could be used as a "Forest" tiled sprites:
      image
    • You can have multiple "Forest1", "Forest2", "Forest3" objects to have different patterns for the forest.
    • You can also have a single sprite object, with one animation for each kind of tree/plant/grass/rocks, so that you can put a bunch of them and change the animation of instances in the properties
    • The red carpet could be a really good 9 patch ("Panel Sprite") object.
    • The decoration (tables, libraries on the wall, etc...) can also be sprites or maybe tiled sprites.
    • The idea of all of this is that even if GD is not tiled based, using multiple object allow to easily create different maps and explore things. It might be harder than using a tiled map object/editor BUT I think it's sufficient to start and do nice things.

Pretty sure people will love editing/creating new maps if we have multiple objects. :)

  • You've been using the condition "Always". As far as I see, it's useless, just put no conditions.
  • Events are copy-pasted between scenes: better using external events :)
  • Good usage of "Pause the scene and start XXX" 👍Rest of the events are pretty clear, putting a few groups/comments/external events might help to make this accessible to everyone.

What do you think? I think with a few improvements it could be a great starter.

@zatsme
Copy link
Contributor

zatsme commented Feb 4, 2019

I created the maps in tiled and exported to a image file, I intended to include the maps and tileset in the project so people could use tiled to change them. Because of this and no tiled support yet, I used the large images. Once we have tiled support then the problem dissapears! But for now it's probably best to change to sprites so as not to confuse users 🙄

I use 'Always' because it's obvious for beginners, which is the point IMHO?

I'll change to external events, add comments and make some extra sprites for the maps as you suggest so users can change the maps inside GD 👍

@4ian
Copy link
Owner

4ian commented Feb 4, 2019

But for now it's probably best to change to sprites so as not to confuse users 🙄

Yeah, I know it takes more time, but this also make maps easier to edit directly in GDevelop. It's more time to invest to create objects, but then it's fairly quick to edit maps.

I use 'Always' because it's obvious for beginners, which is the point IMHO?

Tutorials and games should generally avoid always - because a "no conditions" is exactly the same, faster for the user (you don't have to add an extra condition), faster to read (no conditions is grayed, so just by lookingat the color you know that there is no conditions for this event) and avoid a function call during the game so in theory it's faster than using "Always". Always is only there for completeness, to be potentially used with the "Or"/"And" special conditions. But apart from this it should never be used - it's almost 99.9% useless.

I'll change to external events, add comments and make some extra sprites for the maps as you suggest so users can change the maps inside GD 👍

Nice! Look forward to the changes!! Will be super helpful for people who would want to start working on a RPG like/tile based game :)

@zatsme
Copy link
Contributor

zatsme commented Feb 4, 2019

It's very hard to create a map with sprites and multiple anims, you can place the sprites and then go through the properties changing the anims but it's a long process.

A interim suggestion (not sure how easy it might be to implement?) until we have tiled support is:-

Have a tile place mode in current IDE, where the tile is visible to the user while being placed in the grid, and the ability to change the anim up/down with a keystroke, this would make it much easier to place tiles.

Also a Random mode, like Tiled, where you can place a tile and it will randomly select the anim to use.

If we had these two things it would greatly improve the user experience until Tiled support is available 😄

@4ian
Copy link
Owner

4ian commented Feb 4, 2019

Remember that you can ctrl/cmd + click to duplicate an instance, it's not a lot but can still be helpful to quickly duplicate and put a lot of instances with a given animation.

Have a tile place mode in current IDE, where the tile is visible to the user while being placed in the grid, and the ability to change the anim up/down with a keystroke, this would make it much easier to place tiles.

The thing is that these shortcuts would be specific to the Sprite objects, so this require more planning and proper architecture to handle all kind of objects to benefit from this.
But taking your notes! :)

@zatsme
Copy link
Contributor

zatsme commented Feb 4, 2019

If you are taking notes, then this is exactly what I mean...

tiled

The selected Sprite/Tile is attached to cursor and in grid system, click and you can paint with the tile. A random option would allow the sprites anim to be randomly selected for each painted grid square to produce the effect on the grass with flowers and rocks etc 😄

@4ian
Copy link
Owner

4ian commented Feb 4, 2019

Yup I see the idea. Note that this is not necessarily a good idea to even develop this for GDevelop for now, because it's bad for performance to be using so much little sprites - well it can works but the idea behind a tiled map object is to optimize the rendering a lot.
It's also why I suggest to use a bunch of tiled sprite, even for grass/plants/trees where you can use a semi random pattern with a tiled sprite. It's still fine to use sprites for some objects :)
But if this is to be done, this should be on a tiled map object, otherwise I'm afraid of people painting maps of thousands and thousands of sprites and then complaining of performance 😬

@blurymind
Copy link
Contributor

blurymind commented Feb 5, 2019 via email

@4ian
Copy link
Owner

4ian commented Feb 5, 2019

an active tool type interaction behavior with the scene editor

Yes, I'll add ability for extensions providing objects to have interactions directly on the scene editor if we come up with a working tiled map object :)

Ideally we could be using the official pixijs renderer for tiled, adopt it
to GD in some way. Fork it if we have to.

Any official/community supported renderer would be the way to go :) Even if it's not as full featured as other software, it's fine again to start simple. I would avoid forking anything because this is possibly a ticket for spending days and nights debugging/upgrading things. The less we have to do, the better we can concentrate on providing a great software.

I link the discussion here, let's continue here if we want to discuss about it :) #503

@ghost
Copy link
Author

ghost commented Feb 9, 2019

I'll leave that in the hands of you then. Good luck

@4ian
Copy link
Owner

4ian commented Feb 28, 2019

Do you think you'll have time for the suggestion I made or should I just go with what we have now?

@zatsme
Copy link
Contributor

zatsme commented Feb 28, 2019

I can finish it this weekend, I made most of the changes already, just some last bits to do. I tested the performance of the different ways to render the gfx... Was interesting, individual sprites for everything ran ok with the map sizes in use but far slower than using the original (whole map image), or groups of images in a tiled sprite (new design) which were both very fast and almost identical performance! 🤔

@4ian
Copy link
Owner

4ian commented Feb 28, 2019

Nice! How did you test the performance exactly?

But yeah, when using individual sprites, the GPU has to draw lots of small squares. When drawing the whole map it's faster, and when using tiled sprite it's just a few additional squares to render + some texture change - so performance should be nearly identical while keeping flexibility of designing the level :)

@zatsme
Copy link
Contributor

zatsme commented Feb 28, 2019

Nothing special, just the profiler 😊

@zatsme
Copy link
Contributor

zatsme commented Mar 3, 2019

Here you go, it's got a lot of your suggestions so is more instructive 😄

Zat RPG Example.zip

@4ian
Copy link
Owner

4ian commented Mar 8, 2019

Great job! Love the door that closes when you come back from the shop/hut! 😄
Still a few comments:

  • You're always using Pause the scene and start a new one. At some point, this will exhaust the computer memory and crash the game, as you're always create scene on top of a scene, which is on the top of another one. In a way, you're stacking scenes. Prefer:

    • Changing scene
    • Or better: pause the scene forest to start scenes that are "inside buildings". Then when you want to come out of the building, use "Stop and go back to previous scene". Finally, use some global variable to say to the original scene (i.e: forest) that you just came out of a building, so the player should be put back on its previous position (otherwise, the Forest scene will be unpaused, but the player will again be on the tile to go in the shop!* (see end of message for more info))
  • The way you detect is you want to enter in a building is using tiles. It's perfectly fine, but you're also using the direction of movement for this. I think it's fragile. If I change the map to have the exit of the shop on the right or the top, then I'm blocked in the shop (because according to events you have to walk in the bottom direction).

  • Finally, it's a bit related to my second point: you're handling in a single external event sheet all the movement of the input (which is fine) AND also the changes between scenes.
    This is becoming complex because you have to use same objects, like "Shop" to enter in the shop (that's fine) but also... to get out (weird huh?).

Instead, have common events that just handles movement in the external events sheets. And have a few events (as few as possible) inside each scene that do the logic specific to these scenes. For "Forest", it will be to trigger starting the shop or hut scenes when the player collides with Shop or Hut objects. For "Shop" or "Hut", it will be an event that, when the player collides with some invisible called "Exit", will then: 1) Set a global variable to say that getting out and 2) call "Stop the scene and go back to the previous one".

  • Note about going back to the previous scene: when you go back to a previous scene, it's a good idea to set, in an action just before, a global variable like to tell that the player just came out of a building (for example, set variable "PlayerJustExitedBuilding" to 1).
    Then, the Forest scene can verify that if this variable is 1. If yes: move the player on a tile a bit bottom (so that it does not collide with the entry anymore), set the animation so that he looks toward the bottom, and reset the variable to 0 (and reset any variable related to movement).
    (If you don't do this, the scene will start again at the exact same moment when you paused it. So events will be run, and the player, as it's colliding with a Hut or Shop object, will be sent back in the Hut or Shop)

Hope it's a bit clear!

@4ian
Copy link
Owner

4ian commented Mar 8, 2019

If you don't understand, I'll try to do it but have to find some time.
I believe that with more tiled sprites and some more generic events it could be a great starter.

I imagine that we could even create a set of events functions, that would be useful to create a RPG gameplay with a few events! (this will be part of the feature for sharing functions 😏).

@GeeDot
Copy link

GeeDot commented Mar 8, 2019 via email

@zatsme
Copy link
Contributor

zatsme commented Mar 8, 2019

hi guys, could u guys kick me out. I keep getting these emails. thanks

At the bottom of the email, mute the thread!

If you don't understand, I'll try to do it but have to find some time.
I believe that with more tiled sprites and some more generic events it could be a great starter.

I imagine that we could even create a set of events functions, that would be useful to create a RPG gameplay with a few events! (this will be part of the feature for sharing functions 😏).

I understand, been coding logic for years, but a bit lazy and not much time 😆 🤣

I'll try to do some more this weekend! 👍

@4ian
Copy link
Owner

4ian commented Jul 30, 2019

@zatsme if you have an updated project file about this somewhere, let me know :)

@4ian 4ian added the 👌good first issue Good issue if you want to start contributing to GDevelop label Feb 22, 2020
@4ian
Copy link
Owner

4ian commented Feb 22, 2020

This should be not too hard to finish and make in a real example, marking as a good first issue.

@zatsme
Copy link
Contributor

zatsme commented Feb 22, 2020

Hi 4ian, I wish I had time to make more examples for GD5 but not at this moment ☹️

The zip from 3/3/2019 above is the latest code I have 👍

Still watching progress though, this past year GD has really kicked on, great work all! Hopefully will be back having fun with GD soon 😃

Zat

@Bouh
Copy link
Collaborator

Bouh commented Oct 24, 2021

Closing of this issue, all examples are now on another repository.
If you still want to submit this example, please read this guide.

@Bouh Bouh closed this as completed Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
👌good first issue Good issue if you want to start contributing to GDevelop
Projects
None yet
Development

No branches or pull requests

8 participants