• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

255 Neutral

1 Follower

About RidiculousName

  • Rank

Personal Information

  • Interests
  1. Sharing My Random Map Generator

    I've made a very simple map generator as a demo for combat encounters in my game. I plan to have the trees and rocks be cover, while the player's bandits ambush a caravan on the road in the middle. Please, let me know what you think. Criticism is welcome. """ Generates a basic map for combat """ __Author__ = "RidiculousName" __date__ = "3/21/18" import pygame as pg import copy import random def createMap(width, height, trees, rocks, roadWidth): """ creates a combat map :param width: int; 20-60 width of map in squares :param height: int; 20-60 height of map in squares :param trees: int; 0 to (width*height)//5 # of trees in map :param rocks: int; 0 to (width*height)//5 # of rocks in map :param roadWidth: int; 0-10 width of road in map (if value=0, will not have a road) :return: tuple matrix of map """ # variable declarations mapMatrix = [] rowList = [0] * width treeLocations = [] rockLocations = [] colIndex = random.randint(0, height) rowIndex = random.randint(0, width) #error checking if trees > (width * height) // 3: print("ERROR: TOO MANY TREES") return 0 elif rocks > (width * height) // 3: print("ERROR: TOO MANY ROCKS") return 0 # create a blank map full of grass for i in range(height): row = copy.copy(rowList) mapMatrix.append(row) # add trees for i in range(trees): while (rowIndex, colIndex) in treeLocations: colIndex = random.randint(0, height - 1) rowIndex = random.randint(0, width - 1) mapMatrix[rowIndex][colIndex] = 1 treeLocations.append((rowIndex, colIndex)) # add rocks for i in range(rocks): while (rowIndex, colIndex) in treeLocations \ or (rowIndex, colIndex) in rockLocations: colIndex = random.randint(0, height - 1) rowIndex = random.randint(0, width - 1) mapMatrix[rowIndex][colIndex] = 2 rockLocations.append((rowIndex, colIndex)) # add the road if roadWidth > 0: ct = int(roadWidth // 2) road = int(height // 2) while ct > 0: mapMatrix[road + ct] = [3] * width mapMatrix[road - ct] = [3] * width ct -= 1 mapMatrix[road] = [3] * width # convert to tuple for i in range(height): mapMatrix[i] = tuple(mapMatrix[i]) # return return tuple(mapMatrix) def showMap(screen, mapMatrix): """ :param screen: pygame screen object images are blitted to this :param mapMatrix: list matrix contains the map matrix :return: none """ # variable declarations height = pg.display.Info().current_h width = pg.display.Info().current_w x_pos = 0 y_pos = 0 grass = pg.image.load("grass.png").convert() tree = pg.image.load("tree.png").convert() rock = pg.image.load("rock.png").convert() road = pg.image.load("road.png").convert() for i in range(len(mapMatrix)): for j in range(len(mapMatrix[i])): if mapMatrix[i][j] == 0: screen.blit(grass, [x_pos, y_pos]) elif mapMatrix[i][j] == 1: screen.blit(tree, [x_pos, y_pos]) elif mapMatrix[i][j] == 2: screen.blit(rock, [x_pos, y_pos]) elif mapMatrix[i][j] == 3: screen.blit(road, [x_pos, y_pos]) x_pos += 16 y_pos += 16 x_pos = 0 def main(): """ calls functions to allow the game to run """ # variable declarations done = False # initialize pygame pg.init() # make screen object size = (1600, 900) screen = pg.display.set_mode(size) # set window caption pg.display.set_caption("Bandit King") #manages FPS clock = pg.time.Clock() #creates map mapMatrix = createMap(30, 30, 140, 20, 2) while not done: # --- main event loop for event in pg.event.get(): if event.type == pg.QUIT: done = True # --- game logic # --- drawing code showMap(screen, mapMatrix) # --- update screen pg.display.flip() # --- limit to 60 FPS clock.tick(60) #print("height: ", pg.display.Info().current_h, "width: ", pg.display.Info().current_w) pg.quit() if __name__ == "__main__": main()
  2. Game Combat Mechanic Examples

    To answer your questions: 1: I'm going for both combat and management. Management will involve using stolen resources to build and upgrade facilities in your hideout. Occasionally moving your HQ (at the expense of time and loss of some loot/upgrades) to avoid it being found and destroyed. Positioning your raiding bands to areas depending distance from HQ, risk, type of goods, and amount of goods. I envision a starting player will have just one band, but as they grow they may gain as many as five. Both management and combat will be turn-based. The management aspect will be an overmap of the area surrounding your hideout where you can dispatch bands to prey on travelers, and a hideout screen that allows you build and upgrade your facilities. Combat will be seen from above. It will be at an aspect ratio like most of the older 2D Zelda games. Combat may be auto-resolved or fought out. Fighting between characters will usually be very short and bloody. characters will die often, and the player will have to rely on ranged characters to take out a good portion of the enemy at first. It will usually take just two or three turns/attacks to kill a character. The game will be 2D. 2: It's a traditional fantasy setting. I plan to take a few liberties with armament just to make things a little more interesting. I plan to add in a quality system for weapons armor and many types of generic goods once the game's basic structure has been finished. 3: The flow of the gameplay should be mostly combat, but with perhaps %20 to %30 of player time spent on the management aspect. Other than recuitment, and upgrading weapons/armor, I plan to have you focus more on keeping your bandits happy with booze and whores than healing them. Bandits may survive some minor wounds, but serious healing will very late game or not at all. Rather, your bandits will slowly spend their cut at your hideout or in a nearby town, and then, when they're broke again, they'll sign up for another "job". The game will determine the success of the bands you sent out at turns end. This will be determined by their leader's skills, the groups stealth ability, the cover the terrain provides, and whether the area you sent them to is well frequented. If they find a caravan you're given three choices, auto-resolve combat, manual combat, or to avoid. To aid making this choice, the caravan's type will be given along with some general information about its strength. There will be different types of caravans and caravans on different routes will tend to carry different items. "Caravan's" could be a single person, or a detachment of an army. 4: I plan to have a basic stat system in place. Raiding bands will vary in size between five and twenty-five men. I don't think it's necessary to have a lot of detail for them, and their stats will improve on their own. The player just controls character equipment and movement in combat. I want to make a stat system that improves based on use, not level. 5: I believe I have the basic knowledge. I need to learn more Pygame and random map generation, but at least as far as the math and logic goes, I think I can manage it. I don't really like Battle Brothers since I feel its combat system is not actually very deep, and yet almost it's entire focus is on combat. Thank you for your advice. You made me think about the game design in ways I hadn't before. I will try to reduce it as needed. I think right now I will focus on learning pygame and designing what I would call the "skeleton" of the game. Once I've got that written and programmed, I can focus on adding things. That's my plan anyway.
  3. 2D Random Map Generation

    I could definitely use a guide about making a general game project. I'll try to follow your bullet-points. I'm trying to make everything as simple as possible while still providing a framework I can build off of. I only know Python and C++. I'd consider doing the project in C++, but I don't want to learn a new language, as I'm pretty busy ATM. I originally chose Python because it's easier to develop with, and I'm more familiar with it. Assuming I couldn't find a guide, I planned to use either Pygame or Kivy for graphics. I'm worried though, since Pygame is a bit too in-depth for what I need, and Kivy is hard to find good information for. I'll look into the other engines you mentioned. I don't really know anything about them. I guess I am confused about what an engine is. I thought both Pygame and Kivy were just graphical libraries.
  4. 2D Random Map Generation

    I DID google a bunch of similar terms, but either came up with non-programming examples, or examples for 3D. Thank you, but I should've been more specific. I really need a guide, not just bits and pieces about generating random maps. Once I've got a good foundation I feel like I can start exploring different ways to do the same thing. Otherwise, I'll be out of my depth. I'm still a very new programmer.
  5. 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.
  6. Game Combat Mechanic Examples

    Well here's a bit more about my idea. I plan to make full-plate very expensive, rare, and difficult to sneak around in. Thus preventing bandits from taking full advantage of their ambushes, So far I've come up with the idea of making a few basic types of weapons and armor. Each is made of either copper, bronze, steel, mithril, or adamantium. Each has a quality level. Both of these will affect its price and level of protection. So the things that will affect whether your bandits come back with loot would be: Their physical stats (strength, dexterity, endurance, willpower, intelligence) Their equipment. Whether there are enough bandits to win in a fight, and a small enough number to go undetected until ready to ambush. This is why I want to know more about typical RPG systems.
  7. Undertale/ Doki Doki type system help

    I'm only familiar with Dok Doki, but it should be possible to have an if/then statement checking whether a file exists or not..
  8. Develop Portfolio More or Learn Integration?

    I would ask a mod to move this thread, as it seems to belong to the career development forum.
  9. Game Combat Mechanic Examples

    Thanks for the answer. I'll take a look at your links. Right now I say I'd like to try and keep it as simple as possible while still giving the player a sense of accomplishment. I'd like to easily be able to add complexity and depth as I continue development too. I'm a bit overwhelmed by my options at this point. I will continue working on it.
  10. Game Combat Mechanic Examples

    I'm asking something a bit different for this forum. I've noticed many questions in this forum ask something like, "is X a good idea?" What I'd like to see is examples of how other people did similar things to what I want to do, and maybe some suggestions for what would be best. Basically I'm trying to create a game where you play as a bandit leader, and you set up ambushes for various travelers, ala Robin Hood, but with a bit less giving to people other than yourself. The game I envision has you managing equipment, bandits, and location to increase the success of these ambushes. Therein lies the problem, I'm not sure how to set up a deep system like that. It's not that I lack ideas, but that I am unsure how to refine it down, and translate my idea into actual game mechanics. Part of it is, while I'm a fan of RPGs, I don't really know how they work. I've never exactly been a minmaxer and while I understand more armor is reduces damage, more attack increase hit-chance etc. I don't really understand how these systems work in detail, and I don't know how to find out. So my question is, how can I find out about these systems so I can modify them to suit what I want to do?
  11. Kivy Window Resizing Messes up Screen Formatting

    I'm sure I can get it with something like that. I just haven't been able to find anything on it. I might choose to just force the game to have one or two sizes.
  12. Kivy Window Resizing Messes up Screen Formatting

    Thank you! I am still searching for how to get the window height/width while the game's running, but your post helped.
  13. New questions?

    Don't learn C++ to make games. Learn programming if you enjoy programming. Use game-making software if you enjoy making games. C++ is a very difficult language to start with. All the programming languages you learn after your first are much easier to understand. Professionals use it because you can speed things up, but that is only nessecary for professional games. You won't be able to make those on your own. The best languages for a beginner to learn are probably C#, Python, and Javascript. Choose one and stick to it. Some good game-making software are Unity and GameMaker studio. I believe both allow a great deal of portability between different types of operating systems. To answer your second question, whatever you want. Note that learning a language by itself generally isn't enough to make a game. There are many, many more aspects. It's hard to give advice until we know more about your situation. Your post makes it sound like you are just beginning to write code. I would suggest not worrying about "portability", making your code run on other operating systems, until you are fairly experienced.
  14. I want to make it so the location and size of the buttons I use are changed to suit the background image when the screen is resized. Here is my code so far: """ Combines various .py files and allows the game to run. """ from kivy.app import App from kivy.uix.image import Image from kivy.config import Config from kivy.uix.button import Button from kivy.uix.floatlayout import FloatLayout class MainMenu(FloatLayout): def __init__(self, **kwargs): super(MainMenu, self).__init__(**kwargs) start_button = Button(pos=(25, 75), background_normal="Start.png", background_down="Start_Down.png", size_hint=(.1, .1)) load_button = Button(pos=(225, 75), background_normal="Load.png", background_down="Load_Down.png", size_hint=(.1, .1)) options_button = Button(pos=(425, 75), background_normal="Options.png", background_down="Options_Down.png", size_hint=(.150, .1)) quit_button = Button(pos=(708, 75), background_normal="Quit.png", background_down="Quit_Down.png", size_hint=(.1, .1)) background = Image(source="Main_Menu.png", pos=(0, 0)) self.add_widget(background) self.add_widget(start_button) self.add_widget(load_button) self.add_widget(options_button) self.add_widget(quit_button) class BanditKing(App): def build(self): self.title = "Bandit King" self.icon = "Window_Icon.png" return MainMenu() def main(): Config.set("graphics", "width", "1600") Config.set("graphics", "height", "900") Config.write() BanditKing().run() if __name__ == "__main__": main() Here is what it should always look like. Here is what it does: You might be able to tell the "Options" button is slightly off line with the other buttons. I would also like to know how to fix that.
  15. Scrolling 2D Background

    Thanks guys.
  • Advertisement