Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / load objects during gameplay?

Author
Message
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 6th Jun 2012 17:42 Edited at: 6th Jun 2012 17:45
I think that's what I need to do here, but I'm not even sure about that. Maybe you guys can help me decide what to do in this situation.

My game is divided into separate rooms in a castle. Initially I had planned to load each room as needed, but it really slowed the game down so I made everything load at the beginning and excluded the rooms that weren't currently occupied by the player.
Apparently I've run out of memory though, so I can either split the castle in half with load screens or figure out a way to load the adjacent rooms and delete the others from memory during gameplay.
I think..?

I'm really not sure what to do here, I didn't account for memory at all, as I figured the exclude object command would keep everything balanced.


EDIT
Here's a video of part of the game to try to give you an idea of how it's laid out, hopefully somebody can give me some advice!
http://www.youtube.com/watch?v=D58uOcuCDbs

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 6th Jun 2012 17:56
DBO loads fastest. You should be able to load rooms separately because they are all hidden by each other. But if you are running out of memory it seems to me that you are not using simple box objects, and that's all you really need is box walls.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 6th Jun 2012 18:04
Yes I'm using dbo files, for the most part.
As for simple walls and a low poly count, I'm pretty far from that.
One room might take as long as 15 seconds to load.

If I split the castle in half via load times I could add in a long hallway to cover it up, so long as it's possible to load objects during gameplay. Can I do this?

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 6th Jun 2012 18:06
Quote: "As for simple walls and a low poly count, I'm pretty far from that. "


Does that mean you aren't using Normal Maps? Normal Maps are a cheat to create very detailed walls from simple boxes.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 6th Jun 2012 18:11
Quote: "Does that mean you aren't using Normal Maps? Normal Maps are a cheat to create very detailed walls from simple boxes."


It does indeed. As far as I've been able to tell I can't have textures + lightmaps + normal mapping on one object in dbpro, and I feel like I need lightmaps for this project.
I have to say, I don't like where this conversation is going though
the idea of starting over scares the crap out of me at this point.

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 6th Jun 2012 18:16 Edited at: 6th Jun 2012 18:23
It may scare you, but to make a castle from boxes is very quick. You could make a castle in a day I think. You can keep your tunnels. As for light maps, there are shaders that work with Normal Maps, and have lighting. Normal Mapping with Specular Mask looks quite good.

Try this thread...
http://forum.thegamecreators.com/?m=forum_view&t=194365&b=1&p=0

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 6th Jun 2012 18:32
Well that opens up a big can of worms for me. It seems like for something like that to work, I'd have to create the objects + textures and then assemble them within dark basic instead of just importing object 1, which is the whole room already assembled.

I think I'd rather go with the in game load times.
But for clarification, I'm assuming now that it isn't possible to load objects in the background, during game play?

http://mattsmith.carbonmade.com/
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 6th Jun 2012 18:33 Edited at: 6th Jun 2012 18:48
It is, but you make your objects sound too big to work. 15 seconds is a long time...

You can import the objects, then texture them. In fact the whole castle will be small enough to load in one go if you remake it. Make a base plain, cut out the walls with a grid setup, and cutting tool.. extrude Y, stick on a ceiling... done.





wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 6th Jun 2012 18:57 Edited at: 6th Jun 2012 19:03
I use Anim8or too.

I just can't re make everything though, and it's not even so much because I don't want to redo the graphics, more so because I suck at coding and anything new I want to implement like shaders is probably going to take a long time for me to get running.
I've been working with basic since qbasic back in the early 90's and I still don't know what I'm doing.
So at this point I just want to get the game done as soon as I can.


By the way, I just checked my total poly count so far and it's 488,872 which doesn't seem that unreasonable to me. I'm guessing the entire map will be around a million polys, still not so unreasonable.

http://mattsmith.carbonmade.com/
Fallout
23
Years of Service
User Offline
Joined: 1st Sep 2002
Location: Basingstoke, England
Posted: 6th Jun 2012 19:06 Edited at: 6th Jun 2012 19:09
Some games use realtime loading. The technique would be to convert your models into a format that you can load in a streaming fashion (i.e. a bit at a time, so the frame rate doesn't drop), and then create them when needed.

For example, you could convert your objects to a memblock in code. Then cut that memblock into 10 smaller pieces and save them all. Then, when approaching a transition point in the game, identify that the room will need to be loaded and begin loading one file per second for example. Once they're all loaded, you should be able to combine them into one memblock and then create an object from that memblock with a very small pause.

If the player moves away from the transition point and towards another, you dump what you loaded so far and start loading the next lot.

So you'd need to:
a) Write a small program that can take a model file, convert to memblock, split into small loadable memblocks and save to files.
b) Write a function that can load these sequentially and rebuild your room.
c) Write a function that uses portal triggers to know when to start loading the next room.

You may need to use the same process for your image files if they're large too.

I vaguely remember someone may've written a plugin that can do realtime loading for you, but I couldn't find it with a quick search.

It's definitely possible to do realtime loading, but as Pincho has said, your world doesn't look as detailed as I would expect for you to be running out of memory so soon. Either way though, if you can crack realtime loading, then your world can be as large as your HD allows, which is quite an awesome prospect.

Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 6th Jun 2012 21:35 Edited at: 6th Jun 2012 21:42
wattywatts,

The following is from our original post. We hope to have it released soon and will post it on this link.
Try the attached demo.

http://forum.thegamecreators.com/?m=forum_view&t=190035&b=8


We are currently working on a command for importing Giles “.gls” files into DBPro.
We currently load the giles scene as one object with a limb hierarchy.
All entities are loaded and assigned a default place holder mesh.
Entities prefixes determine there color and size.
Attached is an exe of our progress so far.



EDIT: The Scene was created in Giles which is a FREE program.
Here is the link for more info
http://www.frecle.net/index.php?show=giles.about


[img][/img]


WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 6th Jun 2012 21:43 Edited at: 6th Jun 2012 21:52
OOpps double post

WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
Stab in the Dark software
Valued Member
23
Years of Service
User Offline
Joined: 12th Dec 2002
Playing: Badges, I don't need no stinkin badges
Posted: 6th Jun 2012 21:51 Edited at: 6th Jun 2012 21:53
Dam browser keeps double posting Sry

WindowsXP SP3,Vista,Windows 7 SP1, DBpro v7.7RC7
Stab In The Dark Editor
The coffee is lovely dark and deep,and I have code to write before I sleep.
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 6th Jun 2012 22:32
Quote: "My game is divided into separate rooms in a castle. Initially I had planned to load each room as needed, but it really slowed the game down so I made everything load at the beginning and excluded the rooms that weren't currently occupied by the player.
Apparently I've run out of memory though, so I can either split the castle in half with load screens or figure out a way to load the adjacent rooms and delete the others from memory during gameplay.
I think..?"


If you can't have all of that stuff loaded, you're going to have to scale back. The only question is where. The first thing to do is look for waste. Maybe you are loading multiple copies of the same texture for different objects, for example. Then decide if the level will get smaller, or less detailed, or both.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 6th Jun 2012 23:52
Alright, is there a really easy to use method of realtime lighting? If I scale back the polygons the lightmaps are going to look like dog crap.
If you've watched the video in the first post and can see past the low resolution, you can see that there's some really dark areas in the game, and I'd really like to keep it that way. I'm not really sure where to go with it now.

http://mattsmith.carbonmade.com/
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 11th Jun 2012 09:38
not sure if mentioned already but how about the grid based loading?


0000000000
0222222220
0233333320
0233553320
0233553320
0233333320
0222222220
0000000000

[HOPUFULLY THAT BOLDED PROPERLY LOL]

anyway its a simple diagram of my point... 5 being the players immediate position and 2 being the load barrier and 0 being the shift points and a ghost point... or fog of war effect... when the player enters region 3 the map starts to load nearby panels... segments...

if this makes sense...

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 12th Jun 2012 21:44 Edited at: 12th Jun 2012 21:55
MrValentine, that would work except that the rooms are single objects and what not.

I have another problem at the moment though - I've gone through and reduced polys, changing walls to flat plains, decimating objects in blender and re texturing them, etc.
My whole game as of now is only 583,764 polygons, but when I try to run it, the application crashes. If I comment out parts of the map however, it runs fine. I have no idea if this is because of polygons anymore, because it seems like that small number should be able to load into memory without a hitch.
Could it possibly be the textures? I'm reusing textures throughout the game, they're all in a texture folder, but what about the lightmaps? Dark Lights sometimes creates over 60 png's of lightmaps per room, there's not really anything I can do about this though. So if that's the problem, then... hell!
Any insight would be appreciated.


EDIT

From what I've read, it shouldn't be a stretch to render several million polygons on screen at once, so it just can't be the poly count, right?

EDIT EDIT

The lightmaps add up to about 35 mb's worth.. so that couldn't be the problem either, could it?

http://mattsmith.carbonmade.com/
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 12th Jun 2012 22:10
Quote: " 583,764 polygons"

dbpro has a limit of around 22 000 polys so if any part of your map, which is a single mesh, has more than that you app would crash

Quote: "From what I've read, it shouldn't be a stretch to render several million polygons on screen at once,"

that is a huge amount of polys. If you want to have constant and decent framerate you'll have to cut the number down to around 100 000. You need to render only the polys which are visible to camera. That is of course hard to do in dbpro. What you can do is to chop your map into small peaces so you can take advantage of aoutomatic frustum culling dbpro provides and make sure that each map piece doesn't have more than 22000 polys

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 12th Jun 2012 22:22 Edited at: 12th Jun 2012 22:23
Quote: "dbpro has a limit of around 22 000 polys so if any part of your map, which is a single mesh, has more than that you app would crash"


That sort of makes sense, but there's one floor where I didn't separate the rooms as I didn't want doors there, it's one solid dbo file with 148,341 polys and it loads fine. ?
But it does crash when I try to load that with the rest of the map.. so either way I guess it's still about polygons then?

I should add though, the rooms not on the screen are excluded, so I still don't see how it's causing an issue.

http://mattsmith.carbonmade.com/
Brendy boy
20
Years of Service
User Offline
Joined: 17th Jul 2005
Location: Croatia
Posted: 12th Jun 2012 22:40
Quote: "it's one solid dbo file with 148,341 polys and it loads fine."

then it's probably made only out of vertices which is fine for dbpro. Limit only applies to meshes made out of vertices and indices.

How many RAM do you have? Check the memory consumption when you run your program to see if it reaches 2 GB (single process limit)

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 12th Jun 2012 23:46
It get's up to 1,379,576 k memory usage before it quits on me. That's ridiculous!
What in the world could be causing that?

http://mattsmith.carbonmade.com/
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 12th Jun 2012 23:51
I dunno how your sections are made but 3DWS creates a single light map... Perhaps try that?

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 13th Jun 2012 00:26
Is that what you think the problem is then, the light maps?
I've always found 3dws's light maps to be really inaccurate, I'd hate to have to use that.

http://mattsmith.carbonmade.com/
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th Jun 2012 01:04
I know what you mean... I was looking to use DL but can never seem to get it to not crash...

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 13th Jun 2012 01:39
Yeah I was having problems with that as well, the only way I can get it to work is by setting the compatibility to windows 98/me.

http://mattsmith.carbonmade.com/
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th Jun 2012 02:52
Ahh so thats what I did last time... Will try it soon

Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 13th Jun 2012 03:01
Quote: "It get's up to 1,379,576 k memory usage before it quits on me. That's ridiculous!
What in the world could be causing that?"


Probably textures.

512x512x32bit Texture = 1MB of Memory (More if mipmaps)
1024x1024x32bit Texture = 4MB of Memory
2048x2048x32bit Texture = 8MB of Memory

If you have really big textures or a lot of them then you will use a ton of memory. You said you were using Light Maps.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 13th Jun 2012 03:25
Quote: "1024x1024x32bit Texture = 4MB of Memory"

I have a question about that, if I was to take a 1024x1024 png and convert it to a jpeg of the same size, would it still take up the same amount of memory?
Either way I guess it must be the light maps.

http://mattsmith.carbonmade.com/
MrValentine
AGK Backer
15
Years of Service
User Offline
Joined: 5th Dec 2010
Playing: FFVII
Posted: 13th Jun 2012 03:33
To test the theory diagnosis... You could copy your project... Then replace all the lightmaps with placeholder 256x256 textures...

Or even 64x64 and work your way up for the optimax resolution should it work...

basjak
16
Years of Service
User Offline
Joined: 16th Apr 2010
Location: feel like signing up for mars
Posted: 13th Jun 2012 03:52
turn your castle into BSP file. in this case you wont have trouble.

wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 13th Jun 2012 05:35
I just screwed this up even more by messing around with normal maps. Now I NEED them, and I don't think I'll be able to get shadows in there.
You can't use lightmaps AND bump maps, can you? At least not with out of the box dbpro commands?
I'd try some of the real time lighting stuff from evolved, but the code is just way over my head.

http://mattsmith.carbonmade.com/
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 13th Jun 2012 05:51 Edited at: 13th Jun 2012 05:52
Quote: "Quote: "1024x1024x32bit Texture = 4MB of Memory"
I have a question about that, if I was to take a 1024x1024 png and convert it to a jpeg of the same size, would it still take up the same amount of memory?
Either way I guess it must be the light maps.
"


My comments were the traditional truth about textures in memory. They apply to DBPRO especially for jpeg and png textures.

It turns out the situation is a little different for DDS textures. Although DBPRO may also be storing them uncompressed in video memory, some modern games can store them compressed.

http://gamedev.stackexchange.com/questions/5171/how-much-memory-does-a-texture-take-up-on-the-gpu

Quote: "Excerpt:
JPG and PNG files will almost always be smaller on-disk than in memory; they need to be decompressed on-the-fly to acquire raw RGB data, thus requiring more processing power for the loading and more RAM afterwards. So many modern engines opt to store the same format on disk as they do in memory, leading to files that are the same size as the texture's memory requirements (but also larger than a PNG or JPG). RGB/RGBA and S3TC/DXTn/BCn are the most widely used formats, because they are read straight into memory without any processing (DXT textures are precompressed).

If you use a image with mipmaps, the texture will require 4/3 as much memory. Additionally, the texture width and height may be rounded up internally to be a power of two on old or less capable hardware, and on some very limited hardware, also forced to be a square.

More info on DXT: it's a lossy compression; this means, some color data is lost when compressing the texture. This has a negative impact on your texture, distorting sharp borders and creating "blocks" on gradients; but the benefits are far better than the disadvantages (if you have a texture that looks horribly bad in DXT, just keep it uncompressed; the other ones will make up for the size loss). Also, since the pixels are compressed by fixed-size blocks, the texture width and height must be a multiple of four."


Olby
22
Years of Service
User Offline
Joined: 21st Aug 2003
Location:
Posted: 13th Jun 2012 12:29
Ages ago IanM wrote a plugin that could load memblocks real time without interrupting the gameplay. If thats what you want then download it here: http://www.matrix1.demon.co.uk/

Direct link: http://www.matrix1.demon.co.uk/DBPro/downloads/Matrix1Async_exe02.zip

Someone mentioned Gile[s] loader (btw Gile[s] is freeware now), well here you go. It has been done long ago so there's no need to reinvent the wheel. Full thread: http://forum.thegamecreators.com/?m=forum_view&t=69186&b=1

Direct link: https://forumfiles.thegamecreators.com/download/936386

Gile[s] will allow you to work on lightmapping with intricate detail, so if you still want to use lightmaps try it out. Might work out for you.

And my suggestion is you cut down on poly's. I suppose it's not as much about memory usage for textures rather than the amounts of mesh data you're storing at one time. You can do all sorts of tricks with shaders. For example castle walls will definitely benefit from parallax mapping with per pixel lighting and some shadows. You can even ask someone to help you out with setting up the parallax shader to apply light maps as well. Endless possibilities to optimize. Hope some of this helps you out. Cheers.


Intel Core2Duo 2.2GHZ, 2GB, GeForce 8600M GT 1280MB, Windows Vista Ultimate SP2, PureBasic 4.61 + DarkGDK 2.0

Login to post a reply

Server time is: 2026-07-07 17:08:30
Your offset time is: 2026-07-07 17:08:30