Game Development Community

TGEDayNight Released!

by Prairie Games · in Technical Issues · 12/05/2002 (9:01 am) · 143 replies

Here is the Day and Night Cycle stuff as featured here.

*** Sorry, over the years we've lost this file. Please foward to Support@PrairieGames.com, thank you.
The source is available: HERE!

This is in GNU patch format... read the docs...

EDIT: I added the 2 TMU support for the interiors, get it from the link above :)

EDIT 2: Fixed a small problem with the horizon and made Sunrise/Sunset/Clouds much more dynamic/vibrant, highly recommended... the source is available from the link above or down below in the thread


Cheers,
-Joshua Ritter
Prairie Gamesm Inc.
#81
03/13/2003 (11:23 am)
Josh - I have noticed some crashes in my build so I got to investigating. Can you tell me how tgeDNSun gets its' contents set to null(0) after a mission has been unloaded? Seems to me (and I haven't done an exhaustive search or understand everything) that if I set a breakpoint and watch any subsequent reloads of a mission (has a Sun) that tgeDNSun is the same as last set to the "this" value. I am getting memory corruption and VC6.0 has trapped it writing to guard bytes around allocation heaps. tgeDNSun is initially set to NULL on .exe loading but I don't think ever gets nulled out afterwards.
#82
03/13/2003 (11:43 am)
Sun::~Sun() sets it to NULL

-J
#83
03/19/2003 (6:17 pm)
Well now.

Josh, I became a member of GG on 3/15/03 after having read an article in PC Gamer.

Since then, in this very limited time/exposure that I've had on these forums, I can't express how utterly impressed I am by your ability and previous history in programming. Your site(?) http://www.actionrpg.com/ is outstanding. All of the information regarding the Wild West / Kung Fu / Cthulu is nothing short of spectacular.

I feel proud of myself when I can write a "Hello World!" program, so maybe I'm easily impressed, but at the same time I feel you are well deserving of the credit received to you by other forum members applauding you on your abilities and contributions.

What is the point of this? Spontaneity. I've seen your name more often, and you made it convenient for me to view your website. So call this an extended congratulations by someone [me] who darn near wishes I could implant your programming knowledge into my brain to spare myself the (x) years it will take by starting from scratch.

To everyone else reading this who may be feeling naseous, sorry. Call this post a casualty of circumstances. I calculate the stars will not again align in such a way for me to be green with envy over wishing I had an ability that I do not. This, infact is very uncharacteristic of me. So, having said all that, please forgive me :D

-Robert
#84
03/19/2003 (6:44 pm)
Robert,

Thanks... *blush*

I am really just a dedicated programmer who loves games...

I am glad you liked the Western/Cthulhu stuff... I hope to work on some of this soon...

Take care,
-Josh
#85
03/20/2003 (1:17 am)
Hey Josh, I just wanted to say thanks for your fixes, they made my 2-TMU-fix look like the bad hack that it was ;) (I got everything to render ok, but broke the interior lighting in the process)

Your code in conjunction with my fractal sky looks just awesome. Although I had to tweak my colors after your patch, dawn and dusk look so much better now.
#86
03/28/2003 (12:18 am)
@Joshua

I had some trouble understanding the patching system, but I think I understand better now.

In fact, TGEDayNight is just a resource using the patch format?
But it hasn't been been submitted to be integrated to the core engine, has it?

My question is then:
why using a patch format for a resource? It seems dangerous, as it is impossible to know what changes people have made to their engine before using this patch, doesn't it?

Does this imply that, to be on the safe side, people have either to use exactly the same version of the engine as you had, or open the patch file with a text editor and extract the changes manually, then merge it with their own changes?

Cheers,

Isidore
#87
03/28/2003 (2:36 am)
@Isidore: Pathces are the "preferred" method of distribution for reasources. For the most part people submit the huge "change this then change this" resources because they're unable to / dont't know how to create patches. In addition to that, if you TGE source code on your own website you violate the license agreeement with GG and they tend to frown on that.

As for the patch application process. You shouldn't have to worry too much about version differences, and even if the patch fails for a given source file, it gives youa "reject" file so you can fix the problems in that one file.
#88
03/28/2003 (2:50 am)
Thanks for your fast reply!

Quote:
You shouldn't have to worry too much about version differences, and even if the patch fails for a given source file, it gives youa "reject" file so you can fix the problems in that one file

Maybe you are right. Maybe it will be simple to fix if this happens.
And maybe I just worry too much :)

Cheers,

Isidore
#89
03/28/2003 (4:32 am)
I wouldn't call it the 'prefered' method, at least not here. A resources first priority (IMHO) is to teach methods, not add funtionality. A patch file may be the easiest method to get changes added, but the user would learn little. Forcing someone to 'change this, change that' almost assures they will read what they are doing, and possibly even understand it.
For this reason, I prefer the longer method of adding resources...
#90
03/28/2003 (5:21 am)
@Erik: I respectfully disagree. While you are correct that it serves as a great learning tool, if you want a resource to be a learning excerise just submit a tutorial. By NOT putting things in patch format you introduce the possibility for errors (both subtle and not so subtle) and make it a royal pain to re-apply changes if needed.
#91
03/28/2003 (5:43 am)
Both would be better. A patch for quickly install/reinstall the new feature, along with a "change this, change that" description to know what has been changed and why.

That sounds demanding ahaha! :p

Isidore
#92
12/03/2003 (11:19 pm)
When I try to apply I get an error saying "4 out of 4 hunks ignored" but the code does compile and sort of works with some strange effects. Has anyone else gotten this error or does anyone know why I would get this error?
#93
12/03/2003 (11:57 pm)
@Isidore: A patch file is text, so you can see what was changed (I realize your post was on 3/28/03)

@Brendenn: I applied the patch just before the 1.2 tag and everything was fine minus the new specular effect on water not being accounted for... note that there is some additional code not in the patch that must be hand applied here... This included support for 2 TMU video cards, a horizon fix, and much improved look for sunrise/sunset...

-J
#94
12/04/2003 (12:30 am)
I am sorry, but I am pretty new to Torque. What do you mean by before the 1.2 tag? And exactly what code must be hand applied? I am sorry to waste your time on such a noob!
#95
12/04/2003 (1:43 am)
1.2 tag is the version of Torque in CVS. You can see the tag names on this page.
So Release_1_2_0 means version 1.2 of Torque.

On this page you find the horizon fix which was mentioned by Joshua.

If you need support for 2 or 3 TMUs you can download the source on the page Joshua mentioned.
#96
12/05/2003 (1:38 am)
Okay, we are still having a lot of problems implementing this patch, so I thought I would give you all some additional information and see if you know what is going on.

We are running Visual Studio .net 2003 under Windows XP. We have version 1_2_0 of Torque and have all the UnxUtils installed and working.

On a CLEAN version of torque, we place the daynight.patch file in the torque directory (in our case c:\torque\) and then go to the command prompt. From there, we type patch -p0 < c:\torque\daynight.patch

When we do this, it comes back telling us that basically all of the hunks of the patch have failed. The main argument seems to be that the files it is trying to patch are not there... but they are!

To try and work around this, we tried to implement the patch manually. I entered the code changes EXACTLY as described in the patch file to every file within the engine.... and then got multiple compile errors.

BASICALLY - What I am asking is: Is there ANY way to easily implement this patch using Visual Studio .net 2003 and 1_2_0 of Torque or am I up a creek without a paddle?


Any help you could give us would be GREATLY appreciated!

- Brenden Vaughan
#97
12/05/2003 (1:46 am)
You have to go to the main folder of torque (where the engine folder is in) in your cmd.

So if your installation of torque is in C:\Torque
You have to do that in your cmd:

cd c:\torque
patch -p0 < c:\pathtopatch\daynight.patch

Then he will find the files and everything should work fine. Maybe some hunks fail, so you should take a look into the *.rej file to see, where he had a problem. (The *.rej file is placed where the original file is)
#98
12/05/2003 (2:14 am)
Thanks for the response Marco. Ok so I have been able to get as far as you are describing, most of the patch installs fine but those four hunks allways mess up. Is there somewhere that descibes how to interpret the rej file? Here is what one looks like could anyone describe to me what my problem is here. Thanks, again.


***************
*** 2492,2499 ****
mShadow->setGeneric(true);
else
mShadow->setGeneric(false);

- Point3F lightDir(0.57f,0.57f,-0.57f);
F32 shadowLen = 10.0f * mShapeInstance->getShape()->radius;
Point3F pos = mShapeInstance->getShape()->center;
// this is a bit of a hack...move generic shadows towards feet/base of shape
--- 2496,2507 ----
mShadow->setGeneric(true);
else
mShadow->setGeneric(false);
+
+ //Point3F lightDir(0.57f,0.57f,-0.57f);
+
+ Point3F lightDir=tgeDNSunVector;
+

F32 shadowLen = 10.0f * mShapeInstance->getShape()->radius;
Point3F pos = mShapeInstance->getShape()->center;
// this is a bit of a hack...move generic shadows towards feet/base of shape
#99
12/05/2003 (2:24 am)
@Joshua

Actually, I am ok with the patching system as long as:
1. the latest version of the patch is up-to-date (ie: working with the last release)
2. it is possible to patch from an older patched version to include the latest changes (ie: intermediate patches are supplied)

But I am not sure if it is always the case, which worries me when using them.

By the way, a patch file is a text file indeed, but you'll have to admit it is not particularly easy to read & understand that ^^:

Index: engine/game/shapeBase.cc
===================================================================
RCS file: /cvs/torque/torque/engine/game/shapeBase.cc,v
retrieving revision 1.35
diff -u -r1.35 shapeBase.cc
--- engine/game/shapeBase.cc	2002/06/23 15:22:22	1.35
+++ engine/game/shapeBase.cc	2002/12/06 00:04:43
@@ -30,6 +30,10 @@
 #include "math/mRandom.h"
 #include "platform/profiler.h"
 
+//TGEDN
+#include "ARPG/environment/atgeDayNight.h"
+
+
 IMPLEMENT_CO_DATABLOCK_V1(ShapeBaseData);
 
 
@@ -2494,8 +2498,12 @@
       mShadow->setGeneric(true);
    else
       mShadow->setGeneric(false);
+   
+   //Point3F lightDir(0.57f,0.57f,-0.57f);
+
+   Point3F lightDir=tgeDNSunVector;
+
    
-   Point3F lightDir(0.57f,0.57f,-0.57f);
    F32 shadowLen = 10.0f * mShapeInstance->getShape()->radius;
    Point3F pos = mShapeInstance->getShape()->center;
    // this is a bit of a hack...move generic shadows towards feet/base of shape

Understandable, but not as obvious at first glance as a "change this, change that" explanation.

Isidore
#100
12/05/2003 (2:27 am)
Ok, you're nearly done.
The first part is what it looks like now.
The second part is how it should look like after the change.

As you can see, there's a "-" in front of this line:
- Point3F lightDir(0.57f,0.57f,-0.57f);
what means that he want's to remove this line.

In the second part you see some "+". That means, he want's to add this lines.

+
+ //Point3F lightDir(0.57f,0.57f,-0.57f);
+
+ Point3F lightDir=tgeDNSunVector;
+

So, all you have to do in this case is to open the file (the normal one, not *.rej, in this case shapebase.cc), search for this lines (for example "Point3F lightDir(0.57f,0.57f,-0.57f);"), comment out Point3F lightDir(0.57f,0.57f,-0.57f); and add Point3F lightDir=tgeDNSunVector;

You have to do this for every failed hunk.
Do a clean build an it should work.