BlitzCoder
  Game Design
  Huge Worlds
Post New Topic   Post A Reply
profile | register | preferences | faq | search | member list
View Active Topic List View Active Topics: Summary | Detailed
UBBFriend: Email This Page to Someone!
next oldest topic | next newest topic
Author Topic:   Huge Worlds
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/22/03 03:09 AM IP: Logged
From the minute I started coding in Blitz over a year ago,the possibility of the infinite ground "plane" in Blitz has always intrigued me.

I have a first person game with 11 levels. But all of the enemies in each level and the bonuses, etc. are mostly the same. What changes is the scenery. I have a skybox that is a child of the pivot that turns opposite your turns so the sky is perfect and you don't notice it....you can go 1 million miles in any direction.

I am finished with level 1. I have one huge plane that is the ground and hills in the "main" part of level one. I was going to free all entities except the plane. But if I put a small civilization for level two some 10,000 units along the z axis, when you get there, none of level one would be rendered. It's still in memory, and the textures are too, but no polygons to render.

I think if I keep my surface count low, this is doable. Even if I run into trouble, I can always free towns that are further than 10,000 units away, and load them again once they get closer ,far before they are actually in view.

I know it's taboo to "load" anything during movement and game play, but I don't imagine this being much of a pause, since when you are between villages, you don't see much but just land. The new villages would load or unload when they are way past the rendering point.

Any see any potential problems with this model? suggestions?


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
Andy
500 Post Club!

Posts: 601
From:
Registered: Aug 2001

posted 10/22/03 06:56 AM IP: Logged
>Any see any potential problems with this model? suggestions?

If you don't normalize your world regularly, you will end up getting graphics problems when you get far away from 0,0,0.

A plane can be textured, but it can't be shaped.

>I know it's taboo to "load" anything during movement and game play, but I
>don't imagine this being much of a pause, since when you are between
>villages, you don't see much but just land. The new villages would load
>or unload when they are way past the rendering point.

When you load and unload on the fly, you risk defragmenting memory.

This may not be evident on a freshly booted PC, but for one which has been used for a few hours and then you load up the game, it could mean that every time you load or unload, Windows will swap memory to disk making it excruciatingly irritating to play the game. The less memory you use, the less chance there is that the user has problems.

However, dynamic resource management works well if you design it with lowspec machines in mind.

Andy



Click Here to See the Profile for Andy    send a private message to Andy   Edit/Delete Message   Reply w/Quote   
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/22/03 11:39 AM IP: Logged
Andy wrote:
quote:

If you don't normalize your world regularly, you will end up getting graphics problems when you get far away from 0,0,0.

Could you clarify this a little? This intrigues me as well. How do you normalize your world?

I am DEFINATELY programming with low specs in mind. No question about it! But I would like to do this dynamic resource management thing. If [quote]
"When you load and unload on the fly, you risk defragmenting memory",
[quote], then what is the best way to pause the game while new things are loaded and unloaded? I guess I really need to know this even for the "old" model of changing levels, which I have done up to this point by putting a 2d bitmap on the screen (a "curtain") while some entites are freed and others loaded. Please advise!!!!


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
slenkar

1,000 Post Club!

Posts: 1917
From: Louisville Kentucky
Registered: Aug 2003

posted 10/22/03 01:07 PM IP: Logged
you could get into a horse and carriage or tram and it will say'travelling' while it loads the stuff

------------------
http://propagandamatrix.com/multimedia_priorknowledge_911roadtotyranny.html


Click Here to See the Profile for slenkar   Click Here to Email slenkar    send a private message to Slenkar   Edit/Delete Message   Reply w/Quote   Visit slenkar's Homepage!
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/22/03 07:41 PM IP: Logged
Anyone else hear about this problem occuring if you don't normalizing your world regularly, and getting graphics problems when you go too far away from 0,0,0 ?

I need to know what that means. I'd hate to build several villages miles away from world center just to find later that it causes problems on certain machines.

AND, what's the best way to 'clean house' and change levels in terms of memory management? Its easy to do in general but I need to make sure I'm doing it for optimal performance!!


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
Biofellis

500 Post Club!

Posts: 785
From:
Registered: Sep 2003

posted 10/22/03 08:13 PM IP: Logged
I think the main issues Andy's talking about are general floating point accuracy (which shouldn't get too bad), and z-buffer precision (which can get quite ugly). This is primarily camera based errors having to do with having too close and too far clipping fields (think of it as a kind of 'digital' depth of field- though instead of going out of focus, objects 'vibrate' back & forth in front of landscapes/each other/etc. due to inaccurate math.

You should be able to set your x,y,z to be radically big as long as you aren't trying to still see 0,0,0 (or some other very remote distance from your camera) as well. That's my understanding of it, though I haven't tried it to such a degree, so if anyone knows otherwise- jump in.

If you're not dynamically de-allocating & re-allocatng memory, but internally clearing & filling, then Windows silliness becomes much less of an issue- but obviously the way Blitz works you're going to have some things you just have to do 'however', and possibly marathon level streaming might be an issue on some machines or after extended durations. You just have to test it & see I guess. Good luck to you.

------------------
This time around all the limits will be cut loose...
First release yourself. Let our dreams be as one if mankind is to evolve.
Teach your children the way, that they may understand.

Love is a power. Compassion a gift. No one need be empty.
No one need be scared.


Click Here to See the Profile for Biofellis   Click Here to Email Biofellis    send a private message to Biofellis   Edit/Delete Message   Reply w/Quote   Visit Biofellis's Homepage!
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/22/03 08:18 PM IP: Logged
OK, that clarifies things; thanks Biofellis. No, I am certainly not trying to see things very far away. All I want is for the user to be able to see what is in front of them. My camera near /camera far spread is not too wide, either.


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
Neuro

Veteran Member

Posts: 328
From: Reston, VA United States
Registered: Jun 2002

posted 10/22/03 10:18 PM IP: Logged
Sounds interesting. Wouldnt mind taking a look at how it works.

------------------
-=[ M A S T E R S Dev ]=-
http://www.3d-design.0catch.com


Click Here to See the Profile for Neuro   Click Here to Email Neuro    send a private message to Neuro   Edit/Delete Message   Reply w/Quote   Visit Neuro's Homepage!
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/23/03 02:15 AM IP: Logged
...Guess what happened...

Well, I DID notice some very weird problems as I got further and further away from 0,0,0. I created an island and two bridges, one going to an island northwest, another to an island northeast.

Both bridges were identical. Yet the bridge to the northeast,the geometry is perfect in Max, but in Blitz somehow the mesh got flipped so the bridge is upside down. Weird.

But worse than that, when I take the good bridge, I finally get to the northwest island. And its fine, but certain collisions with steep objects allow me to pass through walls,hills, barriers, and start falling. in the world center, the collisions are perfect no matter how steep the object is.

My hunch is that the subtle flaws and/or irregularities in the collision calculations get magnified the further you get from world center. This "floating point precision" problem was alluded to by both Biofellis and Andy and I think the problem may be pretty bad, at least on my system.

This "remote" island I'm speaking of is at about 33,000 on the z axis and 20,000 on the x axis. Not that far, but apprently far enough to start having problems.


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
Andy
500 Post Club!

Posts: 601
From:
Registered: Aug 2001

posted 10/23/03 07:00 AM IP: Logged
There are 2 problems with 3D and floating point accuracy.

1) that 3D coordinates are only correct to 6 digits, meaning that when you get far away from the center of your world, everything is just a little bit away from where it should be, and when you try moving it somewhere, it will seem to jump around.

2) that things which are further away is drawn on top of things which are closer. This is because far away things may be so close to each other, that the lack of z-buffer accuracy makes them appear to be at the same place.

1) can be rectified by normalizing your cameras position every once in a while... If you are at 10000,10000,10000, then you simply move everything -10000,-10000,-10000, so that the camera is now at 0,0,0. This way everything stays where it is in relation to each other, but is moved closer to the origo.

by the way, 10000 is just a fictitious number, use whatever works for your world. I generally have 2 lists of entities... One for entities withing distance of sight and one for all other entities. I then move entities from one to the other based on how far they are from origo. Then when I normalize, I normalize all of the entities in sight in one loop, and then the others, a few at the time every second or so until all are done.

This way you can still have thousands of entities, but only have to normalize a maximum of perhaps 50 in one frame. Since rendering the scene is usually very costly on slow PC's, you could also take the first half in one frame, leave out the rendering, then take the other half in the second frame and then render... This is great as you usually won't notice it.

>"When you load and unload on the fly, you risk defragmenting memory",
>[quote], then what is the best way to pause the game while new things are
>loaded and unloaded? I guess I really need to know this even for
>the "old" model of changing levels, which I have done up to this point by
>putting a 2d bitmap on the screen (a "curtain") while some entites are
>freed and others loaded. Please advise!!!!

If you want serious drm, then you need to create a systen to manage the things you load and free, and which can load and free entities while the game is in progress.

>...Guess what happened...

I told you so

I have done alot of research on how to actually make a large, detailed world, and have built the first 2 or 3 very capable terrainsystems for my self... If you really want to make it realistic it will be difficult, but if you need just a plane, it's really just about keeping the numbers manageable.

Andy


Click Here to See the Profile for Andy    send a private message to Andy   Edit/Delete Message   Reply w/Quote   
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/23/03 11:57 AM IP: Logged
Andy thanks for the details about "normalizing" the world. I was about to give up but your experience in this area has proved to be very helpful.

|edit|

so this must mean that the town that was at the world center, what do you do with that? scoot it out of the way? I have 11 towns so I'll have to write a bringtocenter() function and a removefromcenter() function to scoot stuff around accordingly.

|/edit|

[This message has been edited by Nmuta (edited 10-23-2003).]


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
Biofellis

500 Post Club!

Posts: 785
From:
Registered: Sep 2003

posted 10/23/03 01:30 PM IP: Logged
I couldn't replicate your error- at similar coordinates collisions seemed fine- but I did not test exhaustively- it's way past my bedtime. In any case, you might want to try reducing the scale of everything by 10 or so. That could give you more room to breathe- assuming the error does not scale as well- which depends on how blitz does things, and I'm hoping others know better. I have no clue about the upside-down bridge. Additionally, you might be moving too fast for blitz collisions to work well, and that might become an issue even when not at extreme coords- just far less frequently. Falling through inclines is one thing- but going through walls? I went well past 40k and could do neither, so either I just got lucky or something else must factor in.

Anyway- food for thought.

------------------
This time around all the limits will be cut loose...
First release yourself. Let our dreams be as one if mankind is to evolve.
Teach your children the way, that they may understand.

Love is a power. Compassion a gift. No one need be empty.
No one need be scared.


Click Here to See the Profile for Biofellis   Click Here to Email Biofellis    send a private message to Biofellis   Edit/Delete Message   Reply w/Quote   Visit Biofellis's Homepage!
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/23/03 04:10 PM IP: Logged
I have a somewhat involved collision system with my pivot that makes you bounce a little after you fall from heights and allows you to fly , etc.
I'm sure its the calculations.

The calculations work perfectly as long as you are withinn 10,000 units of world center but after that things get screwy.

I think Andy is right. I know he's right actually.

But yeah, Biofellis it may be because there is a greater need for floating point accuracy in my collision system then yours. My collisions work at VERY high speeds at world center but I can just drift into sand dunes at 30 K units away when I'm walking very slowly. So yes, it is a math issue.

I would imagine it may even effect your system at greater distances and with steep enough hills. It's something I will certainly test.

[This message has been edited by Nmuta (edited 10-23-2003).]

[This message has been edited by Nmuta (edited 10-23-2003).]


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
Andy
500 Post Club!

Posts: 601
From:
Registered: Aug 2001

posted 10/23/03 05:17 PM IP: Logged
>so this must mean that the town that was at the world center, what do you
>do with that? scoot it out of the way?

You move that -10000,-10000,-10000 as well... That way everything stays where it is supposed to be, but the camera never moves beyond a certain 'safe' distance from the origo. Basically in stead of moving around your world, you move the world around you...

If you start trying to 'scoot things out of the way', you will be making more work at the price of great complexity and slowdown. Just move it like everything else... Believe me, simplicity is often the best way to go.

>I have 11 towns so I'll have to
>write a bringtocenter() function and a removefromcenter() function to
>scoot stuff around accordingly.

Actually you just need the first function... Ideally you just normalize everything in view first, and then a few of the remaining entities at a time until they have all been moved.

Frame 1: move the houses in view - 25 entities moved
Frame 2: move entities not in view - 5 moved
Frame 3: move entities not in view - 5 moved
Frame 4: move entities not in view - 5 moved
Frame 5: move entities not in view - 5 moved
Frame 6: move entities not in view - 5 moved
Frame 7: done

The following piece of code should do it... PLEASE UNDERSTAN that this is 'Crap Code TM (C) (R)' and although you can use it as you please, you can most certainly do better yourself. This is from my first study into flight simulation 2 years ago, so I only needed a functional terrainsystem in order to study the physics and undercarriage.

;***********************************************************'
num_ent=10 ; number of entities
dim mesh(num_ent)
fieldsize=5000


.housekeeping
mx = 0.0
my = 0.0
mz = 0.0
If EntityX(player_pivot)>5000 Then
PositionEntity player_pivot,EntityX(player_pivot)-fieldsize,EntityY(player_pivot),EntityZ(player_pivot)
mx = -fieldsize : my = 0.0 : mz = 0.0

EndIf

If EntityZ(player_pivot)>5000 Then
PositionEntity player_pivot,EntityX(player_pivot),EntityY(player_pivot),EntityZ(player_pivot)-fieldsize
mx = 0.0 : my = 0.0 : mz = -fieldsize
EndIf

If EntityX(player_pivot)<-5000 Then
PositionEntity player_pivot,EntityX(player_pivot)+fieldsize,EntityY(player_pivot),EntityZ(player_pivot)
mx = fieldsize : my = 0.0 : mz = 0.0
EndIf

If EntityZ(player_pivot)<-5000 Then
PositionEntity player_pivot,EntityX(player_pivot),EntityY(player_pivot),EntityZ(player_pivot)+fieldsize
mx = 0.0 : my = 0.0 : mz = fieldsize
EndIf

For q = 1 To num_ent
MoveEntity mesh(q),mx,my,mz
Next
Return
;*******************************************************

Andy


Click Here to See the Profile for Andy    send a private message to Andy   Edit/Delete Message   Reply w/Quote   
MSW

Veteran Member

Posts: 150
From:
Registered: Oct 2003

posted 10/23/03 06:52 PM IP: Logged
Couldn't you just keep the player character at 0,0,0 and create a parent entity (I'll call World) that everything...the terrain, the bridges, other entitys moveing around are then children of...then just move the World parent and everything within it should move as well?
Click Here to See the Profile for MSW   Click Here to Email MSW    send a private message to MSW   Edit/Delete Message   Reply w/Quote   Visit MSW's Homepage!
GoSsE

500 Post Club!

Posts: 779
From: Sherbrooke, Quebec, Canada
Registered: Jun 2003

ICQ: 26677455

posted 10/23/03 06:53 PM IP: Logged
I think that it would be the best thing to do.

------------------
GoSsE Korupted - gosse@nuloen.com
Nuclear Loaded Entertainment
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Wandering Knights - Hack'n'Slash RPG
Nuclear Nibble 3D & Blasto 3D - Classic Arcade Remakes


Click Here to See the Profile for GoSsE   Click Here to Email GoSsE    send a private message to GoSsE   Edit/Delete Message   Reply w/Quote   Visit GoSsE's Homepage!
Biofellis

500 Post Club!

Posts: 785
From:
Registered: Sep 2003

posted 10/23/03 07:07 PM IP: Logged
I know he's right too- I'm just suggesting something else is making it worse for you- I guessed at high speeds, which apparently you use, and I'd dare say pivot use magnifies the problem (as it requires further math calculating), though I could be very off base with that.

Anyway, happy that you got it sorted out, one way or the other.

------------------
This time around all the limits will be cut loose...
First release yourself. Let our dreams be as one if mankind is to evolve.
Teach your children the way, that they may understand.

Love is a power. Compassion a gift. No one need be empty.
No one need be scared.


Click Here to See the Profile for Biofellis   Click Here to Email Biofellis    send a private message to Biofellis   Edit/Delete Message   Reply w/Quote   Visit Biofellis's Homepage!
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/23/03 10:52 PM IP: Logged
Moving the WORLD and keeping the player at 0,0,0 at all times....that's a concept. I have already designed my whole game engine so it would require a lot of work arounds.

I already started trying to implement that, just to see if it would work. I got the mouselook working with this new concept! Yeah!

Right now I keep falling though the floor, so I have to adjust the process of calculating collisions with the pivot and the ground, which was a heavily 'PIVOT-CENTRIC' method. But this new idea intrigues me and I think it may work.

It's just weird, the thought of it. Instead of moving a person, you are moving several tons of land and buildings and enemies!!!! Yet in terms of rendering, the computer doesn't really know the difference I suppose. It would still be the same number of polygons moving just as fast in the same direction. The whole concept of 3D in general is such an interesting illusion.


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
DREAM

Veteran Member

Posts: 163
From: Australia
Registered: Aug 2001

ICQ: 5813735

posted 10/23/03 11:54 PM IP: Logged
loading during the game is possible without slowing down the game, as long as you load it all in in bytes and the file you have is not overly huge. every frame you just load in a byte or two....the trick is saving a file in a format that you can do this.........I have used the idea for animating a loading screen as i loaded stuff.....elsewise its a statice boring screen with a bar that jumps at the end of each gfx/sound load............hope that helps......

------------------
Current project: FRUITY CAVES / DRAGON'S GOLD / UNDERTHREAT / FATAL DANGER / TANKZ / ADRacer

www.inventivedreams.com/dream


Click Here to See the Profile for DREAM   Click Here to Email DREAM    send a private message to DREAM   Edit/Delete Message   Reply w/Quote   Visit DREAM's Homepage!
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/24/03 12:50 AM IP: Logged
Andy, for what you call "crap code" it is 10 times easier and graceful than the mammoth system I was working on before you posted that.

btw, keeping the player at 0,0,0 all the time as MSW suggested is proving to be a little too tricky to implement given my current engine's set up, so I think I might use your way, with the grid.

|edit|

Andy, I just tried implementing that system. It works generally, but there is a little "jump" when the "shift" happens that is quite noticeable. And when the switch happends, it throws you off by about 40 units or so which can be the difference between being in a door and not in a door.

Here is the code I used. I had to put the "moveentity" command inside the conditional "if" statements, because when left outside of the statments, (run every loop) I experienced severe slowdown. I also had to rename mx, my,mz, etc because I already use those variables.

I run housekeeping from the main loop.

[This message has been edited by Nmuta (edited 10-24-2003).]


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
Andy
500 Post Club!

Posts: 601
From:
Registered: Aug 2001

posted 10/24/03 04:23 AM IP: Logged
I ran my original code this morning and the coordinates looked fine... I'll try yours when I get home.

Is it always 'off' at 40 units?
How many entities are you moving at one time?
Is your collision averaging or using old and new positions?


try this... REMEMBER, I am not able to run this on my work PC, so it may not work at all, but you see the general idea.

Global test=3
global num_ent_half=num_ent*.5

Function housekeeping()

fieldsize=2000
mmx% = 0
mmy% = 0
mmz% = 0

If EntityX(pivot)>fieldsize Then
mmx% = -fieldsize : mmy% = 0 : mmz% = 0
MoveEntity pivot,mmx%,mmy%,mmz%
test=1
EndIf

If EntityZ(pivot)>fieldsize Then
mmx% = 0 : mmy% = 0 : mmz% = -fieldsize
MoveEntity pivot,mmx%,mmy%,mmz%
test=1
EndIf

If EntityX(pivot)<-fieldsize Then
mmx% = fieldsize : mmy% = 0 : mmz% = 0
MoveEntity pivot,mmx%,mmy%,mmz%
test=1
EndIf

If EntityZ(pivot)<-fieldsize Then
mmx% = 0 : mmy% = 0 : mmz% = fieldsize
MoveEntity pivot,mmx%,mmy%,mmz%
test=1
EndIf

if test=2 then
For q = num_ent_half to num_ent
MoveEntity mesh(q),mmx%,mmy%,mmz%
next
test=3
endif

if test=1 then
For q = 1 To num_ent_half
MoveEntity mesh(q),mmx%,mmy%,mmz%
next
test =2
endif

end function()


then add this where you render

if test=3 then
RenderWorld
endif

Does it help in any way?

Andy

[This message has been edited by Andy (edited 10-24-2003).]


Click Here to See the Profile for Andy    send a private message to Andy   Edit/Delete Message   Reply w/Quote   
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/24/03 06:18 PM IP: Logged
Thanks, Andy.

To clarify: the "jump" doesn't happen at first. The first time the "housecleaning" function was called (I called it at 2000 units)...it worked beautifully. Seamless! I noticed a very very small tick but it was nothing a user would ever really notice.

Then after that, I started noticing the "40 unit" lack of accuracy, which was not exactly 40 but about that. And sometimes worse than others.

But thinking about it, wouldn't you have to temporarily disable collisions on the pivot and the scene in order for them to translate effectively? I think so. Maybe that's what caused the shift... a slight collision between the pivot and the scene as they are "shifted" around.

But most likely I think its a math problem. I will try your new code.


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
Andy
500 Post Club!

Posts: 601
From:
Registered: Aug 2001

posted 10/24/03 08:31 PM IP: Logged
>To clarify: the "jump" doesn't happen at first. The first time
>the "housecleaning" function was called (I called it at 2000 units)...it
>worked beautifully. Seamless! I noticed a very very small tick but it was
>nothing a user would ever really notice.

That's how it works here atleast!

>Then after that, I started noticing the "40 unit" lack of accuracy, which
>was not exactly 40 but about that. And sometimes worse than others.

Strange!

>But thinking about it, wouldn't you have to temporarily disable
>collisions on the pivot and the scene in order for them to translate
>effectively? I think so. Maybe that's what caused the shift... a slight
>collision between the pivot and the scene as they are "shifted" around.

I think you might be on to something. Positionentity and moveentity works the same and are both susceptiple to collision problems...

Try disabling collisions alltogether, just to test...

>But most likely I think its a math problem. I will try your new code.

Just remember that the new code works as I first described... It moves the pivot and half the entities, then leaves out rendering that frame, then moves the other half of the entities and renders again... If you feel the tick is bigger this time, then you could change the

if test=3 then
RenderWorld
endif

back to

Renderworld

Good luck.

Andy


Click Here to See the Profile for Andy    send a private message to Andy   Edit/Delete Message   Reply w/Quote   
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/25/03 03:43 AM IP: Logged
PROBLEM SOLVED!!

It was the collisions. In my function, I disable collisions on both the player and the scene before the "warp" and enable them afterwards.

The whole process in virtually seamless and now I can have huge worlds hundreds of thousands of units big and the player pivot never goes past 2000 units in any direction. I used the same code I posted above, with the collision disable/enable stuff added.

Thanks, Andy. This was an excellent idea.


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
GoSsE

500 Post Club!

Posts: 779
From: Sherbrooke, Quebec, Canada
Registered: Jun 2003

ICQ: 26677455

posted 10/25/03 04:11 AM IP: Logged
To get back to the oddities of being far away from origin, here is a small example of what happens when you go too far away.

This simply creates a camera and originates meshes to it and the camera starts flying at 50,000 units / loop. Someway above 10-20 billion units they is no meshes left on the screen! Even the plane disappears.

------------------
GoSsE Korupted - gosse@nuloen.com
Nuclear Loaded Entertainment
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Wandering Knights - Hack'n'Slash RPG
Nuclear Nibble 3D & Blasto 3D - Classic Arcade Remakes


Click Here to See the Profile for GoSsE   Click Here to Email GoSsE    send a private message to GoSsE   Edit/Delete Message   Reply w/Quote   Visit GoSsE's Homepage!
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/25/03 05:29 AM IP: Logged
Great test GoSsE! Interesting to watch!! I wonder where the geometry goes. Surely it still exists.
Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
Andy
500 Post Club!

Posts: 601
From:
Registered: Aug 2001

posted 10/25/03 07:38 AM IP: Logged
>Thanks, Andy. This was an excellent idea.

yep... And it wasn't even mine! I first saw it described in the AMOS 3D manual 10 years ago... It makes you wonder how many interesting timesaving wonderful ideas have been lost in time...

Andy


Click Here to See the Profile for Andy    send a private message to Andy   Edit/Delete Message   Reply w/Quote   
cyberseth

1,000 Post Club!


Contributing Author

Posts: 4911
From: Doncaster!!
Registered: May 2002

posted 10/25/03 07:57 AM IP: Logged
If you're interested to know why this is, it is because of this:

When a computer represents a "float", the maximum number that it stores doesn't mean the largest number, it infact means the highest number of digits, or rather, bits used.

(For demonstration's sake, I'll display this in decimal form so that it's easier.)

Let's say that this number can only go so high as 327657. That means we can only use 6 digits. It also means that 327657.1 gets rounded to 327657 automatically. Now, we could say 3.27657 no problem because we're still using 6 digits. But 32.7657493548 would be rounded to 32.7657

Gettit? That's why you should keep stuff close to the centre. The smaller the number, the higher the decimal accuracy you get. It works the same with variables too, and any other precision values in Blitz.

------------------
Please visit MUSCLE-POWER.net
Games: Blow Football - Duck Blitz - Electrobat - Veemee Arena - SPRINGY
Apps: SuperStick Fighter/Animator - Easy 3D Terrain Designer - Flare Designer/Animator - BMP Fontlib


Click Here to See the Profile for cyberseth   Click Here to Email cyberseth    send a private message to cyberseth   Edit/Delete Message   Reply w/Quote   Visit cyberseth's Homepage!
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/25/03 04:56 PM IP: Logged
Thanks for the explanation, cyberseth. I figured it had to do with floating point accuracy, but I did not know the details as such.

The coolest thing about this "huge world" model I have (now that you never actually wander too far from 0,0,0) is that you can really put lots of polygons in there, as long as the "villages" are far apart enough so that too much is never rendered at one time.

The only real limitation is watching your surface count and your textures, which can eat up your video memory. Even this can be solved by dynamically freeing parts of the world that are really far from the pivot.

[This message has been edited by Nmuta (edited 10-25-2003).]


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
Biofellis

500 Post Club!

Posts: 785
From:
Registered: Sep 2003

posted 10/30/03 11:49 PM IP: Logged
GoSsE's prog modified to show the rounding err's cyberseth explained.

------------------
This time around all the limits will be cut loose...
First release yourself. Let our dreams be as one if mankind is to evolve.
Teach your children the way, that they may understand.

Love is a power. Compassion a gift. No one need be empty.
No one need be scared.


Click Here to See the Profile for Biofellis   Click Here to Email Biofellis    send a private message to Biofellis   Edit/Delete Message   Reply w/Quote   Visit Biofellis's Homepage!
TheChange
1,000 Post Club!

Posts: 3488
From: GLD, NL
Registered: Apr 2002

posted 10/31/03 02:46 AM IP: Logged
Just an idea, but, what about 're'-placing the objects at a position by an integer number if floating point accuracy gets too low?
Or is this just Blitz' *internal* coordinates using single precision floating point variables?

Click Here to See the Profile for TheChange   Click Here to Email TheChange    send a private message to TheChange   Edit/Delete Message   Reply w/Quote   Visit TheChange's Homepage!
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 10/31/03 02:48 AM IP: Logged
thanks, Biofellis.

this has been quite an interesting study! Learned a lot.


Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!
Mt Dew

Elite Member


BlitzCoder VIP
8Bit Retro Co-Winner
3rd Place!

Posts: 147
From: Ohio
Registered: Nov 2001

posted 07/29/04 03:34 PM IP: Logged
I found this gem out trying to work a problem I had with a camera. I'm trying to create an accurate solar system as a practice in blitz and to give my daughter an interactive tutorial on the subject of the planets.

One headache I ran into was weird effects happening when I got further and further from the sun, as well as a loss of accurate floating point values as my sizes got smaller. I couldnt make my scale larger as that just magnified the distance problem and I couldnt decrease my scale as it made my smaller bodies (Running in the size range of .000001 or smaller) have problems.

Thanks to Andy for his sollution and provided example code and for Nmuta for posting his alterations of it so that this slow programmer could see it in 2 different lights and understand what plugged in where. When first suggested to me that I needed to change my system from moving my person thru the solar system to moving the solar system around the person ... well ... i was a bit daunted, but this post allowed me to cope with it and the change turned out rather simple. I definatly spent less time changing my system than I did looking for answers to why it was acting so odd.

Thanks again fellas and *BUMP* on this post because others might gain from it as well.

------------------
High Voltage - Emerald Miner - AutoBattler
Come give us a Look See at :
http://public.w3site.us


Click Here to See the Profile for Mt Dew   Click Here to Email Mt Dew    send a private message to Mt Dew   Edit/Delete Message   Reply w/Quote   Visit Mt Dew's Homepage!
MrSAK

Veteran Member

Posts: 256
From:
Registered: Jan 2004

posted 07/29/04 03:46 PM IP: Logged
I dont have B3D but wouldnt this work for "normalizing":
Move the world, not the player?

Instead of moving the camera and all, have a function that can rotate, move, etc every entity except the players?


Click Here to See the Profile for MrSAK   Click Here to Email MrSAK    send a private message to MrSAK   Edit/Delete Message   Reply w/Quote   
world_creator

1,000 Post Club!


Contributing Author

Posts: 1407
From: California, US
Registered: Nov 2001

posted 07/29/04 07:13 PM IP: Logged
nmuta, you might want to consider some kind of LOD system in the long run.

------------------
Jonathan Nguyen
world_creator@hotmail.com


Single-Surface Particles Lib. | Depth of Field and misc. Effects | Mesh Rain Tech Demo
Terrain Conforming Grids | Vertex Alpha Demo | Anti-Aliased Lines


Click Here to See the Profile for world_creator   Click Here to Email world_creator    send a private message to world_creator   Edit/Delete Message   Reply w/Quote   Visit world_creator's Homepage!
Andy
500 Post Club!

Posts: 601
From:
Registered: Aug 2001

posted 07/30/04 12:02 AM IP: Logged
>Thanks to Andy for his sollution and provided example code

I aim to please As I said it wasn't even my idea.

>I dont have B3D but wouldnt this work for "normalizing":
>Move the world, not the player?

yes, but it isn't that easy. You would end up having to write code to do everything that B3D does already and add overhead.

>Instead of moving the camera and all, have a function that can rotate,
>move, etc every entity except the players?

At the cost of complexity and speed. The way described above weighs in at just a few lines of code and works, whereas rewriting B3D's movement, rotation and collision code will add hundreds of lines and slow the program.

Simple beats complex almost every time. This is propably the single most dificult concept for new programmers to understand, but it is vital to the process.

Andy

[This message has been edited by Andy (edited 07-30-2004).]


Click Here to See the Profile for Andy    send a private message to Andy   Edit/Delete Message   Reply w/Quote   
world_creator

1,000 Post Club!


Contributing Author

Posts: 1407
From: California, US
Registered: Nov 2001

posted 07/30/04 12:03 AM IP: Logged
well, i guess you could parent everything in the world to a small cube or whatever and move just the cube.

------------------
Jonathan Nguyen
world_creator@hotmail.com


Single-Surface Particles Lib. | Depth of Field and misc. Effects | Mesh Rain Tech Demo
Terrain Conforming Grids | Vertex Alpha Demo | Anti-Aliased Lines


Click Here to See the Profile for world_creator   Click Here to Email world_creator    send a private message to world_creator   Edit/Delete Message   Reply w/Quote   Visit world_creator's Homepage!
Andy
500 Post Club!

Posts: 601
From:
Registered: Aug 2001

posted 07/30/04 12:14 AM IP: Logged
>well, i guess you could parent everything in the world to a small cube or
>whatever and move just the cube.

But it doesn't solve the problem - the errors due to floating point inaccuracy and Z-buffer inaccuracy are still there.

Andy


Click Here to See the Profile for Andy    send a private message to Andy   Edit/Delete Message   Reply w/Quote   
Nmuta

500 Post Club!

Posts: 974
From: Philadelphia, PA U.S.A
Registered: Mar 2003

posted 07/30/04 12:24 AM IP: Logged
Yeah...the solution we came to earlier is fast and works like a gem.

Click Here to See the Profile for Nmuta    send a private message to Nmuta   Edit/Delete Message   Reply w/Quote   Visit Nmuta's Homepage!

      next oldest topic
next newest topic
Post A Reply
Hop to:

Contact Us | BlitzCoder | Privacy Statement

Copyright© 2000-2004, BlitzCoder. All rights reserved.

Powered by Infopop www.infopop.com © 2000
Ultimate Bulletin Board 5.47d