[media]http://www.youtube.com/watch?v=9Tsv5bbHRB0[/media]
Progress on my entry to the competition.
[QUOTE=Darwin226;28343297]16 ms to render 800 particles.
Is that too slow? Separate draw calls, uniform setting and everything for each.[/QUOTE]
God yes, you need to batch them up into 1 draw call by throwing them into 1 vertex buffer.
[QUOTE=Chris220;28350302][media]http://www.youtube.com/watch?v=9Tsv5bbHRB0[/media]
Progress on my entry to the competition.[/QUOTE]
That could be interesting, what is the aim of the game going to be? I'm guessing the higher you go the more the score?
[img]http://puu.sh/15lH[/img]
And suddenly a lot of objects appear!
[QUOTE=Catdaemon;28347978]My game has one of these too.
[code]
SuperStrict
Import brl.filesystem
Import brl.map
Import brl.standardio
Import brl.max2d
Import brl.Graphics
Global scanimg:TImage = LoadImage("Resource/scan.png")
Global loadimg:TImage = LoadImage("Resource/load.png")
Function DrawLoadingScreen(name:String = "", cur:Int, total:Int, s:Byte)
SetBlend(ALPHABLEND)
SetColor(0, 0, 0)
SetAlpha(1)
DrawRect(0, 0, 800, 600)
SetColor(255, 255, 255)
If s Then
DrawImage(scanimg, 50, 20)
Else
DrawImage(loadimg, 50, 20)
End If
DrawText("Loading: " + name, 150, 20)
DrawText(cur + "/" + total, 150, 35)
Flip(0)
End Function
Type ResourceLoader
Field _map:TMap = New TMap
Method CountFolder:Int(path:String, types:String, cur:Int = 0)
Local total:Int = cur
Local Dir:String[] = LoadDir(path)
Local FileTypes:String[] = types.Split("|")
For Local f:String = EachIn Dir
If Chr(f[0]) = "." Continue
Select FileType(path + "/" + f)
Case FILETYPE_DIR
total = total + CountFolder(path + "/" + f, types, total)
Case FILETYPE_FILE
For Local s:String = EachIn FileTypes
If s = ExtractExt(f)
total = total + 1
DrawLoadingScreen(path, 0, total, 1)
Exit
End If
Next
EndSelect
Next
Return total
End Method
Method LoadFolder:Int(path:String, types:String, c:Int = 0, t:Int = 0)
Local total:Int = t
If t = 0 Then
total = CountFolder(path, types)
End If
Local cur:Int = c
Local Dir:String[] = LoadDir(path)
Local FileTypes:String[] = types.Split("|")
For Local f:String = EachIn Dir
If Chr(f[0]) = "." Continue
Select FileType(path + "/" + f)
Case FILETYPE_DIR
cur = cur + LoadFolder(path + "/" + f, types, cur, total)
Case FILETYPE_FILE
For Local s:String = EachIn FileTypes
If s = ExtractExt(f)
AddResource(path + "/" + f)
cur = cur + 1
DrawLoadingScreen(path, cur, total, 0)
Exit
End If
Next
EndSelect
Next
Return cur
End Method
Method AddResource(url:String) Abstract
Method Get:Object(key:String)
Return _map.ValueForKey(key)
EndMethod
Method PrintMe()
For Local k:String = EachIn _map.Keys()
brl.standardio.Print(k)
Next
EndMethod
EndType
[/code]
:v:[/QUOTE]
Me too! It uses references to keep track of objects.
[editline]28th February 2011[/editline]
[cpp]
class ENGINE_EXPORT ResourceManager
{
public:
ResourceManager();
~ResourceManager();
Resource* Get(const unsigned int Handle);
Resource* Get(const Engine::String& Name, const Engine::String& Path = ENGINE_STRING("./"));
unsigned int Add(Resource* pResource, const Engine::String& Name, const Engine::String& Path = ENGINE_STRING("./"));
void Remove(const unsigned int Handle);
void Clear();
Resource* operator[] (const unsigned int Handle)
{
return (*m_pResources)[Handle];
}
const int GetResourceCount() { return m_pResources->size(); }
static const int InvalidHandle = -1;
typedef std::map<unsigned int, Resource*> Map;
private:
std::set<unsigned int> m_Handles;
std::map<unsigned int, Resource*>* m_pResources;
};
[/cpp]
I'm kind of embarrassed, and a little proud of this.
Embarrassed by this just being pong, but proud that it's my first game made in another language besides C++, which is C#. And I also gained a lot of networking experience with this, because it's an online multiplayer game.
[media]http://www.youtube.com/watch?v=zLLMTOZT_aw[/media]
Read the description please. : )
By the way, no audio, go play some music in the background if you want some.
I'm stoned off my balls after watching that.
[QUOTE=AgentBoomstick;28356665]I'm stoned off my balls after watching that.[/QUOTE]
As was I.
I'm just glad that now that I'm done with that project, I can think of ideas on Competition 2. >:D
.obj file support added
[img]http://i53.tinypic.com/34t7h93.png[/img]
You brilliant man.
I've suspended work on JAGMARLG temporarily to work on FlowerBomb, my competition entry featuring Mr. Stubbly Appendages, the double jumping, wall climbing, flower loving pseudo-paraplegic.
[img]http://f.anyhub.net/1ZSj[/img]
[QUOTE=Overv;28340580]A shared library is exactly what he got, a .dll or .so. Static libraries have the extension [i]a[/i] or [i]lib[/i].[/QUOTE]
I stand corrected on the terminology. However, it seems like he wanted a [i]static library[/i] given his confusion about the shared library option producing a .dll .
[editline]1st March 2011[/editline]
Maybe he had the same confusion I did?
Anyone else participating in DBP 2011?
in the works for this week + this weekend...
-switch from standard vertex arrays to VBOs if the GL|ES 1.1 extention is available
-tileset rendering performance can be increased significantly by removing redundant OpenGL calls for every tile
-I can also pre-translate the vertices of each tile before putting it in a VBO, so that I wouldn't have to call glTranslate() for every tile
-transformations will move from the main loop to the draw method inside each entity, don't think this will make much of a difference, but it won't have to reference the entity twice for translate, once for rotate, and twice for scale, it'll all be local variables.
Oh yeah and we're still releasing on the 30th...
Stuff we've done so far:
-level editor nearing completion
-collision reaction rewritten to work better and quicker
-XML stored levels that can be parsed into the game and level editor, and saved out from the level editor
-got some people to play it, noticed what was annoying them (joypad not working when a finger was held down but moved out of the square, etc.)
-in 3 days we went from 2/5 team members with Android phones to 4/5
we'll have a video by probably this weekend or next wednesday, the last scheduled day we have before release.
[url]http://filesmelt.com/dl/DSC04335.JPG[/url]
progress on my tesla coil :smile: (took about 5 hours + 2 hours fixing a small error (crossed over wire) to make that little piece. Looking forward to the rest :frown: ). It's 0.3mm copper wire with insulation.
Seems my question was skipped in the WDYNHW thread so I'll ask here: any recommendations for good C++ books?
[QUOTE=knighty;28350503]God yes, you need to batch them up into 1 draw call by throwing them into 1 vertex buffer.[/QUOTE]
But they don't all share the same matrices, how can I use multiple matrices in one draw call?
I mean, I could probably put them as vertex attributes but having 16 extra floats in my VBO seems like a bit of an overkill.
I'm working on: [url]http://binary.x10.bz/[/url]
I'm working on fuck. I just fuck, fuck, fuck. Fuck that. I'm Prooo.
[highlight](User was banned for this post ("Trolling" - Starpluck))[/highlight]
[QUOTE=Darwin226;28359954]But they don't all share the same matrices, how can I use multiple matrices in one draw call?
I mean, I could probably put them as vertex attributes but having 16 extra floats in my VBO seems like a bit of an overkill.[/QUOTE]
Idea: Store matrices in an array and use that array an an uniform. Then do instanced rendering.
[code]print( "BEGIN" );
local x = 5;
function a( var ) {
local x = var;
function b() {
local x = var - 1;
print(x);
return 80;
}
print( b() );
print(x);
}
local tmp = 7;
a(tmp);
print(tmp-2);[/code]
[code]BEGIN
6
80
7
5[/code]
Functions with paramaters and return values work, as well as scopes. Next up, more operators, and if statements.
[QUOTE=bootv2;28361591]c++ for dummies[/QUOTE]
I am a Computer Science student, not a 14 year old.
[QUOTE=Darwin226;28359954]But they don't all share the same matrices, how can I use multiple matrices in one draw call?
I mean, I could probably put them as vertex attributes but having 16 extra floats in my VBO seems like a bit of an overkill.[/QUOTE]
Well first of all, the vast majority of particles are screen aligned. Which means you only need position, and no rotation. Secondly, even for non screen aligned ones it's infinitely better to have 16 floats in each vertex than a draw call for each. Draw calls are EXTREMELY expensive. Many many times more expensive than drawing 2 polygons, especially on PC. Just so you know, even something like Crysis 2 has to keep its draw calls per frame below about 2500 or so before it starts getting slow. And that's for drawing absolutely everything.
Anyway, better than having an entire matrix in the vertex buffer, I personally just have the position and rotation, and create the rotation matrix in the vertex shader. It's not expensive. 3 sincos functions which is pretty cheap per vertex.
[QUOTE=DevBug;28353720]Me too! It uses references to keep track of objects.
[editline]28th February 2011[/editline]
[cpp]
class ENGINE_EXPORT ResourceManager
{
public:
ResourceManager();
~ResourceManager();
Resource* Get(const unsigned int Handle);
Resource* Get(const Engine::String& Name, const Engine::String& Path = ENGINE_STRING("./"));
unsigned int Add(Resource* pResource, const Engine::String& Name, const Engine::String& Path = ENGINE_STRING("./"));
void Remove(const unsigned int Handle);
void Clear();
Resource* operator[] (const unsigned int Handle)
{
return (*m_pResources)[Handle];
}
const int GetResourceCount() { return m_pResources->size(); }
static const int InvalidHandle = -1;
typedef std::map<unsigned int, Resource*> Map;
private:
std::set<unsigned int> m_Handles;
std::map<unsigned int, Resource*>* m_pResources;
};
[/cpp][/QUOTE]
Indeed. Code like that is the reason I both love and despise C++. Mine also passes objects around by reference, you just can't really tell (it's default behaviour, you have to manually copy them).
Personally I prefer smart pointers. They can be literally 100% transparent and basically do the same job.
[QUOTE=knighty;28362085]Personally I prefer smart pointers. They can be literally 100% transparent and basically do the same job.[/QUOTE]
Or language managed garbage collection (oh goddd it's horrible help me I have to keep disabling it) :v:
[QUOTE=knighty;28361840]Well first of all, the vast majority of particles are screen aligned. Which means you only need position, and no rotation. Secondly, even for non screen aligned ones it's infinitely better to have 16 floats in each vertex than a draw call for each. Draw calls are EXTREMELY expensive. Many many times more expensive than drawing 2 polygons, especially on PC. Just so you know, even something like Crysis 2 has to keep its draw calls per frame below about 2500 or so before it starts getting slow. And that's for drawing absolutely everything.
Anyway, better than having an entire matrix in the vertex buffer, I personally just have the position and rotation, and create the rotation matrix in the vertex shader. It's not expensive. 3 sincos functions which is pretty cheap per vertex.[/QUOTE]
Well the key with what I'm doing is ease of use so only passing positions is out of the question since many objects require scale, rotation and stuff like that and it would be needlessly hard to have separate classes for particles, objects with rotation, objects with scale, objects with both...
What do you think would be easier to do. All the matrices for the same type of object in an array, then instance it or matrices in the VBO?
[editline]1st March 2011[/editline]
Now it renders a 1000 of them in 5 ms because I was calling glGetError per particle every frame.
Who knew glGetError was more expensive than all the uniform, attribute and draw calls.
My engine is a beast.
[img]http://i.imgur.com/s55qd.png[/img]
839 physically simulated objects without noticable lag!
(ignore the horrible programmer art)
Well I wasn't commenting on what other properties you need. Particle vertices are often pretty fat so don't worry too much if you think it seems big. The best way to index them is to just have a base "model" which is your 2 triangle square, and then a separate vertex buffer with the particle data. And I would really advise writing some special case stuff at least for 3d vs screen aligned sprites. Most other stuff can be done the same but you don't want your screen aligned particles being bogged down with a load of unnecessary data and processing.
[QUOTE=knighty;28362714]Well I wasn't commenting on what other properties you need. Particle vertices are often pretty fat so don't worry too much if you think it seems big. The best way to index them is to just have a base "model" which is your 2 triangle square, and then a separate vertex buffer with the particle data. And I would really advise writing some special case stuff at least for 3d vs screen aligned sprites. Most other stuff can be done the same but you don't want your screen aligned particles being bogged down with a load of unnecessary data and processing.[/QUOTE]
It's a 2D game. Everything is screen aligned :D
*VS C#*
I have a simple question.I have 4 buttons to move one square cursor but I want to remove them and make them to be keys from the keyboard(w,a,s,d).The question is how to add them?
Sorry, you need to Log In to post a reply to this thread.