Game development and site

Hello guys. It's benny from the gamedev.se forum here for those who know me a little. (hObbe and Gridur I assume).

You seem to be a nice little team Cool

As a fellow developer I recognize the sheer amount of time you've spent on all these little games as well as the bigger ones (Time breaker, pirate quest, aquanauts) and I'm impressed with what you've accomplished in your spare time.

And so I have a few (a lot) of questions if someone feels like they have the time to answer.

1. how many are there in your team?

2. how long did it take to make time breaker and pirate quest?

3. how well have you managed to market and distribute time breaker and pirate quest? do you get any sales?

4. What happened with aquanauts? Smiling

5. do you use directdraw or direct3d for the minigolf and pirate quest games?

6. does Gridur make all the graphics? (great job, whoever did it Laughing out loud)

7. have you created an actual company to receive income in sweden?

8. how well has bmtmicro worked out for you?

just interesting to know since we pretty soon will be in the same situation hopefully.

great job. and answer when you have time. hopefully in the near future Laughing out loud

would also like to add that pirate quest is a nice twist on the match-3's and the hub was a very nice little program. astrocreeps rocks (no pun intended).

users avatar

Re: Game development and site

Hi Benny!

[quote="solidbenny"]
1. how many are there in your team?
[/quote]

Daniel, programming
hObbE, programming
Johno, programming and music
Gridur, graphics

[quote="solidbenny"]
2. how long did it take to make time breaker and pirate quest?
[/quote]

Time Breaker took a lot of time ~18 months much because we where testing different kinds of graphics and gameplay.
Pirate Quest ~ 6 months

[quote="solidbenny"]
3. how well have you managed to market and distribute time breaker and pirate quest? do you get any sales?
[/quote]

Time Breaker was sold through a publisher Alawar and has sold some, not so much that we can live off it Smiling But enough to buy some computerparts and programs and resources for other games...
We wanted to be able to sell the games ourselves so we have just recently started to sell on spellofplay.com. No sales so far Smiling

[quote="solidbenny"]
4. What happened with aquanauts? Smiling
[/quote]

It had no well defined gameplay and we where still working on trying to find out what game we where making and saw no end to the project. So we quit working on it and started work on much more well defined projects like Pirate Quest.

[quote="solidbenny"]
5. do you use directdraw or direct3d for the minigolf and pirate quest games?
[/quote]

Direct3D

[quote="solidbenny"]
6. does Gridur make all the graphics? (great job, whoever did it Laughing out loud)
[/quote]

Gridur made graphics for Time Breaker and Pirate Quest, the graphics for Aqua was made by Mats.

[quote="solidbenny"]
7. have you created an actual company to receive income in sweden?
[/quote]

Yes: Spell of play studios

[quote="solidbenny"]
8. how well has bmtmicro worked out for you?
[/quote]

Well we are still evaluating it Eye-wink

[quote="solidbenny"]
just interesting to know since we pretty soon will be in the same situation hopefully.
[/quote]

Gr8! let us know of your progress! looking forward to play your games!

Daniel

users avatar

Game development and site

Hi!

Glad to hear from you and getting some feedback! Laughing out loud

I have only one comment regarding question 6. I actually made some of the graphics for Time Breaker, the pad and the droid for example Laughing out loud

programmers art Sticking out tongue

Feel free to contact us if you have any more questions or if you want some feedback yourself!

regards,
hObbE

users avatar

Re: Game development and site

[quote="dntoll"]
[quote="solidbenny"]
2. how long did it take to make time breaker and pirate quest?
[/quote]

Time Breaker took a lot of time ~18 months much because we where testing different kinds of graphics and gameplay.
Pirate Quest ~ 6 months
[/quote]

Pretty obvious what it does when you have much of the technology and research out of the way Smiling

[quote="dntoll"]
[quote="solidbenny"]
3. how well have you managed to market and distribute time breaker and pirate quest? do you get any sales?
[/quote]

Time Breaker was sold through a publisher Alawar and has sold some, not so much that we can live off it Smiling But enough to buy some computerparts and programs and resources for other games...
We wanted to be able to sell the games ourselves so we have just recently started to sell on spellofplay.com. No sales so far Smiling
[/quote]

good to hear it has given you enough to do that at least. the hub is a good idea but I'd prefer if everyone used it Laughing out loud and I sure you'd sell a lot if more people knew about it. how come you decided to leave alawar and distribute yourselves? don't they help to market the game? did you consider realarcade, reflexivearcade, popcap and so on..?

hey I'll buy pirate quest Smiling I like the price. just enough.

[quote="dntoll"]
[quote="solidbenny"]
4. What happened with aquanauts? Smiling
[/quote]

It had no well defined gameplay and we where still working on trying to find out what game we where making and saw no end to the project. So we quit working on it and started work on much more well defined projects like Pirate Quest.
[/quote]

I think thats a good idea. We've worked on the same game for over 5 years telling everyone "its almost ready!" for 3. It's a lot better to start small and we'll probably take a step back for the next game.

[quote="dntoll"]
[quote="solidbenny"]
5. do you use directdraw or direct3d for the minigolf and pirate quest games?
[/quote]

Direct3D
[/quote]

ok. thought so. using the time breaker engine I assume? how do you find
the performance on drawing lots of tiles? its difficult to batch well. we've used almost every technique we know of to batch and cut polys to get decent framerates. wasn't like that in the directdraw times Smiling

[quote="dntoll"]
[quote="solidbenny"]
6. does Gridur make all the graphics? (great job, whoever did it Laughing out loud)
[/quote]

Gridur made graphics for Time Breaker and Pirate Quest, the graphics for Aqua was made by Mats.
[/quote]

okay, really good job in pirate quest, especially the swords and skulls and so on. those objects.

[quote="dntoll"]
[quote="solidbenny"]
7. have you created an actual company to receive income in sweden?
[/quote]

Yes: Spell of play studios
[/quote]

how was the process of creating a company? I imagine it to be tons of work. it would be great if I could ask you for tips when we come that far..

[quote="dntoll"]
[quote="solidbenny"]
8. how well has bmtmicro worked out for you?
[/quote]

Well we are still evaluating it Eye-wink
[/quote]

ok. let me know how it works out Smiling

[quote="dntoll"]
[quote="solidbenny"]
just interesting to know since we pretty soon will be in the same situation hopefully.
[/quote]

Gr8! let us know of your progress! looking forward to play your games!
[/quote]

Feel free to look at http://www.solidcore.se/roadclub for screenshots and info about our current game Smiling A demo should be complete within a few weeks.

oh and almost none of your online games linked from this forum work anymore Sad including the latest aquanauts release but maybe thats intentional.

oh and do you know how Gridur would feel about making a few character portraits for our game? I know he's busy but we really need help creating a couple more (2-3) for the game to have enough.

users avatar

Game development and site

[quote="hObbE"]Hi!

Glad to hear from you and getting some feedback! Laughing out loud

I have only one comment regarding question 6. I actually made some of the graphics for Time Breaker, the pad and the droid for example Laughing out loud

programmers art Sticking out tongue

Feel free to contact us if you have any more questions or if you want some feedback yourself!

regards,
hObbE[/quote]

I'd be happy to throw some pirate quest feedback at you if you want.

heh programmers art rules Laughing out loud

I'd love if you wanted to give feedback on our upcoming demo. I believe you gave us some on the previous last year. I'll let you know when it's out. Or you'll probably see it on gamedev.se.

users avatar

Game development and site

[quote]oh and do you know how Gridur would feel about making a few character portraits for our game? I know he's busy but we really need help creating a couple more (2-3) for the game to have enough.[/quote]

I wouldnt mind helping out, give me a note here or on gamedev.se or maybe a mail to gridur@gmail.com and I'll see what I can do!

I checked out for roadclub not to long ago, I can see that the people is ancious to know what happend to it so it's nice to hear that it's coming along as planed! Cant wait for the demo release! =)

Thanx for the comments and im glad you liked the gfx in Pirates Quest! =)

users avatar

Re: Game development and site

[quote="solidbenny"]
...how come you decided to leave alawar and distribute yourselves? don't they help to market the game? did you consider realarcade, reflexivearcade, popcap and so on..?
hey I'll buy pirate quest Smiling I like the price. just enough.
[/quote]

Well, I guess we wanted to do our own thing, we wanted to try an idea that you should be able to sell games that are not completed yet for a lower price... The customer gets free upgrades after that... So the we release games like Pirate Quest that are playable but not polished for a low price and work on the games we get payed for...

We have not really started to market this yet, Since we are new at selfpublishing it takes some time to get everything working.

[quote="solidbenny"]
ok. thought so. using the time breaker engine I assume? how do you find
the performance on drawing lots of tiles? its difficult to batch well. we've used almost every technique we know of to batch and cut polys to get decent framerates. wasn't like that in the directdraw times Smiling
[/quote]

TB was built on an "engine" that was very complex, so we learnt a lot from that and have built a much less complex engine for our new games...

As batching is concerned, I use the same texture for all tiles and build one mesh every frame with all tiles and draw it in one draw call...

[quote="solidbenny"]
how was the process of creating a company? I imagine it to be tons of work. it would be great if I could ask you for tips when we come that far..
[/quote]

I guess hObbE could answer this one better than me, since he is the one owning the company Sticking out tongue

[quote="solidbenny"]
Feel free to look at http://www.solidcore.se/roadclub for screenshots and
oh and do you know how Gridur would feel about making a few character portraits for our game? I know he's busy but we really need help creating a couple more (2-3) for the game to have enough.[/quote]

The screenshot looks very nice, I want to play now!

Do not steal Gridur Eye-wink

Daniel

users avatar

Game development and site

[quote="Gridur"][quote]oh and do you know how Gridur would feel about making a few character portraits for our game? I know he's busy but we really need help creating a couple more (2-3) for the game to have enough.[/quote]

I wouldnt mind helping out, give me a note here or on gamedev.se or maybe a mail to gridur@gmail.com and I'll see what I can do!

I checked out for roadclub not to long ago, I can see that the people is ancious to know what happend to it so it's nice to hear that it's coming along as planed! Cant wait for the demo release! =)

Thanx for the comments and im glad you liked the gfx in Pirates Quest! =)[/quote]

wow great. as long as you're open to it. I don't want to steal your time from Spell of Play of course. I'll send you an email.

Great to hear that you're interested. We're pretty anxious to get it out there! wouldn't say that its coming along as planned after this long though Sticking out tongue

users avatar

Re: Game development and site

[quote="dntoll"][quote="solidbenny"]
...how come you decided to leave alawar and distribute yourselves? don't they help to market the game? did you consider realarcade, reflexivearcade, popcap and so on..?
hey I'll buy pirate quest Smiling I like the price. just enough.
[/quote]

Well, I guess we wanted to do our own thing, we wanted to try an idea that you should be able to sell games that are not completed yet for a lower price... The customer gets free upgrades after that... So the we release games like Pirate Quest that are playable but not polished for a low price and work on the games we get payed for...

We have not really started to market this yet, Since we are new at selfpublishing it takes some time to get everything working.
[/quote]

ah good idea. so pirate quest isn't 100% yet? the price will be higher if you buy when it IS 100% I assume?

I did notice a few things that could be nicer but if it isn't ready I understand.

[quote="dntoll"][quote="solidbenny"]
ok. thought so. using the time breaker engine I assume? how do you find
the performance on drawing lots of tiles? its difficult to batch well. we've used almost every technique we know of to batch and cut polys to get decent framerates. wasn't like that in the directdraw times Smiling
[/quote]

TB was built on an "engine" that was very complex, so we learnt a lot from that and have built a much less complex engine for our new games...

As batching is concerned, I use the same texture for all tiles and build one mesh every frame with all tiles and draw it in one draw call...
[/quote]

Yeah, we'll do the same thing with version 2 of our engine. Take everything you've learnt and build from scratch using the old code where possible.

This is interesting. as far as we've understood you can only have one set of texture coordinates on each vertex which makes it impossible for two polygons using the same vertex to have different coordinates and therefore can't map different parts of the texture. we only have one texture but batch and draw all polygons using the same part of the texture after each other... I think we've misunderstood something here that slows us down considerably. I would be great if you could shed some light on this Smiling

To sum up, if we have a situation with two quads side-by-side made by 6 vertices, the two in the middle would have one texture coordinate each. How can the two quads show two completely different parts of the texture if that's the case?

[quote="dntoll"]
[quote="solidbenny"]
how was the process of creating a company? I imagine it to be tons of work. it would be great if I could ask you for tips when we come that far..
[/quote]

I guess hObbE could answer this one better than me, since he is the one owning the company Sticking out tongue
[/quote]

okay I'll wait for his answer then Smiling

[quote="dntoll"]
[quote="solidbenny"]
Feel free to look at http://www.solidcore.se/roadclub for screenshots and
oh and do you know how Gridur would feel about making a few character portraits for our game? I know he's busy but we really need help creating a couple more (2-3) for the game to have enough.[/quote]

The screenshot looks very nice, I want to play now!

Do not steal Gridur Eye-wink
[/quote]

heh nice to hear. we'll do our best to complete it soon.

hey I'm just boooorrowing him a little Smiling Seriously though, I'd only ask for as little as I can get. I will of course not take time from your projects. It's up to him and you to decide if it's okay. If not, I understand.

users avatar

Game development and site

[quote]This is interesting. as far as we've understood you can only have one set of texture coordinates on each vertex which makes it impossible for two polygons using the same vertex to have different coordinates and therefore can't map different parts of the texture. we only have one texture but batch and draw all polygons using the same part of the texture after each other... I think we've misunderstood something here that slows us down considerably. I would be great if you could shed some light on this
[/quote]

Ah, we create one quad for each tile and sprite... so no trianglestrips but a trianglelist.
So to draw entire screen full of quads we draw 24*32 = 768 different quads, that use the same "shader" but share no vertices...

/Daniel

users avatar

Game development and site

ah okay. that makes sense. it's a balance there I guess. we don't have so many different "tiles" since we're drawing like 3-4 terrain types. we use trianglelists for scenery objects.

users avatar

Game development and site

Yo!

Regarding the business stuff; We have the simplest setup possible, and we are very good friends and so far there has been no need to overcomplicate matters. Keep it as simple as you can, but have a head up for when you begin to earn some money, if you make it could become a problem if you are not 100% sure of how to divide profits etc.

Spell of Play Studios is also more of a free collaboration than a business venture, as Toll said we are mostly interested in doing our own thing. Sometimes that mean going solo sometimes it means collaboration. And collaborating on the web/hub could also genereate benefit for all our projects.

Having a publisher is really nice if you want to sell many copies of your game, and Alawar have done a splendid job! Time Breaker is present on all major portals (including, RealArcade, Oberon, BigFish, Reflexive..) and it is released on CD in some countries.

And yes it is correct that as Pirate Quest evolves, becomes bigger and better the price will increase, as a paying customer you get this for free. It would be great if you could point out some stuff to improve (customer == boss) Smiling

Regarding the tech stuff, i think you should be able to have multiple sets of texture coordinates. This was even possible in early versions of OpenGL and is the basis of using lightmaps.

regards,
hObbE

users avatar

Game development and site

so basically you created an "enskild firma" or do you all have a "handelsbolag". heh why are we still writing english? anyway I assume you can't just divide up the earnings however you like if everyone isn't part of the company somehow.

so each of you sometimes do stuff by yourselves through spell of play? and all help each other out more than working together? thats a very good idea. I assume you all have full-time jobs so you survive Smiling

do you feel like alawar did enough for the big share they took or do you think you can spread the word by yourself and earn more in the end?

very good idea to let people support you from the beginning when it is playable and pay less the earlier you dare to spend the money Smiling do you plan to just release your own stuff over the hub or do you think it can be something that many developers can share?

alright I'll write down feedback while I'm playing. I bought pirate quest today Laughing out loud painless procedure. good job. there was a spelling error in the product information email and it was a bit short and boring but I suppose it was a quick thing Smiling

I gotta say I really like the exploration part. It really makes the game worth playing. I usually don't look twice at match-games or many casuals at all. oh and music and sound is good. the music sequences are a bit short though.

otherwise the only things I've found so far is that the main menu background is a little sketchy, the match-3 boards could use some more objects around them to liven them up a little. just the terrain tiles look a little boring. I can see the issue of cluttering up the screen when there's already lots of objects on the actual gaming board but I think something can be added successfully without compromising cleanness.

also some inconsistencies and alignment issues on buttons but I'm sure you know it all already.

hmm okay, I suppose you could change the vertexformat. At the expense of memory of course. and it gets a whole lot more complicated. would you use several texture stages or would each triangle somehow know which texturecoordinate to use in which case... well I don't think we need to go into it. it works fine as it is.

regards,
Benny

users avatar

Game development and site

Well, since we don't pay any salaries to anyone Spell of Play Studios is still an "enskild firma". Income is used to buy stuff and to try to meet irl. If we should happen to get in to a situation where a lot of money is earned well probably start a "aktiebolag". "Handelsbolag" just seem like a big mess to me Smiling

And yes we do have full time jobs/school Sticking out tongue

The people at alawar are doing a very good job. I don't think that TimeBreaker would have sold nearly as many copies as it has done if we marketed it ourselves. Very hard to speculate what would happen in the long run... I think it is a good thing to have a publisher on your first title, it will definitely give you a boost. Having a publisher for TB was also one of our major goals, that proved to us that we are professional enough.

One other major good thing is that a publisher will make you work harder and finish the product to a shipable state. This is something that is very hard to do on your own. Our sollution to this now it to try to get feedback from real players. So thanx for the PQ feed!

/hObbE

users avatar

Game development and site

Hmm did I never reply to this. I should have called myself Chaosmind.

Well, okay I guess it works if the money goes directly to hardware and software and not to individual persons.

I got the impression Handelsbolag was the best alternative for 2-4 people but I guess AB is the way to go if you're serious. The problem is the 100.000.

Being unemployed for a while and having lots of time and then working for 5 months I found it very hard to work on the game while having a fulltime job. How do you keep the motivation and energy up to both work fulltime, maybe overtime and get home and code even more? Laughing out loud Maybe I'm just too bored of Roadclub because of the last phase to do them both and a new project would give me more energy.

Very good points regarding the publisher. We'll probably do it that way with Roadclub and see what happens and take a new decision next time.

Having deadlines definitely helps if you want to get it done fast. We probably want to take some time to design the engine from scratch taking everything we learnt the last decennium into account before the next game though.

I'll play some more PQ soon. See if something else comes up. Are you working on PQ at the moment?

Well, back to work on the demo for me Smiling

users avatar

Game development and site

Hi again

It is sometimes hard to find time and energy to work with a game, I think the best motivation is feedback and visible progress... So release your game now!

Right now, Im working with Minigolf and PQ at the same time... Mostly on minigolf right now... But after next minigolf release I will get back to PQ... I have seen a few people having trubble understanding the game so I will build a better helpsystem...

users avatar

Game development and site

Yo!

Yes motivation is a big factor. I can be very hard to feel motivated to work more after a whole days worth of work. I agree with toll that the best motivation is feedback and getting your product out there.

Getting real feedback also makes you focus on what is important to improve in the game. Often you spend countless hours on some motivation draining feature that no real player think is important. So releasing your game from day one is paramount!

Also releasing your game will help you find bugs and problems early, which is a good thing. Nothing is more motivation draining than working for a year+ and then the game does not work on 50% of the PCs.

During the development of Time Breaker we had a release cyckle of two weeks. That is every two weeks we released the game, collected feedback and planned what to work on the next two weeks. This methodology of working is called "iterative software development" and is one of the better ways of developing software in general and games in particular imho. Popular processes that use this method is (Rational) Unified Process and eXtreme Programming. There is much to be said about these processes but the core is that you don't know for sure what to do until you have some real end user feedback, and the only way of getting that is by releasing your product.

As someone said "for a software to be in development is a very unnatural state".

Using the Hub as release platform we are now trying to be even more iterative and always letting the end user get the latest version without the need to download or install the game "manually".

My advice for you is to release the game now, even if it looks/feels/plays like crap Sticking out tongue Be brave!

/hObbE

users avatar

Game development and site

dntoll:

true. feedback and visible progress is very important. we've released it like 10 times already but since we really didn't have a plan time flies fast between the iterations.

cool, both games have great potential!

yeah you felt a little lost at first in PQ but after an hour or so you had it pretty much figured out Smiling I can see how that would be frustrating for people though.

hObbe:

great advice hObbe. we will definitely work differently on our next project. designing and planning for the core of the game and making a first playable version and release it and go from there. I really believe in your business model. a great idea for indie development.

when you say you release every two weeks, do you really get any people playing these early versions? not many know about the game at that point if you aren't releasing to big news sites.. or is it more to like friends and family.

hehe well we can't release a full version because the game can't be played all through so we're focusing on releasing demos until they would work as a real demo and then fill the game with content and end sequence so its complete. Hopefully we're at that stage after this release. Everything's implemented, and it looks nice.

users avatar

Game development and site

Yes, getting a good amount of feedback is really hard. Early versions of time breaker was mostly friends and colleagues that where "encouraged" read forced to play the game. Later on the regular "community" of testers grew and our publisher always took the time to send us good feedback (that is one of the main advantages of having a publisher)

We hope that the Hub will make it somewhat easier for the end user, but it is still a big step for a person to engage themselves and submit some feedback. Right now you pretty much need to register a user in the forums and write something. This is a pretty "scary" thing to do.

We will probably add some feedback feature in Hub to facilitate this process, since the Hub can know what game the user has played the Hub can ask for feedback after a playing session.

Another interesting thing that I personally think is the future of game development is instrumenting. That is collecting measurements from withing the game to pin point what the good and bad thing are. Valve is already doing this a lot. Beeing able to collect massive amounts of quantitative feedback will open a lot of doors!

regards,
hObbE

users avatar

Game development and site

Hehe okay that's pretty much the development of community testing you'd expect. We started with releasing on gamedev.net and later gamedev.se.

Exactly. People won't go register everywhere. To attract testing it must be much simpler than that otherwise only the most interested will even bother. Like you said, the Hub is the perfect instrument for this.

Instrumenting sounds interesting but I find it hard to imagine what kind of data that could really be useful. Often its more useful to actually watch somebody play.

users avatar

Game development and site

Yes what to measure during instrumenting is the big question and the biggest challenge for game developers. I think that having quantitative data is paramount to large scale sucess. However, qualitative methods, like watching people play, focus groups and listening to feedback is certainly important.

I actually feel really inspired to add some simple feedback functionality to the Hub now Smiling

/hObbE

users avatar

Game development and site

hehe why not. it could be helpful with the current games already.

users avatar

Game development and site

Yo!

The Hub is updated with a simple feedback feature.

The next time you start The Hub you should get a File menu with a Feedback option.

/hObbE

users avatar

Game development and site

Nice! That went pretty fast Laughing out loud I love auto-updating programs. Ooo new minigolf update. I'll try that and then test the feedback function Smiling

users avatar

About D3D batching...

Hi guys, I just found this thread today, it was a great read Smiling

About batching in D3D; AstroCreeps is now D3D9 instead of DirectDraw3 as of a few versions ago. I'm currently using fixed function / DrawPrimitiveUP with triangle lists, and a single texture like Daniel has described. I haven't seen any real performance reason to use vertexbuffers or even indexbuffers (could save some vertices by using DrawIndexedPrimitiveUP of couse). I don't use any dynamic allocation, I've just self-imposed a max triangle / quad count and have a big static array of vertices.

I have found that it makes logical sense to create a Texture class that exposes all the "blit" functions. This class simply wraps a D3D texture interface along with my "vertex array", and handles drawing itself. This is because I'm of course sorting by texture.

I've been playing around with a method of supporting interleaved "blend modes" in my calling code, meaning that I can interleave draw calls to the Texture object that are alphatested vs add-blended in any order. This is mainly because that is how my old DDraw code worked (all 16 bit software buffers and a single lock and transfer to video memory at the end of each frame). This has posed a challenge, but it boils down to flushing the vertices with a DrawPrimitiveUP call each time the "blend mode" changes. This is managed by the Texture object storing the last call's "blend mode", and drawing the cached quads each time a conflicting call comes in.

AstroCreeps thus uses between 2 and 5 draw calls, depending on what is on the screen, and the game itself doesn't need to do any "blend mode scene management". I'm pretty happy with the way this works out, but it probably won't work with multiple textures without a more elaborate scheme, and in that case it might be better to expose the entire internal logic to the game's View anyway. Engines suck Smiling

users avatar

Multiple UVs

About multiple UVs per vertex...

I really think it's worthwhile to get into HLSL as opposed to fixed function, as it's really easy to do funky stuff with custom vertex formats that way. There are plenty of good examples in the recent DX SDKs to get you started.

Which reminds me, DXUT rules imho, I use it for AstroCreeps and even my professional stuff at work. Check out any of the DX samples (installable from the DX sample browser). I know, MS code examples are usually horrible, but this stuff is ok, and as soon as you extricate all the setup stuff from the actual example, as well as getting rid of their GUI stuff, it's really nice and clean.

users avatar

nVidia FX Composer

And one last thing, I use nVidias FX composer to "compile test" my .fx shaders. That is I use it to make sure that the shader will compile to the specified vs or ps target. This is nice, because then your program doesn't have to fail at startup due to some crappy syntax error in your .fx file.

Another thing that I've been doing is using a single .fx file for all my different logical shaders, and using techniques as a "shader selector" instead of a profile fallback. This allows me to re-use lots of the global application to shader communication (global variables etc), and share vertex shaders and pixel shaders between logical "shaders" i.e. techniques.

users avatar

Game development and site

Hello, johno!

Maybe we overcomplicated things but we started losing framerate pretty fast before we started using buffers. Now it handles pretty well. I think we didn't try exactly your approach though. We still had a lot of DrawPrimitive-calls. Sounds like a pretty clever setup you have there, minimizing draw calls greatly. Would it be possible to see code that shows how you've structured and setup your drawing to visualize your first post?

Now we still use DX8 so we can't use any of the new stuff you mention. We should definitely change until the next game but now we're almost done so it would be stupid to waste time on that. A lot has happened in 5 years though and we need to learn to use what has come to be more productive in future games.

DX9, Shaders and HLSL are definitely included in the previous statement.

I don't know much about shaders at all so your last post didn't make much sense to me I'm afraid Laughing out loud I'll have to go back to it when I've played a little with shaders.

users avatar

AstroCreeps batching

[code:1]
void Texture::Blit(const bool anAddFlag,
const float aX, const float aY,
const float aWidth, const float aHeight,
const float aSrcX, const float aSrcY,
const float aRotation)
{
Flush(anAddFlag);
myRects.Add(aX, aY, aWidth, aHeight, CalcUV(aSrcX, aSrcY), CalcUV(aWidth, aHeight), aRotation);
}
[/code:1]

This is the basic "blit" implementation, which flushes with the call's add flag (I support alpha test blending, i.e. color key, and additive blending), and then adds a rect to the vertex buffer. The adding of rects fails silently if there are too many, but you could easly put an assert in there and size your vertex buffers through trial and error.

[code:1]
void Rects::Add(const float aX, const float aY,
const float aWidth, const float aHeight,
const Core::Vector2f& uv, const Core::Vector2f& uvsize,
const float aRotation)
{
if(myCount < MAX)
{
const unsigned short BV(myCount * 4);
vertex* v(myVertices + BV);
unsigned short* i(myIndices + myCount * 6);

if(aRotation != 0.f)
{
unsigned char i;

v[0].Set(aWidth * -0.5f, aHeight * 0.5f, uv.x, uv.y + uvsize.y);
v[1].Set(aWidth * -0.5f, aHeight * -0.5f, uv.x, uv.y);
v[2].Set(aWidth * 0.5f, aHeight * -0.5f, uv.x + uvsize.x, uv.y);
v[3].Set(aWidth * 0.5f, aHeight * 0.5f, uv.x + uvsize.x, uv.y + uvsize.y);

for(i = 0; i < 4; i++)
{
v[i].pos.RotateAroundZ(aRotation);
v[i].pos.x += aX;
v[i].pos.y += aY;
}
}
else
{
v[0].Set(aX, aY + aHeight, uv.x, uv.y + uvsize.y);
v[1].Set(aX, aY, uv.x, uv.y);
v[2].Set(aX + aWidth, aY, uv.x + uvsize.x, uv.y);
v[3].Set(aX + aWidth, aY + aHeight, uv.x + uvsize.x, uv.y + uvsize.y);
}

i[0] = BV + 0;
i[1] = BV + 1;
i[2] = BV + 2;
i[3] = BV + 0;
i[4] = BV + 2;
i[5] = BV + 3;

myCount++;
}
}
[/code:1]

This is the add stuff for rects / quads. Apparently I was lying earlier, I do use indices, meaning DrawIndexedPrimitiveUP() Smiling

[code:1]
void Texture::Flush(const bool anAddFlag)
{
if(anAddFlag != myAddFlag && (myRects.myCount || myLines.myCount || myTris.myCount))
Flush();

myAddFlag = anAddFlag;
}
[/code:1]

As you can see, the cached add state (myAddFlag) is checked, and if the incoming call differs and there is something to draw Flush() is called, which does the actual DrawPrimitiveUP stuff and resets the vertex buffers in myRects, myLines, and myTris. Finally, I cache the current add state. Lines and Tris work very much like the Rects stuff, adding in a similar fashion.

[code:1]
void Texture::Flush()
{
if(myDevice)
{
HRESULT hr;

if(myAddFlag)
{
V(myDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE));
}
else
{
V(myDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE));
}

V(myDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_TEX1));
V(myDevice->SetTexture(0, myTexture));
myRects.Draw(myDevice);

V(myDevice->SetFVF(D3DFVF_XYZRHW | D3DFVF_DIFFUSE));
V(myDevice->SetTexture(0, NULL));
myLines.Draw(myDevice);
myTris.Draw(myDevice);
}
else
{
myRects.myCount = 0;
myLines.myCount = 0;
myTris.myCount = 0;
}
}
[/code:1]

This is the actual drawing. Note the vertex formats, myRects are textured, myLines and myTris are just diffuse colored.

One important thing is that all of the drawing in AstroCreeps must occur between BeginScene and EndScene calls. This isn't really consistent, as the interface to Texture doesn't imply this, but is is an artifact of the current flushing scheme. This isn't really a problem for me, I have control of where the drawing occurs, but it is worth mentioning. Also, at the end of the drawing a final call to Flush() needs to be made on the Texture, to flush all the stuff that has been cached in the final batch.

[code:1]
void ViewManager::Draw(IDirect3DDevice9* aDevice)
{
HRESULT hr;

// Clear the render target and the zbuffer
V(aDevice->Clear(0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, myView == &myPlay ? 0xff000000 : 0xffff00ff, 1.f, 0));

// Render the scene
if(SUCCEEDED(aDevice->BeginScene()))
{
myCore.myGui.myMouseInsideFlag = false;
myView->Draw();
myCore.myGfx.Flush();
Rects::Debug();
V(aDevice->EndScene());
}
}
[/code:1]

This is the drawing stuff, as sort of explained above. All the calls to Texture are done in myView->Draw(), and myCore.myGfx.Flush() is the final flush call as explained above.

users avatar

Bad design :)

Reading my last post back, I realised that the whole design is kind of overkill Smiling

I only end up with something in the order of 2 - 5 batches, and that implies that I do a significant amount of high level "batching" anyway. I think now that I'll change the View to do flushing as needed after each high level batch of things.

[code:1]
void PlayView::DrawNormal
{
myFarplane.Draw(myCore);

//gravity and blackhole impulses
if(myCore.myModel.myShip.myGravity.IsActive())
myDust.Impulse(myCore.myModel.myShip.myPosition, myCore.myModel.myShip.myShield.IsActive());

myDust.Draw(myCore.myGfx, myDebugDrawFlag);
DrawPowerups();
DrawAsteroids();
DrawBullets();
if(myCore.myModel.myShip.IsAlive())
DrawShip();
DrawGore();
DrawExplosions();
DrawText();
DrawHud();
DrawPause();
DrawSplash();
myCore.myGui.Draw(myCore.myGfx, myCore.mySmallFont);
DrawCursor();
}
[/code:1]

As you can see, there is batching there already, and I could just interleave the DrawXXX() calls with myCore.myGfx.Flush(). This way there would be no need of a add state cache inside of Texture.

Hehe, isn't explaining stuff fun? Laughing out loud

users avatar

More batching thoughts...

Going along with the new design I proposed in the last post, even more things could be improved.

The interface for Texture::Flush() would be changed as to require a IDirect3DDevice9 pointer. This gets rid of the cached pointer inside Texture (which I think really smells), and sort of implies that the Flush() call is part of rendering and as such belongs within a BeginScene() / EndScene() block.

Of course this would change IView::Draw() to require an IDirect3DDevice9 pointer, so it can be passed to Texture::Flush(), but that is also good, as then you can't call Draw() without being on a call stack where you have a device pointer.

It should be noted that I try to avoid caches like the plague, and using DXUT I tend to use the function arguments to OnFrameRender() instead of the very evil global function DXUTGetD3DDevice().

...which brings us back to the messiness of having to batch / cache stuff at all, but that's just a fact of life with D3D. Oh well, I guess that in my old DirectDraw code, my whole software bitmap implementation in itself is just one huge cache to avoid having to deal with draw call limitations Laughing out loud

At SpellOfPlay we have many times ranted about the power of immediate mode interfaces and the inherent evilness of caches in general. I like the irony of trumping my own design by explaining it to someone else Laughing out loud

users avatar

Post new comment

Please solve the math problem above and type in the result. e.g. for 1+1, type 2.
The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <h1> <h2> <h3> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • Textual smileys will be replaced with graphical ones.
  • Images can be added to this post.

More information about formatting options