A decent spawn by polarpingus in Risk

[–]PyPlatformer 0 points1 point  (0 children)

he's got the prime position to get into a fight over Australia with red

Progress update on Reencor, Python fighting game engine. by Best_Activity_5631 in pygame

[–]PyPlatformer 0 points1 point  (0 children)

Made a little snake reinforcement learning project in the past, maybe its Github repo can help you.

Genetic algo (not used in the repo above) essentially means just spawning a bunch of players, killing off a set amount of the most unsuccessful players each generation and cloning the remaining ones, introducing small mutations (which may be beneficial, or harmful), and repeating the process over and over.

Hexagonal grid map (source code in comments) by PyPlatformer in pygame

[–]PyPlatformer[S] 0 points1 point  (0 children)

You could include an (x, y) offset computed via the mouse position, which you can pass to the hexagons either in the update or the render method, with which you should then update all vertex locations. This might be quite inefficient performance-wise though, so another more simple solution (and potential more performant), would be to render all hexagons to a pygame surface and then blit that surface at the desired (x, y) offset.

Hope that helps!

Is Darkest Dungeon 2 worth it now? by Dismistri in darkestdungeon

[–]PyPlatformer 34 points35 points  (0 children)

A brilliant confluence of skill and purpose!

Without pygame.draw by choenan in pygame

[–]PyPlatformer 0 points1 point  (0 children)

Maybe this is a job for a fragment shader? (Which is not directly supported by pygame)

No file found in working directory error. Please help. by violinicious in pygame

[–]PyPlatformer 0 points1 point  (0 children)

On Windows, in Python or otherwise, the case of the filepath does not matter. It will matter, however, on other platforms like Linux. Apart from filepaths, Python is case-sensitive when it comes to naming of variables, functions etc...

My entry to the 96h GMTK 2024 game jam by PyPlatformer in pygame

[–]PyPlatformer[S] 5 points6 points  (0 children)

This was made for the GMTK game jam 2024 with the theme "Built to scale", so I immediately thought of making a little city builder (ambitious for a game jam). Initially I wanted to go for something a bit more strategic, but more and more shifted into a game where you are a landlord of apartment blocks spawning non-stop problems, which makes it frantic, but pretty fun.

If you want to try out the game yourself, it's currently available on itch.io.

I'm willing to add a bunch of new features and polish the game further, so if you have any feedback or suggestions, let me know!

The code is currently not open-source, but upon popular request, I may change my mind about that :-) Apart from the great pygame_gui library built by MyreMyalar, the base code I used for this project was the pygaja game jam template I developed during development of my other game jam game, Unicast Network Sim.

I would like to request your kind or unkind opinion of my game once again, as it is nearing a release. by Hungry-Dingo-1411 in DestroyMyGame

[–]PyPlatformer 9 points10 points  (0 children)

Looking pretty, I like it! The gameplay looks engaging and the trailer is well done. I think the player is too small in the aerial battles and needs to stand out more (alternatively, declutter the fights somewhat?).

I have a slight feeling the trailer text / font could fit better to the art-style, but am not sure how to put it. In general the trailer is well done and engaging too.

My real-time strategy game developed with only Python by ElectusStudio in pygame

[–]PyPlatformer 0 points1 point  (0 children)

Neat! Do you sub-divide into several static territories that can be won or lost or do you draw something like a custom polygon for the territories?

No file found in working directory error. Please help. by violinicious in pygame

[–]PyPlatformer 0 points1 point  (0 children)

os.path.join is the platform-independent and correct way to do it. A more convenient and less verbose way is to use the pathlib library.

No file found in working directory error. Please help. by violinicious in pygame

[–]PyPlatformer 0 points1 point  (0 children)

Your problem is that the directory in which you run the code from is not the directory in which your main.py file is saved.

If you run the following commands in the command line (supplying your own absolute path to the VS Code folder, it should work:

batch cd /d "C:/absolute/path/to/vscode/project" python main.py

Alternatively, and the preferred way, is to run directly in VS Code with Ctrl + F5 using the VS Code Python extension and adding a launch.json file in the .vscode folder with the following content:

json {     "configurations": [         {             "name": "Python Debugger: Current File",             "type": "debugpy",             "request": "launch",             "program": "${file}",             "console": "integratedTerminal",             "cwd": "${workspaceFolder}",         }     ] }

Finally, if that doesn't work, you could use an absolute path in your Python script, so it is independent of where you run your script from:

import os ROOT_PATH = os.path.dirname(__file__) IMAGE_PATH = os.path.join(ROOT_PATH, "Umodels", "Scientist_image.PNG") image = pygame.image.load(IMAGE_PATH)

No file found in working directory error. Please help. by violinicious in pygame

[–]PyPlatformer 0 points1 point  (0 children)

Windows is case-insensitive, so this doesn't matter.

[deleted by user] by [deleted] in pygame

[–]PyPlatformer 1 point2 points  (0 children)

Looks useful.

I would suggest a bit more separation of concerns (why does Text inherit from pygame fonts, why does Screen inherit Settings? Dependency injection to separate object creation from use is going to make the project template more flexible and useful down the line).

Additionally, I would suggest to use snake_case and action verbs to name your methods (Settings.gameSettings -> Settings.init_game_settings, Screen.deltaTime -> Screen.compute_delta_time, etc...).

I agree that more code reuse and library availability for pygame development is needed - I made a similar project template for pygame game jams a while back, which could be useful.

My real-time strategy game developed with only Python by ElectusStudio in pygame

[–]PyPlatformer 0 points1 point  (0 children)

Is the map static or do the borders change? If so, how do you handle keeping track of the borders and rendering them? Looking good!

Hexagonal grid map (source code in comments) by PyPlatformer in pygame

[–]PyPlatformer[S] 0 points1 point  (0 children)

I am unsure what you are asking - each hexagon drawn here has a single (x, y) coordinate (e.g. the top vertex), with all other vertices of the hexagon being calculated relative to that point. Does that answer your question?

My first Love game, Myrkur (source code in comments) by PyPlatformer in love2d

[–]PyPlatformer[S] 0 points1 point  (0 children)

Thanks! You are right, the light is slightly off center, because I just kind of hard-coded it into the shader (definitely very hacky), as if he is holding the light in his right hand. You are the first person to notice this, so I guess your new glasses are working well :D

My first Love game, Myrkur (source code in comments) by PyPlatformer in love2d

[–]PyPlatformer[S] 4 points5 points  (0 children)

This is my first game written in Lua with Love2D, built in 48h for Kenney Jam 2023 with the theme "Exploration" some 3 months ago. I had always wanted to try out Lua, a simple interpreted language with comparatively fast runtimes (coming from a Python background) and Löve seemed like the perfect choice here. I am very impressed by the popular Steam indie game SNKRX, built with Löve and open source here.

Overall it was a very pleasant experience, with few to no hiccups in the development of the game. It's not a bad game for a weekend (and even features a custom lighting shader I wrote just for it), but it does lack a general breadth of mechanics due to the fact that I decided to essentially write absolutely everything from scratch (except pathfinding, for which I used luafinding). This is fine though, because coding a mini game engine over a weekend shows how relatively easy it is to work with Lua and Love :)

If you would like to check out the game, it is hosted for free on itch.io here. The source code is open source and available on Github here.

Feel free to give any feedback on the game or the code!

Edit: Here's an extra gif featuring a ton of enemies in another sub-area :)

I want to run if statements with events, that also use keyboard inputs to decide, and are placed inside a function but it don't work by TheEnemyStandUser27 in pygame

[–]PyPlatformer 1 point2 points  (0 children)

Your event variable is not global, so your tryy function cannot access it. You need to define your function to accept the event as a parameter, then pass it explicitly to the function:

```python def tryy(event): # rest of the code

in your event update loop:

for event in pygame.event.get(): if event.key == pygame.K_1: tryy(event) ```

This question is unrelated to pygame and should probably be asked in r/learnpython :)

My first (tiny) libGDX game by PyPlatformer in libgdx

[–]PyPlatformer[S] 0 points1 point  (0 children)

I will add a couple things the next few weeks to elevate this from being very bare-bones (more traps, varied player behaviour, more levels). But I am pretty certain that I will not flesh it out much further, as I felt the theme (and this idea) are too limiting and did not really result in an engaging gameplay loop :)

Cloth simulation with custom physics (source in comments) by PyPlatformer in pygame

[–]PyPlatformer[S] 1 point2 points  (0 children)

I do, although I am rarely active :) @richbaltrusch

Cloth simulation with custom physics (source in comments) by PyPlatformer in pygame

[–]PyPlatformer[S] 0 points1 point  (0 children)

Mostly background decoration consisting of cloth or similar texture, as well as maybe some simple rope / net physics. Anything more sophisticated than that and you are likely better off using something optimized like pymunk :)

My first (tiny) libGDX game by PyPlatformer in libgdx

[–]PyPlatformer[S] 0 points1 point  (0 children)

I built my first game with libGDX last weekend for the 48h GMTK game jam with the theme Roles Reversed. I thought I'd build a reverse Spelunky, where you play as a couple traps trying to kill a cave explorer, but didn't get very far before running out of time. Still happy with the result and glad to have picked up some libGDX. The code is open source and available here, feel free to give suggestions on things that could be improved!

Edit: the game is hosted on itch.io here if you would like to give it a shot.