Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • entries
  • comments
  • views

I had an idea..



I was thinking yesterday while watching my first game map cycle through the days and nights.. Why can't we also cycle through the seasons.. If I have asset's that have fall, winter, and summer versions, then can we load and change those in real time? I know this is not the first time anyone has done/though of this, but it was a pretty good thought for me. All to often game levels (in the online versions) are just static maps with sometimes breakable objects, and yes even most have day/night cycles. Not everything has to be so static all the time..


So, i am sure this will be done in Lua.. (I think) Using SQLite, we can store the number of days in a year, at which days the new cycle starts, and which day it is. Each time the day night cycle completes it adds 1 to the current day.. Simple enough right? So then its just a matter of changing the models, so how do we access the models? How do we tell the engine to load the new ones, and should they all change at the same time, or should it be random?


I think we need a single controller. This controller will determine each of the sub components and tell them when to change. It must communicate with the SQLite AND the model controllers. It must also communicate with post processing (after all we want it to rain, snow, hail, etc....). If we are going to have seasons, then we need seasons.


So off to learn/research, and test.. wish me luck5624133925905491657-8117470021912695208?l=victomeyezr.blogspot.com




Recommended Comments

If every model had an animation to change it through the seasons you could just play the animation on them very very slowly to get a nice natural feel. For the terrain change the textures slowly. For random snow hills have models that grow in animation and again play that. The central manager would manage all those animations and texture changes. It would be cool to see but to get it looking nice would most likely be a ton of work. Excited to see what you can come up with.

Link to comment

Its a good idea, but I don't want the animations. I think to much could get out of wack with animations. It will be a long process, but I think my original idea, to reload new assets with the new textures is the best at this point. I may of course come back to this, but we shall see.. <_<

Link to comment
Guest Red Ocktober


Why can't we also cycle through the seasons..


yeah... and while we're at it, lets add erosion and weathering, and the effects of time as to aging...



just kidding!


definitely something to think about...


i mean, if you're playing a naval simulation, a flight sim, or something like that... i can see where this could come in handy...

( ie... the ship would come back to port months later, set the time of year to fly, etc )


i guess it depends on how close you want to come to reality in your game...



Link to comment

Haha I was actually thinking of making multiple season versions for one of my scenes. I wouldn't go to the extent of using SQLite though.


I'd imagine you would also want models to only be changed if they are not in the view of the camera. Could look funny if things suddenly pop out of being hidden.


Could be done in LUA, C++ or whatever you want really. Don't see why not any language.


Its a good idea go for it. Will take some effort of course but all things worth doing do.

Link to comment

to reload new assets with the new textures is the best at this point


How would you hide the instant popping that would occur with models and textures like Ken said above or are you OK with that? Much like the day/night cycle this would have to be very gradual. I can see that working with textures, but models would be tough without them being animated (or else you'd need a ton of gradual versions which at that point animation would be easier). Even today most LOD changes are pretty noticeable. Would be nice if those could be somehow blended together instead and if so that might play into having separate models.

Link to comment

.this is doable..first of all, you could determine what surface would be affected by..snow for example..that can be done by surface vectors (game loading time)..then, you will simply already have surfaces to be affected by snow..what would you do is simply create new surface out of quads with constrains of exposed surfaces from loading time, and deform their vertices in such way (runtime, gradually growing up) so it will look very very realistic and nice with proper textures..if you wanna ice at the edges, principle will be same for determining initial generation points as for snow part..it will be painted with different refractive shader and be in real motion/growth...easy and effective and VERY automatic..

Link to comment

My biggest problem right now, is I don't know how to access the entities I have in the editor in the code... For example, I have the playerstart in the editor, but the game doesn't load the player start, but it loads the day/night..


I think this is why I got frustrated before with LE, there is no direct tie between all the lua coding and the game when it runs.. <_<

Link to comment

you can loop through the objecttable variable and it'll give you all the model script objects. If you download my Pi scripts in the Asset Store/Scripts look at Pi-Main and you can see I loop through this table and call the Initialize() function (if it exists) of those scripts. That's a function I define in the script itself. The objecttable gives you access to all the model entities in your scene (for the most part). There should be a name variable for each one or if you want another way to ID them you can make your own variable inside the model scripts and read that to tell what is what.


Another way to access model scripts from other model scripts is to use the targeting system. It's more efficient than looping through the objecttable, however it can also get overwhelming and confusing when you have a bunch of targets in your scene. You get lines being drawn all over the place, but it's how LE2 works and it can be viable.


I will be coming out shortly with a timer and decal model script which I'll do a little video on how to use them. I need them for my marble game. The way you use the timer script is giving it targets, define an interval, and a message value. When the interval hits it'll send the message you define to all the targets it has. Nice and easy way to do some timed events. Making a relay model script also that just relays the message along with a possible delay. This is needed because you can only have 8 targets per model, which is limiting but being able to have a relay can extend that number to unlimited but it would get more complicated to follow.

Link to comment

I got that, but when I run the game from a c++ compile, it doesn't load them.. well it does, but half do not work. Like the player start, the 3rd person camera, character controller, none of them load except the daylight script.

Link to comment

If you are talking about my Pi stuff you have to consider what Pi-Main is doing. It calls Initialize() functions of each script if it has it, it's setting the game mode variable and 1 or 2 other things. When you load the scene from your C++ program Pi-Main isn't running. If you set that game mode global variable in C++ then it should work, however I'm not sure how you'd be able to call the Initialize() method of the scripts from C++. Those scripts were meant to be ran from the editor or engine exe and not a custom game executable. You might have to make a custom Lua file that does the Initialize() function and then from C++ call that script with the LE Lua_State variable after the scene loads.

Link to comment
Add a comment...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...