Author Topic: Shifting music when the hero enters a new area on the same map?  (Read 237 times)

Dianthus

  • Newbie
  • *
  • Posts: 5
    • View Profile
Shifting music when the hero enters a new area on the same map?
« on: November 29, 2019, 12:11:35 pm »
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
« Last Edit: November 29, 2019, 12:16:32 pm by Dianthus »

Starlock

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: Shifting music when the hero enters a new area on the same map?
« Reply #1 on: November 29, 2019, 02:08:52 pm »
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.

Max

  • Full Member
  • ***
  • Posts: 228
    • View Profile
Re: Shifting music when the hero enters a new area on the same map?
« Reply #2 on: November 29, 2019, 06:45:20 pm »
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.

Dianthus

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Shifting music when the hero enters a new area on the same map?
« Reply #3 on: November 30, 2019, 06:24:39 am »
thx for the help guys. I am gonna try it.. :)

Dianthus

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Shifting music when the hero enters a new area on the same map?
« Reply #4 on: December 01, 2019, 08:29:05 am »
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
« Last Edit: December 01, 2019, 08:38:38 am by Dianthus »

Maloney

  • Newbie
  • *
  • Posts: 9
  • The Video Game Boy
    • View Profile
Re: Shifting music when the hero enters a new area on the same map?
« Reply #5 on: December 02, 2019, 12:30:45 am »
@Dianthus

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

Dianthus

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Shifting music when the hero enters a new area on the same map?
« Reply #6 on: December 03, 2019, 05:58:30 pm »
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??  ???

Maloney

  • Newbie
  • *
  • Posts: 9
  • The Video Game Boy
    • View Profile
Re: Shifting music when the hero enters a new area on the same map?
« Reply #7 on: December 03, 2019, 10:29:55 pm »
@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.

Max

  • Full Member
  • ***
  • Posts: 228
    • View Profile
Re: Shifting music when the hero enters a new area on the same map?
« Reply #8 on: December 05, 2019, 01:43:45 am »
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.

Dianthus

  • Newbie
  • *
  • Posts: 5
    • View Profile
Re: Shifting music when the hero enters a new area on the same map?
« Reply #9 on: December 05, 2019, 01:15:02 pm »
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.
« Last Edit: December 05, 2019, 01:20:31 pm by Dianthus »