Ok sorry if this has already been discussed but i couldnt find a topic since 4.0 came out and there are some new developments that might change it. So Im making a day/night system because it actually has an effect on my game and I need it, but I know that they can cause serious lag and hog processor if done wrong. So I wanted to see what people thought would be the best way to change the icons.(and theres gonna be stages like dusk and dawn, night and day)
1. add dithered overlay to all turfs, I dont like this idea cause i dont like how it looks or how it has to cycle through all turfs. and for the looks i know i could now use a transparent square to make it look better also.
2. Make icon states and change the icon state for every turf, again dont like the cycle through every turf
3. (this is pretty much the same as 2 but not sure if it would be faster or not) Make directions for turfs and just changed the direction for different icon states.
4. This is what im leaning to but not sure if it would be faster or not...Create an transparent overlay for the players screen and add it to the players screen at the get go and change with time.
I think 4 would be fastest and best looking cause you can have the players be a different category of mobs like mob/player so you only have to cycle through them and not every mob in the world, the only problem is you need to adjust it for going indoors but that can be done with teleporter if you use it.
Let me know what you think and if I missed a better way (which is highly likely im fairly new to coding)
1
2
ID:151969
Jul 28 2008, 1:45 am
|
|
Jul 28 2008, 2:38 am
|
|
You could also use areas. Overlays on areas will affect the whole map and is 'cheap' compared to cycling through every turf as you only need to change the area once. You could even hhave a separate area for inside or light areas so that buildings appear lit at night.
|
NightJumper88 wrote:
1. add dithered overlay to all turfs, I dont like this idea cause i dont like how it looks or how it has to cycle through all turfs. and for the looks i know i could now use a transparent square to make it look better also. I wouldn't recommend that one at all. Not only will you have problems with clicking things, but it's also wasteful to give every single turf an overlay. The only upside is that you can control exactly which square has the overlay easily. 2. Make icon states and change the icon state for every turf, again dont like the cycle through every turf But the players would be standing on top of the darkness! 3. (this is pretty much the same as 2 but not sure if it would be faster or not) Make directions for turfs and just changed the direction for different icon states. Same problems as with 1 and 2. 4. This is what im leaning to but not sure if it would be faster or not...Create an transparent overlay for the players screen and add it to the players screen at the get go and change with time. This isn't a bad idea, however know that the lighting effect will appear everywhere, unless you want to calculate which parts of the screen should be brighter than others according to the objects on the map, which isn't robust, is relatively difficult, and is inefficient. One way to go, like Hazman said, is to change the icon_state of the areas. This is good if you don't want the whole map dark at once. You just don't get to decide at run time exactly which tiles should be dark and which should be light. Also, have you looked at BYOND's built-in luminosity and see_in_dark vars? Then there's Shadowdarke's area lighting library which you could look up. |
In response to Nickr5
|
|
Well what ive done so far is create a object with different icon states and add that to the users screen when they create a character, then i change the state with my weather system, but i have a check to see if they are indoors or not and whenever they go inside it sets the state to full brightness like it would be if they were indoors, also i can modify this for when they enter any area i can change it to my liking, yes i have looked at the built in luminosity but that limits the players range of view if i remember right. And Ill check out the demo to see what it uses and if i like it better
|
In response to Nickr5
|
|
This isn't a bad idea, however know that the lighting effect will appear everywhere, unless you want to calculate which parts of the screen should be brighter than others according to the objects on the map, which isn't robust, is relatively difficult, and is inefficient. It is simple, but not exactly a path one would want to take. The movement for a system like this looks so jerky due to the screen objects being turned off and on. One way to go, like Hazman said, is to change the icon_state of the areas. This is good if you don't want the whole map dark at once. You just don't get to decide at run time exactly which tiles should be dark and which should be light. Search for the behavior of areas, this will suit you much better, Nightjumper. Don't do whatever it is that you're doing. |
A very underused procedure that might be handy for such a thing:
MapColors proc (icon) Not sure exactly how to use it but I suppose you could load up all icons in the world and modify them with it... I have never seen this used in a day and night system and frankly I think the whole world tinting into darkness would look nice than overlays and dithers. The whole reason I remember this proc is because Data spoke to me about it before 4.0 was launched and I also used a similar thing in RPG Maker XP. |
In response to Lyndonarmitage1
|
|
Ive actually seen this before in a demo or on the forum cant remember where, but they had a major problem with it and as the cycle went through changing the colors didnt not return all the way back and after several cycles through they said the turfs got washed out. I dont know for sure cause I havent worked with it but i figured for the kind of effect id rather not mess with changing colors.
|
In response to Lyndonarmitage1
|
|
Big problem with that is that icon procs are slow. The best one could do with that is to produce the icons, then ftp() out the data into files.
|
In response to NightJumper88
|
|
Oh right, no harm done in suggesting it :-D
I am going to fiddle with the proc myself now, if I manage to make a good Day & Night system with it I shall post a demo and might page you a link. |
In response to Lyndonarmitage1
|
|
Sounds good, Im always open to new ideas that will work better visually and hopefully not cause lag, cause i hate lag
|
In response to Popisfizzy
|
|
Ah I was thinking that there would be a bit of lag.
What you mean by ftp()ing the icons out is saving them as another file then using them in game via an icon_state change? |
In response to Lyndonarmitage1
|
|
Probably, yes. You can also use fcopy() which is more automated.
|
In response to CaptFalcon33035
|
|
I was testing out some stuff and realized that theres a problem with the day/night cycle and that because its on top of everything it prevents clicking on any mobs. I was wondering if there is a way around this
|
In response to NightJumper88
|
|
Look up the click_opacity variable.
|
In response to Popisfizzy
|
|
Thanks i Found it, its actually mouse_opacity but i figured it out.
Also I had another question as to which method would be best, Ive narrowed it down to two methods... 1. Add an object to the players screen that fills the entire screen. 2. Change the areas icon state. I tend to think that the players screen would be the more efficient method but everyone seems to like the area method, so i was wondering which one would be more efficient (also consider that my map is 5 1000x750 sections, really big).Where the most players on at one time would be around 50 (anymore and host would have trouble with lag so gonna limit it) |
In response to NightJumper88
|
|
Most people use the area to avoid any extra work... imagine it started snowing and you are in doors, or walked in to a store or left it? You would need to check if it is snowing/etc and either add or remove it (depending on the situation)
|
In response to GhostAnime
|
|
Well im ok with the checks its not that hard to check when going indoors or leaving. What im concerned with is making it the most efficient, im not too familiar with areas havent used them too much so not sure how they work when changing, not sure if they do it square by square or by the whole group. So Im just more interested in which would be less stress on CPU
|
In response to NightJumper88
|
|
i figured it out. Don't you mean I told you :P |
In response to Jeff8500
|
|
actually i saw your message after i got his
|
In response to NightJumper88
|
|
I'd say go with areas.
Just make an outside area, then change the icon or icon state of that. You'd only put that area on the places that are actually outside. This causes minimal strain, as only one instance is stored per area, and so only one area object must be changed for the entire effect to be seen. Also, inside areas would be unaffected and you wouldn't need to check whether or not you're indoors. (I myself wish there was an alpha effect that used ICON_MULTIPLY for its effect. e.g. You simply change the alpha of an icon, and it uses the multiply blend effect on objects under it. It creates a better, more realistic looking effect.) |
1
2