Skip to content

Commit ab7ef00

Browse files
Merge pull request #8 from jacuzzicoding/v0.0.3
V0.0.3
2 parents e250a45 + daa0088 commit ab7ef00

18 files changed

Lines changed: 3644 additions & 50 deletions

Game1.cs

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
using System; //need to add this for exception handling
12
using Microsoft.Xna.Framework;
23
using Microsoft.Xna.Framework.Graphics;
34
using Microsoft.Xna.Framework.Input;
5+
using MyIslandGame.Core;
46
using MyIslandGame.States;
57

68
namespace MyIslandGame
@@ -39,7 +41,7 @@ protected override void LoadContent()
3941
_spriteBatch = new SpriteBatch(GraphicsDevice);
4042

4143
// Create and add game states
42-
var playingState = new PlayingState(this, _stateManager); // Fix the constructor call - use only the parameters required for your PlayingState constructor
44+
var playingState = new PlayingState(this, _stateManager);
4345
_stateManager.AddState<PlayingState>(playingState);
4446

4547
// Set the initial state
@@ -59,10 +61,21 @@ protected override void Update(GameTime gameTime)
5961

6062
protected override void Draw(GameTime gameTime)
6163
{
62-
// Draw the current state
63-
_stateManager.Draw(gameTime, _spriteBatch);
64-
65-
base.Draw(gameTime);
64+
try
65+
{
66+
GraphicsDevice.Clear(Color.CornflowerBlue);
67+
68+
// Draw the current state
69+
_stateManager.Draw(gameTime, _spriteBatch);
70+
71+
base.Draw(gameTime);
72+
}
73+
catch (Exception ex)
74+
{
75+
// Log the exception
76+
System.Diagnostics.Debug.WriteLine($"Draw error: {ex.Message}\n{ex.StackTrace}");
77+
// Optionally reset states or take recovery actions
78+
}
6679
}
6780
}
6881
}

README.md

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
An island-based survival and ecosystem simulation game where players explore procedurally generated islands, interact with evolving wildlife, gather resources, and build structures. Built with MonoGame and C#.
44

5-
![Current Version](https://img.shields.io/badge/version-0.0.2--alpha-blue)
5+
![Current Version](https://img.shields.io/badge/version-0.0.3--alpha-blue)
66
![License](https://img.shields.io/badge/license-MIT-green)
77
![Status](https://img.shields.io/badge/status-early%20development-orange)
88

@@ -19,7 +19,7 @@ MyIslandGame combines resource management with deep ecosystem simulation. Your a
1919

2020
## Current State
2121

22-
The game is in early development (v0.0.2-alpha). Current features include:
22+
The game is in early development (v0.0.3-alpha). Current features include:
2323
- Entity Component System architecture
2424
- Basic movement and collision detection
2525
- Simple rendering of placeholder graphics
@@ -28,7 +28,10 @@ The game is in early development (v0.0.2-alpha). Current features include:
2828
- Camera system with zoom and player following
2929
- Tile-based procedural map generation
3030
- Day/night cycle with visual effects
31-
- Simple UI framework and debug display
31+
- Resource system with different resource types
32+
- Environmental objects (trees, rocks, bushes) with harvesting mechanics
33+
- Inventory system with hotbar
34+
- Resource gathering with tools
3235

3336
See the [RELEASE_NOTES.md](RELEASE_NOTES.md) for detailed information about the current version.
3437

@@ -45,10 +48,17 @@ See the [RELEASE_NOTES.md](RELEASE_NOTES.md) for detailed information about the
4548
- Basic UI framework with debug information
4649
- Player movement and world boundaries
4750

48-
### v0.0.3 (Planned)
49-
- Simple ecosystem with basic entities
50-
- Resource gathering mechanics
51-
- Inventory system
51+
### v0.0.3 (Released)
52+
- Resource system with different resource types
53+
- Environmental objects (trees, rocks, bushes) with regrowth
54+
- Inventory system with hotbar and UI
55+
- Resource gathering mechanics with tools
56+
57+
### v0.0.4 (Planned)
58+
- Crafting system for creating tools and items
59+
- Building mechanics for player structures
60+
- Basic ecosystem with animals and plants
61+
- More environmental variety and biomes
5262

5363
### Future
5464
- Entity evolution system
@@ -79,6 +89,10 @@ dotnet run
7989

8090
### Controls
8191
- **WASD/Arrow Keys**: Move player
92+
- **E**: Toggle inventory
93+
- **1-9**: Select hotbar slots
94+
- **Mouse Wheel**: Cycle through hotbar
95+
- **Left Click**: Gather resources / Use selected item
8296
- **+/-**: Zoom in/out camera
8397
- **T**: Speed up time (5x)
8498
- **R**: Reset time to 8:00 AM
@@ -98,7 +112,7 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
98112
## Acknowledgments
99113

100114
- MonoGame community
101-
- Inspiration from games like Stardew Valley, Animal Crossing, and Don't Starve
115+
- Inspiration from games like Stardew Valley, Animal Crossing, and Vintage Story
102116

103117
---
104118

RELEASE_NOTES.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# MyIslandGame Release Notes
2+
3+
## v0.0.3-alpha (March 2, 2025)
4+
5+
### New Features
6+
7+
#### Resource System
8+
- Added `Resource` class with ID, name, description, category, and properties
9+
- Implemented `ResourceManager` for managing resource definitions
10+
- Created resource categories: Organic, Mineral, and Environmental
11+
- Added 12 initial resource types including wood, stone, berries, seeds, etc.
12+
- Created placeholder textures for all resources
13+
14+
#### Environmental Objects
15+
- Added `EnvironmentalObjectComponent` for interactive world objects
16+
- Created object types: trees, rocks, and bushes with unique behaviors
17+
- Implemented growth stages and visual changes based on harvesting
18+
- Added resource regrowth over time based on in-game time
19+
- Integrated environmental objects with world generation
20+
21+
#### Inventory System
22+
- Implemented `Inventory` and `InventorySlot` classes for item storage
23+
- Added `InventoryComponent` for player inventory management
24+
- Created hotbar selection system with number keys and scrolling
25+
- Implemented item stacking and management
26+
- Added basic item types (Resource, Tool) with inheritance
27+
28+
#### Resource Gathering
29+
- Created `GatheringSystem` for handling resource collection
30+
- Implemented tool-specific gathering (axe for trees, pickaxe for rocks)
31+
- Added tool durability system
32+
- Created visual feedback when resources are gathered
33+
- Integrated gathering with the inventory system
34+
35+
### UI Improvements
36+
- Added inventory UI with hotbar display
37+
- Implemented inventory toggle (E key)
38+
- Created item display with quantity indicators
39+
- Added selection highlighting for current hotbar slot
40+
41+
### Technical Improvements
42+
- Extended ECS with new components and systems
43+
- Added `PlayerComponent` to identify the player entity
44+
- Created `EnvironmentalObjectFactory` for easily creating world objects
45+
- Improved input handling for inventory management
46+
- Added integration between multiple systems
47+
48+
### Known Issues
49+
- Tool acquisition is limited (will be addressed in v0.0.4)
50+
- No crafting system yet to utilize gathered resources
51+
- Art assets are simple placeholder shapes
52+
- No visual confirmation when something can be interacted with
53+
- Limited feedback when inventory is full
54+
- Some environmental objects might spawn in inaccessible locations
55+
56+
### Controls
57+
- **WASD/Arrows**: Move player
58+
- **E**: Toggle inventory
59+
- **1-9**: Select hotbar slot
60+
- **Mouse Wheel**: Cycle through hotbar
61+
- **Left-Click**: Gather resources / Use selected item
62+
- **+/-**: Zoom camera
63+
- **T**: Fast-forward time
64+
- **R**: Reset time to 8:00 AM
65+
- **ESC**: Quit game
66+
67+
## v0.0.2-alpha (February 15, 2025)
68+
69+
### New Features
70+
71+
#### Camera System
72+
- Implemented camera following with smooth tracking
73+
- Added zoom functionality using +/- keys
74+
- Added screen clamping to world boundaries
75+
- Created camera transformation for proper rendering
76+
77+
#### World Generation
78+
- Added tile-based map system
79+
- Implemented procedural generation for maps
80+
- Created different tile types (grass, water, sand, stone)
81+
- Added properties for passable/impassable tiles
82+
83+
#### Day/Night Cycle
84+
- Created time management system
85+
- Implemented day/night visual transitions
86+
- Added ambient light color changes
87+
- Created time display and controls
88+
89+
### Technical Improvements
90+
- Fixed collision detection precision
91+
- Added boundary checks for player movement
92+
- Improved entity rendering with depth sorting
93+
- Fixed Vector2 modification issues
94+
95+
### Controls
96+
- **WASD/Arrows**: Move player
97+
- **+/-**: Zoom camera in/out
98+
- **T**: Speed up time (5x)
99+
- **R**: Reset time to 8:00 AM
100+
- **ESC**: Quit game
101+
102+
## v0.0.1-alpha (January 20, 2025)
103+
104+
### Initial Features
105+
106+
#### Technical Foundation
107+
- Set up MonoGame with .NET 8.0
108+
- Created basic game loop
109+
- Implemented window and graphics initialization
110+
111+
#### Core Systems
112+
- Entity Component System (ECS) architecture
113+
- Game state management
114+
- Input handling system with action mapping
115+
116+
#### Basic Gameplay
117+
- Simple player movement with WASD/arrow keys
118+
- Collision detection
119+
- Obstacle creation for testing
120+
121+
### Technical Notes
122+
- Requires MonoGame 3.8.1 or later
123+
- Built with .NET 8.0
124+
- Mac users need to install freetype6 library

Source/Core/Resources/Resource.cs

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
using System;
2+
using Microsoft.Xna.Framework;
3+
using Microsoft.Xna.Framework.Graphics;
4+
5+
namespace MyIslandGame.Core.Resources
6+
{
7+
/// <summary>
8+
/// Represents a game resource that can be collected, stored, and used in crafting.
9+
/// </summary>
10+
public class Resource
11+
{
12+
/// <summary>
13+
/// Gets the unique identifier for this resource.
14+
/// </summary>
15+
public string Id { get; }
16+
17+
/// <summary>
18+
/// Gets the display name of the resource.
19+
/// </summary>
20+
public string Name { get; }
21+
22+
/// <summary>
23+
/// Gets the description of the resource.
24+
/// </summary>
25+
public string Description { get; }
26+
27+
/// <summary>
28+
/// Gets the category of the resource.
29+
/// </summary>
30+
public ResourceCategory Category { get; }
31+
32+
/// <summary>
33+
/// Gets the maximum number of resources that can be stacked in a single inventory slot.
34+
/// </summary>
35+
public int MaxStackSize { get; }
36+
37+
/// <summary>
38+
/// Gets or sets the texture used to represent this resource in the UI and world.
39+
/// </summary>
40+
public Texture2D Icon { get; set; }
41+
42+
/// <summary>
43+
/// Initializes a new instance of the <see cref="Resource"/> class.
44+
/// </summary>
45+
/// <param name="id">The unique resource identifier.</param>
46+
/// <param name="name">The display name of the resource.</param>
47+
/// <param name="description">The description of the resource.</param>
48+
/// <param name="category">The resource category.</param>
49+
/// <param name="maxStackSize">The maximum stack size.</param>
50+
public Resource(string id, string name, string description, ResourceCategory category, int maxStackSize)
51+
{
52+
Id = id ?? throw new ArgumentNullException(nameof(id));
53+
Name = name ?? throw new ArgumentNullException(nameof(name));
54+
Description = description ?? throw new ArgumentNullException(nameof(description));
55+
Category = category;
56+
MaxStackSize = Math.Max(1, maxStackSize);
57+
}
58+
59+
/// <summary>
60+
/// Determines whether this resource can stack with another resource.
61+
/// </summary>
62+
/// <param name="other">The other resource to check.</param>
63+
/// <returns>True if the resources can stack, otherwise false.</returns>
64+
public bool CanStackWith(Resource other)
65+
{
66+
return other != null && Id == other.Id;
67+
}
68+
69+
/// <summary>
70+
/// Creates a placeholder texture for this resource.
71+
/// </summary>
72+
/// <param name="graphicsDevice">The graphics device used to create the texture.</param>
73+
/// <returns>A placeholder texture.</returns>
74+
public Texture2D CreatePlaceholderTexture(GraphicsDevice graphicsDevice)
75+
{
76+
// Create a simple colored square based on resource category
77+
int size = 32;
78+
Texture2D texture = new Texture2D(graphicsDevice, size, size);
79+
Color[] data = new Color[size * size];
80+
81+
// Choose color based on resource category
82+
Color color = Category switch
83+
{
84+
ResourceCategory.Organic => new Color(139, 69, 19), // Brown
85+
ResourceCategory.Mineral => new Color(169, 169, 169), // Gray
86+
ResourceCategory.Environmental => new Color(65, 105, 225), // Royal Blue
87+
_ => Color.White
88+
};
89+
90+
// Fill the texture with the category color
91+
for (int i = 0; i < data.Length; i++)
92+
{
93+
// Create a border of darker pixels
94+
int x = i % size;
95+
int y = i / size;
96+
if (x == 0 || y == 0 || x == size - 1 || y == size - 1)
97+
{
98+
data[i] = new Color(color.R / 2, color.G / 2, color.B / 2);
99+
}
100+
else
101+
{
102+
data[i] = color;
103+
}
104+
}
105+
106+
texture.SetData(data);
107+
return texture;
108+
}
109+
}
110+
111+
/// <summary>
112+
/// Enumeration of resource categories.
113+
/// </summary>
114+
public enum ResourceCategory
115+
{
116+
/// <summary>
117+
/// Organic resources like wood, leaves, and fruits.
118+
/// </summary>
119+
Organic,
120+
121+
/// <summary>
122+
/// Mineral resources like stone, sand, and ores.
123+
/// </summary>
124+
Mineral,
125+
126+
/// <summary>
127+
/// Environmental resources like water, soil, and snow.
128+
/// </summary>
129+
Environmental
130+
}
131+
}

0 commit comments

Comments
 (0)