Jump to content
  • Advertisement

Search the Community

Showing results for tags 'Python'.

The search index is currently processing. Current results may not be complete.


More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • Audio
    • Music and Sound FX
  • Business
    • Business and Law
    • Career Development
    • Production and Management
  • Game Design
    • Game Design and Theory
    • Writing for Games
    • UX for Games
  • Industry
    • Interviews
    • Event Coverage
  • Programming
    • Artificial Intelligence
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Engines and Middleware
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
  • Archive

Categories

  • Audio
  • Visual Arts
  • Programming
  • Writing

Categories

  • Game Dev Loadout
  • Game Dev Unchained

Categories

  • Game Developers Conference
    • GDC 2017
    • GDC 2018
  • Power-Up Digital Games Conference
    • PDGC I: Words of Wisdom
    • PDGC II: The Devs Strike Back
    • PDGC III: Syntax Error

Forums

  • Audio
    • Music and Sound FX
  • Business
    • Games Career Development
    • Production and Management
    • Games Business and Law
  • Game Design
    • Game Design and Theory
    • Writing for Games
  • Programming
    • Artificial Intelligence
    • Engines and Middleware
    • General and Gameplay Programming
    • Graphics and GPU Programming
    • Math and Physics
    • Networking and Multiplayer
  • Visual Arts
    • 2D and 3D Art
    • Art Critique and Feedback
  • Community
    • GameDev Challenges
    • GDNet+ Member Forum
    • GDNet Lounge
    • GDNet Comments, Suggestions, and Ideas
    • Coding Horrors
    • Your Announcements
    • Hobby Project Classifieds
    • Indie Showcase
    • Article Writing
  • Affiliates
    • NeHe Productions
    • AngelCode
  • Topical
    • Virtual and Augmented Reality
    • News
  • Workshops
    • C# Workshop
    • CPP Workshop
    • Freehand Drawing Workshop
    • Hands-On Interactive Game Development
    • SICP Workshop
    • XNA 4.0 Workshop
  • Archive
    • Topical
    • Affiliates
    • Contests
    • Technical
  • GameDev Challenges's Topics
  • For Beginners's Forum
  • Unreal Engine Users's Unreal Engine Group Forum
  • Unity Developers's Forum
  • Unity Developers's Asset Share

Calendars

  • Community Calendar
  • Games Industry Events
  • Game Jams
  • GameDev Challenges's Schedule

Blogs

There are no results to display.

There are no results to display.

Product Groups

  • Advertisements
  • GameDev Gear

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me


Website


Role


Twitter


Github


Twitch


Steam

Found 57 results

  1. Hi, Hi, i saw examples for pytmx with pygame but nothing for pyglet on python 3. except those two lines: Load with pyglet images (experimental): from pytmx.util_pyglet import pyglet_image_loader tmx_data = load_pygame('map.tmx') somebody can give me a little bit more ? do you have better tools to work on tmx files ?
  2. Mock-objects are useful if you use external editor like VSCode or IDE like PyCharm, Eclipse and so on, because you can use DI (Dependency Injection) and you can debug your code logic with breakpoints. For example, we want to add a cube on a scene: bpy.ops.mesh.primitive_cube_add() You can read about this API function in the documentation: primitive_cube_add Create a work folder with the name: mock-object-for-primitive_cube_add-api Open Blender and safe project in the work folder Open "Scripting" tab in Blender from the top menu Open your favourite Python editor. I use VSCode. You can read about how to use VSCode with Python here Python in Visual Studio Code Create a file with the name "main.py" in you favourite Python editor. This file must be placed in the "mock-object-for-primitive_cube_add-api" folder Write in the "main.py": print("hello from blender") You can run this code from command line terminal or from VSCode internal terminal. Press in VSCode "Ctrl+`" and enter command: python main.py You will see in the console terminal this message: If you opened "Scripting" tab in Blender you will see an ability to open Python script in Blender. Click on the "Open" Button in Blender Script editor inside Blender Choose the "main.py" file and click the "Open Text Block" button Open the Blender console terminal. For this you need to select in the main menu of Blender "Window" and select "Toggle System Console" Run the "main.py" script from Blender. For this you need to place your mouse pointer on text area and press "Alt+P" button You will see this message in the Blender console terminal: If you will change a code in an external editor like VSCode you need to reload in the Blender text editor. For this you need to press the "Alt+R+R" button You need to add only one file: "main.py" to the Blender text editor. Another files you need place in the work directory: "mock-object-for-primitive_cube_add-api" Copy this code to the "main.py" file: main.py import bpy import sys import os # Get a path to the directory with .blend file # There are the scripts in this directory dir = os.path.dirname(bpy.data.filepath) # Is the directory in the list with included # directories? If no, include the directory if not dir in sys.path: sys.path.append(dir) import object3d_service # Reload module. It is necessary if you use # external editor like VSCode # For reloading module you need to press in # Blender: Alt + R + R import importlib importlib.reload(object3d_service) # Note. You do not need to open all scripts in Blender, # you need only this script from object3d_service import Object3DService def main(): objectService = Object3DService() objectService.create_cube() if __name__ == "__main__": main() This is another files that you need to copy to the work directory: test_blender_service.py import unittest from unittest.mock import MagicMock from object3d_service import Object3DService class BlenderServiceTest(unittest.TestCase): def test_myTest(self): # Arrange object3DService = Object3DService() object3DService.blender_api.create_cube = MagicMock("create_cube") # Act object3DService.create_cube() # Assert object3DService.blender_api.create_cube.assert_called_once() object3d_service.py from blender_api import BlenderAPI class Object3DService: def __init__(self): self.blender_api = BlenderAPI() def create_cube(self): self.blender_api.create_cube() blender_api.py import bpy class BlenderAPI: def create_cube(self): bpy.ops.mesh.primitive_cube_add() Delete a default cube from the scene. Now you can reload Blender code editor ("Alt+R+R") and run the code ("Alt + P"). You will see that a new code will be created: You can set breakpoints in "main.py" because there are mock-object for Blender API. And you can run unit tests using this command: python -m unittest You will see that unit test are passed.
  3. I have this weird glitch: whenever I am pressing the D-pad on the 360 controller, the A-button also lights up. The A-button returns a 1 for positive and 0 for negative. It returns a 1 whenever I am pressing the 4 directions of the D-pad. Does anyone know how to solve this? By the way, I am using Linux Mint, Python 3.6.8, and Pygame 1.9.6 The source code for the class is below: # Xbox 360 Controller class class xpad: def __init__(self, pygameJoystick, deadzone): self.ID = pygameJoystick.get_id() pygameJoystick.init() self.deadzone = deadzone # Xbox 360 Controller Name self.name = pygameJoystick.get_name() # Thumbsticks self.left_thumb = ( self.dead( pygameJoystick.get_axis(0) ), self.dead( pygameJoystick.get_axis(1) ) ) self.right_thumb = ( self.dead( pygameJoystick.get_axis(3) ), self.dead( pygameJoystick.get_axis(4) ) ) # Triggers self.left_trig = pygameJoystick.get_axis(2) self.right_trig = pygameJoystick.get_axis(5) # Buttons self.A = pygameJoystick.get_button(0) self.B = pygameJoystick.get_button(1) self.X = pygameJoystick.get_button(2) self.Y = pygameJoystick.get_button(3) self.LB = pygameJoystick.get_button(4) self.RB = pygameJoystick.get_button(5) self.Back = pygameJoystick.get_button(6) self.Start = pygameJoystick.get_button(7) # The center button self.Guide = pygameJoystick.get_button(8) # When you click the thumbsticks self.left_stick = pygameJoystick.get_button(9) self.right_stick = pygameJoystick.get_button(10) # The directional pad on the 360 controller self.dpad = pygameJoystick.get_hat(0) # Limits a particular axis # by returning its value if it is # within the set deadzone. Returns a # zero otherwise. def dead(self, axis): if ( abs(axis) >= self.deadzone ): return axis return 0 # Returns a string that can be sent over the network # and be easily interpreted by an Arduino. def serialized(self): packet = ("<%i,%s,%s,%s,%s>")%( self.ID, hex( int(256*( (self.left_thumb[0]+1)/2 )) ), hex( int(256*( (self.left_thumb[1]+1)/2 )) ), hex( int(256*( (self.right_thumb[0]+1)/2 )) ), hex( int(256*( (self.right_thumb[1]+1)/2 )) ) ) return packet Here is how you can visualize the problem: import pygame import xinput # Define some colors. BLACK = pygame.Color('black') WHITE = pygame.Color('white') # This is a simple class that will help us print to the screen. # It has nothing to do with the joysticks, just outputting the # information. class TextPrint(object): def __init__(self): self.reset() self.font = pygame.font.Font(None, 20) def tprint(self, screen, textString): textBitmap = self.font.render(textString, True, BLACK) screen.blit(textBitmap, (self.x, self.y)) self.y += self.line_height def reset(self): self.x = 10 self.y = 10 self.line_height = 15 def indent(self): self.x += 10 def unindent(self): self.x -= 10 pygame.init() # Set the width and height of the screen (width, height). screen = pygame.display.set_mode((500, 700)) pygame.display.set_caption("ECU Robotics Xbox 360 Controller Layout") # Loop until the user clicks the close button. done = False # Used to manage how fast the screen updates. clock = pygame.time.Clock() # Initialize the joysticks. pygame.joystick.init() # Get ready to print. textPrint = TextPrint() # -------- Main Program Loop ----------- while not done: # # EVENT PROCESSING STEP # # Possible joystick actions: JOYAXISMOTION, JOYBALLMOTION, JOYBUTTONDOWN, # JOYBUTTONUP, JOYHATMOTION for event in pygame.event.get(): # User did something. if event.type == pygame.QUIT: # If user clicked close. done = True # Flag that we are done so we exit this loop. elif event.type == pygame.JOYBUTTONDOWN: print("Joystick button pressed.") elif event.type == pygame.JOYBUTTONUP: print("Joystick button released.") # # DRAWING STEP # # First, clear the screen to white. Don't put other drawing commands # above this, or they will be erased with this command. screen.fill(WHITE) textPrint.reset() # Initialize the connected Xbox controller xpad = xinput.xpad(pygame.joystick.Joystick(0), 0.25) # Print the controller's name textPrint.tprint( screen, xpad.name ) textPrint.tprint(screen, '') # Begin main body... textPrint.indent() # Thumbsticks... textPrint.tprint( screen, ("Left Thumbstick (x, y): %.3f, %.3f")%( xpad.left_thumb[0], xpad.left_thumb[1] ) ) textPrint.tprint( screen, ("Right Thumbstick (x, y): %.3f, %.3f")%( xpad.right_thumb[0], xpad.right_thumb[1] ) ) textPrint.tprint(screen, '') # Triggers... textPrint.tprint( screen, ("Left Trigger: %.3f")%( xpad.left_trig ) ) textPrint.tprint( screen, ("Right Trigger: %.3f")%( xpad.right_trig ) ) textPrint.tprint(screen, '') # Buttons... textPrint.tprint(screen, ("A Button: %i")%(xpad.A)) textPrint.tprint(screen, ("B Button: %i")%(xpad.B)) textPrint.tprint(screen, ("X Button: %i")%(xpad.X)) textPrint.tprint(screen, ("Y Button: %i")%(xpad.Y)) textPrint.tprint(screen, ("Left Bumper: %i")%(xpad.LB)) textPrint.tprint(screen, ("Right Bumper: %i")%(xpad.RB)) textPrint.tprint(screen, ("Start Button: %i")%(xpad.Start)) textPrint.tprint(screen, ("Back Button: %i")%(xpad.Back)) textPrint.tprint(screen, ("Guide Button: %i")%(xpad.Guide)) textPrint.tprint(screen, ("Left Stick Click: %i")%(xpad.left_stick)) textPrint.tprint(screen, ("Right Stick Click: %i")%(xpad.right_stick)) textPrint.tprint(screen, ("D-Pad: %i, %i")%(xpad.dpad[0], xpad.dpad[1])) # Serialized packet... textPrint.tprint(screen, '') textPrint.tprint(screen, 'Format: <ID, J1.x, J1.y, J2.x, J2.y>') textPrint.tprint(screen, ("%s")%(xpad.serialized())) # # ALL CODE TO DRAW SHOULD GO ABOVE THIS COMMENT # # Go ahead and update the screen with what we've drawn. pygame.display.flip() # Limit to 20 frames per second. clock.tick(60) # Close the window and quit. # If you forget this line, the program will 'hang' # on exit if running from IDLE. pygame.quit()
  4. I'm doing well with my first game that I'm making and I had no problem with understanding, how to do something but now, I don't even have a clue about How to accelerate my character. def move(rect, movement, tiles): collision_types = {'top': False, 'bottom': False, 'right': False, 'left': False} rect.x += movement[0] hit_list = collision_test(rect, tiles) for tile in hit_list: if movement[0] > 0: rect.right = tile.left elif movement[0] < 0: rect.left = tile.right collision_types['left'] = True rect.y += movement[1] hit_list = collision_test(rect, tiles) for tile in hit_list: if movement[1] > 0: rect.bottom = tile.top collision_types['bottom'] = True elif movement[1] < 0: rect.top = tile.bottom collision_types['top'] = True return rect, collision_types player_movement = [0, 0] if moving_right == True: player_movement[0] += 2 if moving_left == True: player_movement[0] -= 2 player_movement[1] += vertical_momentum vertical_momentum += 0.3 if vertical_momentum > 3: vertical_momentum = 3 player_rect, collisions = move(player_rect, player_movement, tile_rects) if collisions['bottom'] == True: air_timer = 0 vertical_momentum = 0 else: air_timer += 1 display.blit(player_img, (player_rect.x - scroll[0], player_rect.y - scroll[1])) for event in pygame.event.get(): # event loop if event.type == QUIT: pygame.quit() sys.exit() if event.type == KEYDOWN: if event.key == K_RIGHT: moving_right = True if event.key == K_LEFT: moving_left = True if event.key == K_UP: if air_timer < 6: vertical_momentum = -5 if event.type == KEYUP: if event.key == K_RIGHT: moving_right = False if event.key == K_LEFT: moving_left = False screen.blit(pygame.transform.scale(display, WINDOW_SIZE), (0, 0)) pygame.display.update() clock.tick(60) (initial speed is 2 player_movement[0] += 2). I'm thinking about doing it like - > add 0.1 speed every 0.1 second or every 1 tick so it smooth and make it maximally reach to 5. I was looking at car related games but they are to different.
  5. Hi everyone ! I'm new on this forum and english is not my native language but i'll do my best to express myself. Briefly, i'm a 25 years old chemistry student and passionate of programming. I've touched several languages (HTML & CSS, Java, C, C++ and python) and it allowed me to find the best language with the one I've a good feeling and I can quickly understand everything. So, since 2 years I'm programming in Pythont to practice myself but I've been always intrested in making a small cool game (not thoses clone of tetris, snake or whatever arcade game cauz' I never liked them sorry). I'm more intrested in dungeons crawler or Die and retry games in narrow levels. We see a bunch of thoses games on the market (Hotline miami, enter the gungeon or more recently streets of rogue etc...). I've coded on Python with the Pygame library, a couple of lines that allow me to display images, move them, handle keyboard inputs and sounds. But, I was thinking about trying to handle collisions between entities that are represented as sprites with an ID and coordinates (x and y). There are various possibilities to check collision, but my question is more focused on a global concept. Imagine we have a large background where there is a blue entity on the left side and a bunch (100 maybe) of red entities on the right side with random moves. If my blue entity start to move to the right, what I want is to determine when this blue entity hit a red one. The first idea that come is to check every step if the blue one collide with the other 100 red ones. In terms of computer calculating it's unforgivable to do that. So how can we optimized the collision detection to reduce this calculation time but without loosing efficiency if multiple things collide at the same time ? I've try to think by myself and I found that maybe a solution will be to do a coordinates comparison between entities. If the red one is farther than X units then you skip the collision algorithm and you go to the next entities. It's probably faster than the first idea but i'm sure there is a more efficient way to do that, so I'm asking for help with this problem. Thank you in advance for any kind of help that you can bring to me.
  6. I’ve fully used this tutorial : https://www.youtube.com/watch?v=5q7tmIlXROg&t=124s So the code is the same as his ( download in description) and I wanted to go further with it and get to map-making with I really like but first of all, I need some more mechanics. I’ve actually asked Him How to do it and I fully understand that https://imgur.com/a/kw4iAAx same with dash with would simply be the player moving like twice speed in x direction but I don’t know How to write it down. 1 line of code will really help and I will really appreciate if you get me more depth on Why you did it that way so I don’t have to keep asking questions about it. 👌
  7. Dream City: Classified – "Survival Code" (Proof of Concept Framework) Episodic, 3D 3rd Person Co-op, Action Adventure Puzzle Plat-former Hey everyone I'm looking for a PART TIME/ HOBBYIST PROGRAMMER with an interest in the "Afropunk" style and culture. He would need a understanding of Unity python and marching cubes, or a willingness to learn it. I'm a character artist/ animator dabbling in coding and while starting to develop this game myself I just realized I don't have the time. I need help. I need a team. Hopefully some what passionate, but any little bit will help. You covering the coding would free me up to do more art, animation and character design, (and find more guys). The game is a procedural puzzle game, which aims to make all of the 5 (or more) characters on screen use different methods of traversal and fighting styles. The more characters in the party the more complicated the puzzles get. The players need to work together to survive (Dark Souls combat difficulty). There are charts, diagrams, and examples of each with assets I've already created, and a frame work you just need to stitch together. But don't fear, this is a "BY THE EPISODE PROJECT", each of which will be individually Kickstarter'd. Once you sign on we will begin to understand one another's work habits, schedules, etc. while we make this FRAMEWORK. The framework is what we CROWD FUND for support to make the first episode. If there is anyone out there interested in... Bringing more diversity to Indie games Working with an unique horror adventure world (World Anvil WIP) Working with an committed artist (who understands coding) and a remote growing team Developing a tight development plan, with passive income contracts: Patreon, product sales, (micros) and of course Revenue sharing Interested in working on a co-op TRINE ~like game mixed with DARK SOULS Willing to grow with this me/(us) as this company takes off. Lets make a dream worth dreaming. (Contact with questions)
  8. Hello, I am Programmer & Pixel Artist who has jumped on and off both hobbies over the years. I have experience with c++, python, and java. I've also done a little bit of web programming as well. I consider myself decent with OOP basics and problem solving. So far I've worked well on teams and think I can fit in on most environments. My favorite types of games are puzzles games or games with puzzles focus but It doesn't matter what I work on I'm interested regardless. I'm looking to do this as a contributor and continue the programming side of my hobby and if applicable the pixel artist too. I'm looking for a group where I can conveniently contribute work but it won't live or die without me. Contact me by private message or by my discord. Vinn (Pound)7922
  9. Hi guys, I just joined the forum today. I am currently enrolled in a game programming program. I have never programmed before. so first semester for me was specially hard as I had trouble understanding many of the concept. I have gotten advice from some experienced programmer to try learning python first as it would make learning c++ little bit easier. I like to read programming books make my own notes and work on problems from textbook also. I am still learning and struggling but its fun as I want to work in the game industry. Would you guys recommend any advice to beginner like me cause I would like to be better at game programming and make my dream game someday. Thank you for reading my post.
  10. ProtoZero

    ASCII Sandbox Game

    I've been working on a simple ASCII sandbox game about survival. The code is very primitive because I just whipped it up in a few hours, but the concept seems like it could be interesting. It's written in Python and if you want to run it I recommend using either the file enclosed or running the code in 32 bit (It runs very slow on IDLE). Tell me what you think! Thanks. PS : The filename is "MINECRAFT2" because it was based off of my previous attempt at a Minecraft clone. MINECRAFT2.lnk Oh, sorry I just realized I posted this in the wrong community.
  11. tip15 = 0 tip20 = 0 price = input ("how much did your meal cost?") tip15 = int (price) * .15 tip20 = int (price) * .2 print ("A 20% tip would be ",tip20," and a 15% tip would be",tip15) input () I wrote a tipper program for an exercise. It's a simple program and it took 20mins to write including several bug fixes, where I had to go back to looking through the textbook and a few glances at my first program, before I got it running properly. I made the usual noob mistakes - since I've tackled many different languages, I had to figure out if I needed to declare variables. I also got the variable on the wrong side of the equals sign, then I forgot to include commas in my print statement for the variables. I also forgot to state that the variable was an integer. Finally, I forgot to use brackets and then incorrectly included the calculation inside the brackets. Eventually, I figured all of this out and came up with the above seemingly simple program. And it works! I'm still not using comments, but I'll fix that when I start writing longer programs.
  12. So it took one day to write and bug fix. Then another day to go through guesswork and figuring it out - to get the program to work. I haven't got up to while loops in the book, so it took a while - a few errors before I got it working. And I certainly haven't got as far as def methods, so using them was difficult and problematic. But I wanted my program to be complete with an exit option. import random def end_game(): end_message = ("game over") print (end_message) def game(): againPlay = "y" while againPlay == "y": nmCookie = random.randrange(5) begin = input ("cookie time, open your fortune cookie") if nmCookie < 1: print ("you are going to die someday") againPlay = input ("Still hungry") elif nmCookie == 1: print ("you just ate a cookie") againPlay = input ("Still hungry") elif nmCookie == 2: print ("you are going to eat another cookie") againPlay = input ("Still hungry") elif nmCookie == 3: print ("you like cookies") againPlay = input ("Still hungry") elif nmCookie == 4: print ("you will have a gargantuan legacy") againPlay = input ("Still hungry") else: end_game() game () end_game ()
  13. Tazbird

    Projectile Dominion: Ending Screen

    From the album: MissileCommandChallenge2018

    The ending screen from my 2018 Missile Command Challenge submission
  14. Tazbird

    Projectile Dominion: Title Screen

    From the album: MissileCommandChallenge2018

    The title screen to my 2018 Missile Command Challenge submission
  15. I'M interested in programming tools (For animation, UI, etc). Can anyone suggest me the resources where I can start learning or which technologies I need achive it. Thanks, Rakshit
  16. Hello I am trying to create a grid of images in pyglet and python and I am not sure where exactly I am going wrong. The goal is for it to be a Breakout/Arkanoid clone. The problem I am having is getting the brick images to display in a grid. Here is the code that as far as I can tell, should place the bricks in the correct position. class Brick(): def __init__(self, space): # Create the list to hold different sprite bricks and load images self.batch = pyglet.graphics.Batch() self.brick_images = ['brick1.png', 'brick2.png'] self.brick_sprites = [] # 1 out of 5 chance to drop a power pill self.chance_to_drop = 1 # Set the images anchor point to its center and create sprites for i in range(len(self.brick_images)): img = pyglet.image.load(self.brick_images[i]) img.anchor_x = img.width // 2 img.anchor_y = img.height // 2 self.brick_sprites.append(pyglet.sprite.Sprite(img)) for x in range(7): for y in range(7): self.body = pymunk.Body(body_type=pymunk.Body.KINEMATIC) # The position where each pymunk body will be placed self.body.position = x * 100 + 75, y * 30 + 340 self.brick_type = random.randint(0, len(self.brick_sprites) - 1) if self.brick_type == 0: sprite = self.brick_sprites[0] # Set the sprite to the same position as the pymunk body sprite.set_position(self.body.position.x, self.body.position.y) sprite.batch = self.batch elif self.brick_type == 1: sprite = self.brick_sprites[1] sprite.set_position(self.body.position.x, self.body.position.y) sprite.batch = self.batch self.shape = pymunk.Segment(self.body, (0, 0), (50, 0), 6) self.shape.elasticity = 0.80 self.shape.collision_type = collision_types['brick'] space.add(self.body, self.shape) handler = space.add_collision_handler(collision_types['brick'], collision_types['ball']) handler.separate = self.remove_brick So what I am trying to accomplish is have 7 rows of 7 bricks. As far as I can see the sprites are being created in the loop, but when I run the program only 2 bricks are being displayed. I am sure there is something wrong with the way I am looping but honestly just cannot see where I am going wrong. I have spent some time, trying to see the error but simply cannot see where I am going wrong. I can see that the pyglet brick sprites are NOT being set to the correct x, y of the pymunk body, even though, using the same formula for the player paddle object lines up the sprite perfectly. #Set the sprite to pymunk object position self.image = pyglet.image.load('paddle.png') self.image.anchor_x = self.image.width // 2 self.image.anchor_y = self.image.height // 2 self.sprite = pyglet.sprite.Sprite(self.image, x=self.position.x, y=self.position.y) I am very confused with this one and I just hope I have explained everything clearly enough. Thank you for any help or assistance in any way.
  17. Hi, I have an online multiplayer RPG maze game which I built in NodeJS. It is quite simple. Uses socket.io. Single threaded application so I don't have to worry about race conditions such as two users attempting to take the same object at the same time. The client sends in messages, which are processed by the gameserver and alter the player/world state, query the MySQL database, and broadcasting messages to all the other players and also updating things in the MySQL database. In the last month I have been learning python and I would like to port my game to Python as I think it will be better suited. Doing some research I have found many suggest using Twisted Python so this is the route I am going to take. I wondered if anyone could give me some suggestions for a basic framework of how I would handle the problem of race conditions when moving to an environment where things are operating in parallel, especially with regard the querying and updating of the state in the MySQL. If at all possible I wondered if there are any open source implementations of an MMO architecture using Twisted Python that I could look through that dealt with these issues. Thank you for your time reading this
  18. RidiculousName

    2D Random Map Generation

    I want to make a random map generator in python 3, but I have no idea how to do it. Could someone recommend me a good starting point? What I want to make is a flat 2D overworld-map with roads, rivers, settlements, farmlands, forests, and plains. I don't want to model specific buildings. This is just for a game I'm making where I'd like the player to be able to travel from point to point.
  19. Bob Dylan

    Applying Impulse

    I have a circle class which has the following attributes: center, radius, old position, acceleration, mass, and restitution. I then apply impulse resolution as per this link: https://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-the-basics-and-impulse-resolution--gamedev-6331. Here is the code, implementing that, along with my velocity verlet implementation (this is necessary as it explains why I change the values of the old positions of the circles near the end of the impulseScalar method): def doVerletPosition(self): diffPos = (self.center).subtract(self.oldPos) aggregatePos = diffPos.add(self.center) ATT = (self.accel).scalarMult(dt**2) e = ATT.add(aggregatePos) return e def doVerletVelocity(self): deltaD = ((self.center).subtract(self.oldPos)) return deltaD.scalarMult(1/dt) def impulseScalar(self,other): isCollision = self.collisionDetection(other) collisionNormal = isCollision[0] if(isCollision[1] == True): relativeVelocity = (other.doVerletVelocity()).subtract(self.doVerletVelocity()) normDirecVel = relativeVelocity.dotProduct(collisionNormal) restitution = -1-(min(self.restitution,other.restitution)) numerator = restitution * normDirecVel impulseScalar = numerator/(self.invMass + other.invMass) impulse = collisionNormal.scalarMult(impulseScalar) selfVel = (self.doVerletVelocity()) otherVel = other.doVerletVelocity() selfVelDiff = impulse.scalarMult(self.invMass) otherVelDiff = impulse.scalarMult(other.invMass) selfVel = selfVel.subtract(selfVelDiff) otherVel = otherVel.subtract(otherVelDiff) self.oldPos = (self.center).subtract(selfVel) other.oldPos = (other.center).subtract(otherVel) It would help if you accepted the vector methods as correct on face value, and I think that they are named well enough to allow you to figure out what they do, however I can paste them in aswell. My main problem is that when I run this, it registers that a collision has happened, yet the values position of the second circle do not change. How would I go about fixing this, as it seems that I am implementing the calculations correctly. The values of the first and second circle is: center = Vector(0,0) radius = 3 oldPos = Vector(0,0) accel = Vector(0,0) mass = 1 restitution = 0.5 center2 = Vector(0,4.2) radius2 = 1 oldPos2 = Vector(0,4.21) accel2 = Vector(0,-1) mass2 = 1 restitution2 = 0.7 What it returns is here: (it returns the position of the centers) 0.0 0.0 0.0 4.1896 0.0 0.0 0.0 4.178800000000001 0.0 0.0 0.0 4.167600000000001 0.0 0.0 0.0 4.1560000000000015 0.0 0.0 0.0 4.144000000000002 0.0 0.0 0.0 4.131600000000002 0.0 0.0 0.0 4.118800000000003 0.0 0.0 0.0 4.1056000000000035 0.0 0.0 0.0 4.092000000000004 0.0 0.0 0.0 4.078000000000005 0.0 0.0 0.0 4.063600000000005 0.0 0.0 0.0 4.048800000000006 0.0 0.0 0.0 4.033600000000007 0.0 0.0 0.0 4.018000000000008 0.0 0.0 0.0 4.002000000000009 0.0 0.0 0.0 3.9856000000000096 INTERSECTION 0.0 0.0 0.0 3.9688000000000105 INTERSECTION 0.0 0.0 0.0 3.9516000000000115 INTERSECTION 0.0 0.0 0.0 3.9340000000000126 So when it prints INTERSECTION, surely, the stationary circle must change position, if the impulseScalar method is correct, (as it seems to be (as it follows what is said on that link). Even if I let it run for longer, the stationary circle still does not move.