Show, e a mecânica de combate, já desenhou algo? Possui algum conceito já trabalhado?

Estou na parte visual primeiro, em relação ao personagem, depois vou criar a parte do combate.

Eu nem pensei como posso começar a fazer isso sabe, vc havia comentado pra fazer essa parte do lado do servidor mas eu não consigo pensar como faria isso.

Se for multiplayer, primeira coisa é aprender a trabalhar com sockets, Dê uma pesquisada também para entender como funciona a teoria da coisa. Se for apenas Singleplayer, esquece tudo que falamos sobre servidor, só vai ser um game simples do lado do cliente. Usei esse propmt no ChatGPT, pode usar também para testar alguns conceitos isolados se precisar. > **Create an example game in python with pygame lib. Game multiplayer client and server side in python** **server.py** ```py import socket import threading # Server configuration host = '127.0.0.1' port = 55555 # Create a socket server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) server.bind((host, port)) server.listen() # List to store connected clients clients = [] def broadcast(message, client_socket): for client in clients: if client != client_socket: try: client.send(message) except: clients.remove(client) def handle_client(client): while True: try: message = client.recv(1024) broadcast(message, client) except: # Remove the client if disconnected clients.remove(client) break def main(): print(f"Server is listening on {host}:{port}") while True: client, address = server.accept() print(f"Accepted connection from {address}") # Add the client to the list clients.append(client) # Start a new thread to handle the client client_thread = threading.Thread(target=handle_client, args=(client,)) client_thread.start() if __name__ == "__main__": main() ``` **client.py** ```py import socket import threading import pygame # Client configuration host = '127.0.0.1' port = 55555 # Initialize Pygame pygame.init() # Set up the screen WIDTH, HEIGHT = 600, 400 screen = pygame.display.set_mode((WIDTH, HEIGHT)) pygame.display.set_caption("Chat Client") # Colors WHITE = (255, 255, 255) BLACK = (0, 0, 0) # Fonts font = pygame.font.Font(None, 36) # Input box input_rect = pygame.Rect(10, 350, 480, 25) input_color = pygame.Color('lightskyblue3') input_text = "" # Create a socket client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect((host, port)) def receive(): while True: try: message = client.recv(1024).decode('utf-8') print(message) # Display the message on the console for now except: print("An error occurred!") client.close() break def draw_input_box(): pygame.draw.rect(screen, input_color, input_rect, 0) pygame.draw.rect(screen, BLACK, input_rect, 2) text_surface = font.render(input_text, True, BLACK) screen.blit(text_surface, (input_rect.x + 5, input_rect.y + 5)) def main(): receive_thread = threading.Thread(target=receive) receive_thread.start() clock = pygame.time.Clock() running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False elif event.type == pygame.KEYDOWN: if event.key == pygame.K_RETURN: # Send the message to the server client.send(input_text.encode('utf-8')) input_text = "" elif event.key == pygame.K_BACKSPACE: input_text = input_text[:-1] else: input_text += event.unicode screen.fill(WHITE) draw_input_box() pygame.display.flip() clock.tick(30) client.close() if __name__ == "__main__": main() ```
Eu quero muito que seja online, mas tem muita coisa pra fazer ainda, tem muito sprite pra desenhar, mas por enquanto vou fazer algo pequeno, offline, e depois escalar, e sim eu realmente preciso deixar pronto pra ficar online. Preciso pensar na arquitetura que vou levar esse projeto, as vezes eu acho que o código ta ficando muito "feio" e queria melhorar nisso, mas sem experiência fica um pouco foda.