Watering some trees, the right trees. Instances.

Around the time of the previous post, I had no idea how I was going to allow for the creation of objects that share the same code, but not inherit each others ‘events/history’ from the moment of creation onwards allowing them to be unique. I suppose this is due to the fact that i’m a beginner with this whole thing but I have since figured out how to get things working perfectly in regards to this one problem.

INSTANCES AND LOCAL VARIABLES AHOY!

So previously when i wanted something to happen to an object, I was ‘calling’ it by its object name rather than the instance ID. This was a problem due to me not being able tell the game which exact tree I wanted something to happen to as they all share the same object name and code.

Then I found instances so I was able to draw each objects unique instance next to it and see if I could then call on that number rather than just the object. It would be much easier if these objects were static and never changed locations in the world but if they are grown by the player, then that introduces a whole lot of randomness in terms of where it will be placed etc. Also, the main problem I was having was due to getting in a habit of using global variables instead of local ‘disposable’ ones. I’ve learned to be a bit better at that now.

2

So even though these two are identical in terms of their code,sprite and object name, they both have a unique identifier to differentiate one from the other.

if you can ignore the temporary sprites which are just there to show growth over time, you can see below a very basic starting point for a system I’ve been working on where I wanted the player to be able to plant their own trees anywhere. I’ll improve this somewhat like I did with the first inventory system once I get the basics implemented.

Once those trees are grown they will have their own activity log unique to each one (unique to each of the object’s unique instance ID) showing world events impacting it. Also birds will randomly choose one as a home based on a number of factors as well as tons of other cool stuff.

Below, the growth process is sped up just to show the typical stages and the need to water them. The numbers can be ignored, they are there so that I can tell if things are working as they should. Can everyone also take a moment to look at the state of that watering can…

GIF

I had a bit of a problem with the water effect hitting the right plot of land due to the fact i’m not totally comfortable with particle systems. This watering can and rain are the only two times I’ve tried creating with particle systems.  Weirdly, the stuff i’d learned about instances and instance_nearest(x,y,objects) with the trees helped with getting the particle emitter to shoot water over the right area at the right time. I read other ways to do the same thing but it seemed way over my head for now so I just stuck to using what I knew. I can always improve it further down the line.

Wet soil

I’ve added dry soil which requires water in order to further the growth of a tree. This can be solved by either the weather being rainy, or a watering can / a similar tool.

When the soil receives  water it changes colour as you’d expect and also allows the plant / tree to progress in regards to growing. This can be seen in the below examples:

1

Comparing tree growth in watered soil to none-watered :

2

Rain obviously impacts the soil and trees the same way a watering can would but consistantly

3

I feel like the way I’ve made this work is a bit bodged. As I learn more about GM’s coding, i’ll try and improve it. I’ll need to have a look through it properly once i’ve slept and make sure nothing weird is happening.

Hopefully next blog will be more interesting. Just taken me a while to get this working as i’m still learning.

Basic Weather, Stat Tracking, Particle Systems

The idea that I had regarding per object inventories is harder than expected so there isn’t really much to post about.

I’ve added some rain and a house for some birds though! Still early and the puddle effect is all off but at least it exists!

Also started on a basic ‘Weekday’ system. Eventually to be upgraded into months / seasons.

I made a super basic system tracking stats for certain objects but I think this is the most difficult thing i’ve tried so far. No idea if I can even do it :/

2

This is a totally basic version of a tree interface showing basic data about anything that is and has happened to it during its ‘life’.

Will see how I get on trying to make this work.

Pets!

I’ve been trying to figure out how to have a pet system, I always liked the idea of that in games if they’re useful so thought it’d be a good thing to starting messing with.

cat
Temporary sprite / animation

As always the art is just some placeholder stuff. (dat building doe lolz)

GIF

So at the moment, this kitty randomly runs around playing but still ends up occasionally coming to the player. When the cat does, you’ll get a visual indicator of how the pet feels towards you. This is based on a few factors that i’m still looking to sort out properly.

2

I’ve also set up some ‘status bars’ that I thought might be good for seeing if things are working and also maybe for some future gameplay use. Pretty cool though! Currently toggled on and off with ‘C’.

22

Obviously if the cat runs out of food and/or water, it’ll die… or just disappear? Who knows!

Hopefully be able to make a few more visual indicators and link that to how the pet has been treated. I don’t really want it to be a chore to look after but at the same time i’m not sure if it should just exist.

Inventories, arrays, nightmares..

Really don’t think i’m smart enough to figure out a lot of the stuff to do with arrays and as it turns out, inventories that work as I want them to aren’t too easy for beginners to make.

I made 3 different versions, one that is shown in the previous post and another that was ‘meh’ in terms of functionality and now the one I have which is exactly what I wanted. At least for now.

Before

Manually displays global variable of ‘rose seed’ quantity but has no ‘slots’ (just writes the data to an X,Y coord) doesn’t use arrays and other items you pick up don’t have any way of knowing where to show their quantity and item type based on what else is in the inventory. Also can’t click and drag or empty your inventory without manually using each item in there.

1
The dirtiest inventory that you ever did see

After

Whoo! Now you can drag items around, drag items out of the inventory and get stacks on stacks without anyone questioning you! Those crappy sprite tho! It’s all temporary!

GIF
Moving things around and things..

Obviously need to change the look of things and improve it as the visuals I haven’t even spent any time on any of the art yet.

Lost all my progress, started again!

Long story short – lost all my ‘work’, starting again with a different engine and different theme for the game. Mainly posting here to keep track of my progress!

Here’s what I have so far after just under a week. (I haven’t made the mistake I made previously where I focused mainly on the art before the game mechanics. This time i’m focusing firstly on making the game systems and figuring out how to do what I want).

It will look a whole lot more basic than my last screenshots due to the fact that RPG maker allowed for the use of their preexisting systems and assets whereas with Game Maker Studio requires you to start completely from scratch.

This has meant I’ve been learning how to use the systems and built in code language which is really fun.

1

Top left you can see that the time is listed. This updates as time goes on. Also as you can see above i’ve made a really simple first version of an inventory that follows the player around and draws relative to current position.

2

Planting seeds happens as expected with growth over time which i’ve figured out recently!

3

Also there is a basic day/night cycle currently which will have a big impact on gameplay in the future.

Capture

Lastly, worked out how to actually backup my files…