Modelsupport in 2d world?

Started by
7 comments, last by stevenmarky 17 years, 8 months ago
Hi Ive been fooling around a bit with both 2d and 3d but dont really like how 3d normally handles stuff. But in my huge, tilebased world i have actor, which can go in 8 directions (think starcraft) and prerender every thinkable configuration of actor (with equipment etc you know the drill) in all directions seems stupid and extremely inefficiant. What options do i have? I checked out goblin 2d+ engine but it seems slow. But i dont wanna go for a full blown 3d engine either (i only need a top-down rts camera so creating meshes for my intire world seems stupid as you only see about 3% of it at a given time). Also the 3d engines ive looked at is messy when it comes to ui and particles. Is there any plugin that can render models ( i need both anim and textures but no light)? Ive heard of voxel endering but im to inexperienced to implement such a system myself. I would really appriciate some direction Erik
Advertisement
How many frames of animation per direction are you rendering and how many different sets of armor are they wearing? Is it just different colors?

There may be many ways to optimize the amount of frames you actually need to pre-render. For example if you are using a 3d API to render like OpenGL/Direct3D you can get away with switching texture coordinates to "mirror" sprites with no overhead if you just generate the texture coordinates at load time. That saves you rendering 3 directions.

Since I don't know what model format you ar using I can't really point you to any specific links that might help you out although this link to the NeHe OpenGL tutorial site has an example with source code to load a Milkshape3d model and display it.

I have not tried Ogre3d because I am not all that knowledgable of things 3d yet but I have tried Irrlicht which does have decent 2d capabilities with very little code and also has support for model loading and rendering etc.
Evillive2
yeah i know about the 8 dir becomes 5 directions trick with mirror, but that way my guys will swap with hand they hold the gun in.

id prefer any format editable (direct or through conversion) in 3d studio max. Now i just render to a png and load all the stuff in my 2d engine (hge).

I have like 15 sets of guys but not all of them can have all equipent but the total sum of animations becomes really high if i have to prerender.

The problem with a full 3d sollution is that they normally (for example irrlicht) must create all 3d objects. While a 2d sollution creates all units but draws animations for only the guys under the "camera". And as this is sort of a city simulation, i might have over 1000 guys (fine if they are simply 2d information, but a lot if each guy has a live mesh/3d model data assigned to it).

I dont really find anything about voxels. Could that be good for this? The optimal thing would be to have access to the models, rotate and "draw" at screenpos x y. Like you do with a sprite...

The search goes on,
Erik
also, could i draw the guy and his gun separately? If he's going up or down its easy but in which order to draw if hes going sideway? Will it not look ugly as the arms cannot overlap?
If your going to render the character and the gun seperately, then in the gun images you will need a gun image for every frame of the characters animation with only the part of the gun that is visible in that frame.

So you can have any character holding that gun, you just draw the character out, and then draw the gun for that frame of the animation over top. This is how you would also do different outfits. You just have each outfit in the different poses and then draw it right over top.

So you'd still have the character in all directions doing everything, and you'd still have alot of the same gun, but you could mix and match characters and guns.

NOTE: I haven't done this I've only read about it so I might make it sound easier then it actaully is.
FOLLOW ME ON TWITTER OR MY BLOG
Unfortunately, there's not going to be an ideal solution for your situation. Fortunately, there are many well-understood solutions that involve some type of compromise.

First, there's the suggestion to pre-render all of your sprites. This is the classic route, including games like Starcraft and Diablo. If you go this route, you either have to limit the total number of variations or devise some type of in-memory compression (or a combination of the two).

Second, there's the suggestion to use 3D models for your "heavily animated" characters and 2D for your backdrops (see the original Alone in the Dark for a very early example). I personally like this approach alot, and it works well, and gives you a lot of flexibility. The drawbacks are the 3D hardware/API requirements (may or may not be a big deal for you) and potential quality variations, i.e. real-time 3D characters often don't look as good as the hand-painted / pre-rendered backdrops.

Third, and this is the most complex, is to have the best of both worlds. This is the approach that SimCity 4 takes. They use 3D meshes for *all* of their artwork. They dynamically stitch together the models and animations (based on the current state of the game simulation) and render this to an offscreen buffer (with anti-aliasing, etc.). They then use that as a sprite. This can allow you to spread rendering across many frames or to batch it creatively. The complexity is in managing a comprehensive dirty-rectangle system to absolutely minimize the amount of re-rendering of 3D meshes to sprites that you have to do. But, it gives you an incredible amount of flexibility with your artwork and performance.

If you google for SimCity and isometric you should find the page on the official SimCity website describing (in very high level terms) the technique that they use. Very cool stuff...
a good guide although not much news for me. I know you can mix 2d and 3d, i talk about it in this thread. How to do it is the real question. Im not good enough neither interested in coding 3d support myself, seing how this might take a couple of years.

So the answer is no model-plugin or voxelsystem plugin? That leaves me goblin2d+ engine which seems not well supported and buggy. Which leaves me with full 2d and prerendering, optimizing any way i can with drawing layers of equipment. Or?

Thanks for your engagements
Erik
And I thought direct3d and openGL are as easy as 3dMax, as long as you do not want eyecandy or superspeed (hey you a drawing some small figures, others can do whole worlds with 4 pass textures in GeForce2, so speed is no issue)
If you are drawing 1000+ sprites of any complexity pre-rendered sprites seem the best way to go.

"also, could i draw the guy and his gun separately? If he's going up or down its easy but in which order to draw if hes going sideway? Will it not look ugly as the arms cannot overlap?"#

You could also have a seperate sprite for the nearest arm so they can overlap.
Or if you have Z-buffer information available you could render this into another layer of the sprite (a bit like the alpha-layer), then occlusion would be easy (but this might be complex to program and could slow down rendering).



This topic is closed to new replies.

Advertisement