development #12
@ -1,9 +1,8 @@
|
|||||||
import pygame
|
import pygame
|
||||||
|
|
||||||
from settings import SCREEN_WIDTH, SCREEN_HEIGHT
|
from settings import SCREEN_WIDTH, SCREEN_HEIGHT
|
||||||
from survival.camera import Camera
|
|
||||||
from survival.components.inventory_component import InventoryComponent
|
from survival.components.inventory_component import InventoryComponent
|
||||||
from survival.game_map import GameMap
|
from survival.game.game_map import GameMap
|
||||||
from survival.generators.building_generator import BuildingGenerator
|
from survival.generators.building_generator import BuildingGenerator
|
||||||
from survival.generators.player_generator import PlayerGenerator
|
from survival.generators.player_generator import PlayerGenerator
|
||||||
from survival.generators.resource_generator import ResourceGenerator
|
from survival.generators.resource_generator import ResourceGenerator
|
||||||
|
@ -13,7 +13,7 @@ class DecisionTree:
|
|||||||
self.vec = None
|
self.vec = None
|
||||||
|
|
||||||
def build(self, depth: int):
|
def build(self, depth: int):
|
||||||
path = os.path.join("..", "data.txt")
|
path = os.path.join("../..", "data.txt")
|
||||||
|
|
||||||
samples = list()
|
samples = list()
|
||||||
results = list()
|
results = list()
|
@ -6,7 +6,7 @@ from survival.components.direction_component import DirectionChangeComponent
|
|||||||
from survival.components.moving_component import MovingComponent
|
from survival.components.moving_component import MovingComponent
|
||||||
from survival.components.position_component import PositionComponent
|
from survival.components.position_component import PositionComponent
|
||||||
from survival.components.resource_component import ResourceComponent
|
from survival.components.resource_component import ResourceComponent
|
||||||
from survival.enums import Direction
|
from survival.game.enums import Direction
|
||||||
from survival.esper import World
|
from survival.esper import World
|
||||||
|
|
||||||
|
|
@ -4,8 +4,8 @@ from matplotlib import pyplot as plt
|
|||||||
|
|
||||||
from survival.components.learning_component import LearningComponent
|
from survival.components.learning_component import LearningComponent
|
||||||
from survival.components.position_component import PositionComponent
|
from survival.components.position_component import PositionComponent
|
||||||
from survival.enums import Direction
|
from survival.game.enums import Direction
|
||||||
from survival.graph_search import Action
|
from survival.ai.graph_search import Action
|
||||||
|
|
||||||
|
|
||||||
class LearningUtils:
|
class LearningUtils:
|
@ -1,4 +1,4 @@
|
|||||||
from survival.enums import Direction
|
from survival.game.enums import Direction
|
||||||
|
|
||||||
|
|
||||||
class DirectionChangeComponent:
|
class DirectionChangeComponent:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from survival.enums import Direction
|
from survival.game.enums import Direction
|
||||||
|
|
||||||
|
|
||||||
class PositionComponent:
|
class PositionComponent:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from survival.image import Image
|
from survival.game.image import Image
|
||||||
|
|
||||||
|
|
||||||
class SpriteComponent:
|
class SpriteComponent:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from survival.biomes.biome_preset import BiomePreset
|
from survival.game.biomes.biome_preset import BiomePreset
|
||||||
|
|
||||||
|
|
||||||
class BiomeData:
|
class BiomeData:
|
@ -1,7 +1,7 @@
|
|||||||
import random
|
import random
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from survival.tile import Tile
|
from survival.game.tile import Tile
|
||||||
|
|
||||||
|
|
||||||
class BiomePreset:
|
class BiomePreset:
|
@ -1,10 +1,10 @@
|
|||||||
from survival.components.position_component import PositionComponent
|
from survival.components.position_component import PositionComponent
|
||||||
from survival.components.resource_component import ResourceComponent
|
from survival.components.resource_component import ResourceComponent
|
||||||
from survival.entity_layer import EntityLayer
|
from survival.game.entity_layer import EntityLayer
|
||||||
from survival.esper import World
|
from survival.esper import World
|
||||||
from survival.graph_search import graph_search
|
from survival.ai.graph_search import graph_search
|
||||||
from survival.settings import AGENT_VISION_RANGE
|
from survival.settings import AGENT_VISION_RANGE
|
||||||
from survival.tile_layer import TileLayer
|
from survival.game.tile_layer import TileLayer
|
||||||
|
|
||||||
|
|
||||||
class GameMap:
|
class GameMap:
|
@ -6,7 +6,7 @@ import pygame
|
|||||||
class Image:
|
class Image:
|
||||||
def __init__(self, filename='', pos=(0, 0), scale=1, surface=None):
|
def __init__(self, filename='', pos=(0, 0), scale=1, surface=None):
|
||||||
if surface is None:
|
if surface is None:
|
||||||
self.texture = pygame.image.load(os.path.join('..', 'assets', filename)).convert_alpha()
|
self.texture = pygame.image.load(os.path.join('../', 'assets', filename)).convert_alpha()
|
||||||
else:
|
else:
|
||||||
self.texture = surface
|
self.texture = surface
|
||||||
self.image = self.texture
|
self.image = self.texture
|
@ -1,6 +1,6 @@
|
|||||||
from survival.generators.tile_generator import TileGenerator
|
from survival.generators.tile_generator import TileGenerator
|
||||||
from survival.image import Image
|
from survival.game.image import Image
|
||||||
from survival.tile import Tile
|
from survival.game.tile import Tile
|
||||||
|
|
||||||
|
|
||||||
class TileLayer:
|
class TileLayer:
|
@ -3,7 +3,7 @@ import pygame.font
|
|||||||
from survival import settings
|
from survival import settings
|
||||||
from survival.components.inventory_component import InventoryComponent
|
from survival.components.inventory_component import InventoryComponent
|
||||||
from survival.generators.resource_type import ResourceType
|
from survival.generators.resource_type import ResourceType
|
||||||
from survival.image import Image
|
from survival.game.image import Image
|
||||||
|
|
||||||
|
|
||||||
class UserInterface:
|
class UserInterface:
|
@ -3,10 +3,10 @@ import random
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import List
|
from typing import List
|
||||||
|
|
||||||
from survival.biomes.biome_data import BiomeData
|
from survival.game.biomes.biome_data import BiomeData
|
||||||
from survival.biomes.biome_preset import BiomePreset
|
from survival.game.biomes.biome_preset import BiomePreset
|
||||||
from survival.biomes.noise import generate_noise
|
from survival.game.biomes.noise import generate_noise
|
||||||
from survival.tile import Tile
|
from survival.game.tile import Tile
|
||||||
|
|
||||||
|
|
||||||
class TileGenerator:
|
class TileGenerator:
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
from survival import esper, PlayerGenerator, ResourceGenerator, SCREEN_WIDTH, SCREEN_HEIGHT, GameMap, \
|
from survival import esper, PlayerGenerator, ResourceGenerator, SCREEN_WIDTH, SCREEN_HEIGHT
|
||||||
Camera
|
|
||||||
from survival.components.consumption_component import ConsumptionComponent
|
from survival.components.consumption_component import ConsumptionComponent
|
||||||
from survival.components.direction_component import DirectionChangeComponent
|
from survival.components.direction_component import DirectionChangeComponent
|
||||||
from survival.components.inventory_component import InventoryComponent
|
from survival.components.inventory_component import InventoryComponent
|
||||||
@ -10,6 +9,8 @@ from survival.components.position_component import PositionComponent
|
|||||||
from survival.components.resource_component import ResourceComponent
|
from survival.components.resource_component import ResourceComponent
|
||||||
from survival.components.time_component import TimeComponent
|
from survival.components.time_component import TimeComponent
|
||||||
from survival.esper import World
|
from survival.esper import World
|
||||||
|
from survival.game.camera import Camera
|
||||||
|
from survival.game.game_map import GameMap
|
||||||
from survival.generators.resource_type import ResourceType
|
from survival.generators.resource_type import ResourceType
|
||||||
from survival.settings import PLAYER_START_POSITION, STARTING_RESOURCES_AMOUNT
|
from survival.settings import PLAYER_START_POSITION, STARTING_RESOURCES_AMOUNT
|
||||||
from survival.systems.automation_system import AutomationSystem
|
from survival.systems.automation_system import AutomationSystem
|
||||||
|
@ -4,7 +4,7 @@ from survival import esper
|
|||||||
from survival.components.on_collision_component import OnCollisionComponent
|
from survival.components.on_collision_component import OnCollisionComponent
|
||||||
from survival.components.moving_component import MovingComponent
|
from survival.components.moving_component import MovingComponent
|
||||||
from survival.components.position_component import PositionComponent
|
from survival.components.position_component import PositionComponent
|
||||||
from survival.enums import Direction
|
from survival.game.enums import Direction
|
||||||
|
|
||||||
|
|
||||||
class CollisionSystem(esper.Processor):
|
class CollisionSystem(esper.Processor):
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
from survival import esper
|
from survival import esper
|
||||||
from survival.components.position_component import PositionComponent
|
from survival.components.position_component import PositionComponent
|
||||||
from survival.components.sprite_component import SpriteComponent
|
from survival.components.sprite_component import SpriteComponent
|
||||||
from survival.user_interface import UserInterface
|
from survival.game.user_interface import UserInterface
|
||||||
|
|
||||||
|
|
||||||
class DrawSystem(esper.Processor):
|
class DrawSystem(esper.Processor):
|
||||||
|
@ -10,9 +10,9 @@ from survival.components.moving_component import MovingComponent
|
|||||||
from survival.components.position_component import PositionComponent
|
from survival.components.position_component import PositionComponent
|
||||||
from survival.components.learning_component import LearningComponent
|
from survival.components.learning_component import LearningComponent
|
||||||
from survival.components.time_component import TimeComponent
|
from survival.components.time_component import TimeComponent
|
||||||
from survival.graph_search import Action
|
from survival.ai.graph_search import Action
|
||||||
from survival.learning_utils import get_state, LearningUtils
|
from survival.ai.learning_utils import get_state, LearningUtils
|
||||||
from survival.model import LinearQNetwork, QTrainer
|
from survival.ai.model import LinearQNetwork, QTrainer
|
||||||
|
|
||||||
MAX_MEMORY = 100_000
|
MAX_MEMORY = 100_000
|
||||||
BATCH_SIZE = 1000
|
BATCH_SIZE = 1000
|
||||||
|
@ -3,8 +3,8 @@ from survival.components.direction_component import DirectionChangeComponent
|
|||||||
from survival.components.movement_component import MovementComponent
|
from survival.components.movement_component import MovementComponent
|
||||||
from survival.components.moving_component import MovingComponent
|
from survival.components.moving_component import MovingComponent
|
||||||
from survival.components.position_component import PositionComponent
|
from survival.components.position_component import PositionComponent
|
||||||
from survival.enums import Direction
|
from survival.game.enums import Direction
|
||||||
from survival.graph_search import graph_search, Action
|
from survival.ai.graph_search import graph_search, Action
|
||||||
from survival.systems.input_system import PathfindingComponent
|
from survival.systems.input_system import PathfindingComponent
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user