Shifting music when the hero enters a new area on the same map?

Started by Dianthus, November 29, 2019, 12:11:35 PM

Previous topic - Next topic
Hi guys. I am not native in english. I am new to the solarus engine and I currently doing a personal project. Its basically a reimagination of links awakening. How do I make the music shift when the hero goes in or out of a city on the same map file. Basically I have this map:


I want a music track for when the hero is in the fields, when he is in the castle town and one when the hero is in the small town next to the ocean. Basically everytime the hero crosses the drawbridge i want the music to change on the same map file.. ermm how do i do it? I cant seem to find the answer myself or if its possible..

best regards David

You could probably use a sensor that changes the music, though it might be a bit tricky to make the transition of the music back and forth seamless.

The transition between music between maps isn't really seamless either though, haha

Using sensors is exactly how I'd do it too. Using the sensor:on_activated() event to call sol.audio.play_music

You might want two sensors per transition, one to okay the field music, one on the inside of that to play the town music.


I am quite happy with the project. Here is the current main map. I am mainly drawing inspiration from the maps of links awakening, seasons, ages and minish cap. The idea of of a central castle town is from minish cap and so is the right path outside the castle which leads to the forest temple. The map is based around 12x8 grids of visible area. The whole overworld map is 32x32 grids. Each dungeon have its own 8x8 grid overworld map and the main field area with the town is a 16x16 grid map.



If i need help with something else i will post it here  :D

@Dianthus

Keep us informed! I'd love to see where this project goes.

Just another dumb question, how large a map can solarus handle before the game becomes laggy? I am considering what happens if merge all of the overworld into one single map. That would be a map of 384*256 tiles. In addition a few hundred entities on it.. Will it become laggy??  ???

@Dianthus Solarus is a very lightweight engine. It depends on the hardware that it's being played on, but I'm quite sure a quest of that size would be fine on any computer. If you plan on porting it to the RetroPi, then you may have to separate out your maps. Not much benchmarking has been done on RPi before as far as I know, but the Solarus quests already released run pretty well.

Largely depends on your entities' code, too. I had an enemy I'd written kinda poorly that caused lag on my decent laptop with just 5-6 of them. Are they calling functions every few milliseconds? Or just wandering randomly? That'll make a difference.

Out of curiosity, why do you want to merge everything into one map? Seems more difficult to work with, especially if you're putting much code into the map script.

Quote from: Max on December 05, 2019, 01:43:45 AM
Out of curiosity, why do you want to merge everything into one map? Seems more difficult to work with, especially if you're putting much code into the map script.

I find it easier integrating different map areas with each other when its on one map. Tree placement are supposed to match with trees on another map and the player can move from one map to another from multiple directions, so having it all on one map adds to the seamlessness of the map. Besides the new 'links awakening 2019' merged everything in to one overworld, so i wanted to try it too  :P

But i have stopped trying - too many issues with having everything on one map.

The project is really getting ahead. I hope I will have the quest working all the way up to the forest temple finished in like 3-4 months  :)


Just an update. I am still working on the project, but i have decided that i want to create my own texture set and i am probably changing the resolution and grid size. So its a much larger project :)