mystb

Members
  • Content count

    96
  • Joined

  • Last visited

Community Reputation

186 Neutral

About mystb

  • Rank
    Member
  1. Helo,   I'm trying to get a mix of lua, horde3d and SFML up and running, but I've come across a problem that I'm unable to solve. I already built everything and I made up a test scenario with SFML only output:     Just some random labels:) I tried to incorporate Horde3D, but that simply fails. So, I just commented out the SFML output, and voila:     That's a simple Tetris like piece.   But if I try to have both at the same time, the application crashes. I "know" the problem must reside in the opengl states, and I tried to push and pop the states, but haven't figured it out.   Here's the code (in one snippet but scatered through some files): function window:create(cfg) ... ... llwindow.set_window_style(style) llwindow.create_window(title) self:pushStates() -- [1] end function window:pushStates() llwindow.get_handle().__RenderTarget__:pushGLStates() end function window:popStates() llwindow.get_handle().__RenderTarget__:popGLStates() end function window:resetStates() llwindow.get_handle().__RenderTarget__:resetGLStates() end function render:tick() self:setWireFrameMode(self.d3doptions.WireFrameMode) self:setDebugViewMode(self.d3doptions.DebugViewMode) window:clear() self.camera.object:update() llrender.render(self.camera.object) --[2] window:popStates() --[3] window:resetStates() --[4] overlaymanager:tick(self.dimensions) --[5] window:pushStates() --[6] llrender.finalize() --[7] window:display() end With 1,3,4,5,6 enabled and 2,7 commented out, SFML outputs ok, but outputs this message once:   An internal OpenGL call failed in RenderTarget.cpp (269) : GL_INVALID_OPERATION, the specified operation is not allowed in the current state   With 1,3,4,5,6 commented and 2,7 enabled Horde3d outputs ok.   With any combination of these... app crashes first time that llrender.render(self.camera.object)  is called or after outputting several GL_INVALID_OPERATION messages like above.   Any help would be appreciated   P.S: sorry for my spelling/grammar, I'm portuguese.
  2. finshed breakout game

    Best thing to do... pack your game files and copy them to a computer without visual studio or any dev tools. This way you'll see what's missing. Best Regards
  3. Hello, I've been doing a lot of code, but any of it graphic related. So this is my first approach to doing 3D graphics. I began with a blank screen (as everyone), and I'm just drawing a triangle and rotating it over time. As you'll imagine, this gives me a very fast rotating triangle, that can almost seem like a cone. When I try to write some text on the screen I notice a huge decrease on the speed of the rotating triangle, up to the point that with 10 lines of 80 characters on screen, one full rotation takes 4 to 5 seconds. I've read that using a sprite in the call to drawtext will speed up things, but I really don't see any improvement. Here is the code called each frame: void PVideo::FRAME(){ if(!callbackset)return; #ifdef _DEBUG if(!globals->getValue("nooutput", false)){ #endif device->Clear(); if( !device->BeginScene()) return; #ifdef _DEBUG } #endif updateCameraPos(); device->iface->SetFVF(tri_fvf); device->iface->SetStreamSource(0, g_list_vb, 0, sizeof(tri_vertex)); D3DXMATRIX rot_matrix, trans_matrix, world_matrix; static float rot_triangle=0.0f; D3DXMatrixRotationY(&rot_matrix, rot_triangle); D3DXMatrixTranslation(&trans_matrix, -2.0f, 0,0); D3DXMatrixMultiply(&world_matrix, &rot_matrix, &trans_matrix); device->iface->SetTransform(D3DTS_WORLD, &world_matrix); device->iface->DrawPrimitive(D3DPT_TRIANGLELIST, 0, 4); rot_triangle+=0.007f; if(rot_triangle>D3DX_PI*2) rot_triangle-=D3DX_PI*2; hll->ExecFunction(update_callback); WriteText(std::string("Drawing Triangle"), std::string("Console"),0,0xffffffff,0,0,800,100); #ifdef _DEBUG if(!globals->getValue("nooutput", false)){ #endif device->EndScene(); device->Present(); #ifdef _DEBUG } #endif } update_callback calls a lua function, that now just calls back WriteText C++ function 10 times. void Fontd3d::Write(std::string &text,DWORD format, DWORD color, RECT &rect){ if(font==NULL) return; sprite->Begin(D3DXSPRITE_ALPHABLEND); if(format&DT_CENTER){ font->DrawText(sprite, text.c_str(),-1, &rect,DT_VCENTER|DT_CENTER| DT_SINGLELINE|DT_CALCRECT , color); } font->DrawText(sprite,text.c_str(),-1, &rect, format,color); sprite->End(); } void Fontd3d::GetSpaceFor(std::string& text, RECT *rect){ font->DrawText(NULL, text.c_str(),-1, rect,DT_CALCRECT , 0); } void Fontd3d::Create(std::string& n,int size, int weight, bool italic){ name=n; if(FAILED( D3DXCreateFont(device, size,0,weight,1,italic,DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, name.c_str(), &font))) throw(ERR_FILL(VIDERR_FONTERROR,"error on DX creating font")); D3DXCreateSprite(device, &sprite); }
  4. Lua syntax error

    hmmm.. You're sure that you wrote the code? Not calling you a liar, but (I may be mistaken) the code has some newbie errors, and at the same time is a little complex.. the new_scenemanager function returns a table, but you don't put a ',' between elements. why don't you do something like: local MT={} function MT.setstart(self, startscene,...) blabla end function MT.switch .... function new_scenemanager() return MT end also: function setstart(self, startscene, ...) return self.current = startscene(self, ...) it should be something like: function setstart(self, startscene, ...) return self.current = startscene(self, args)
  5. static int cat_fart(lua_state l) { // take the table passed an argument <- how do I do this (no need to "take it", because its already on the stack....) // change the x value to something else <- and this? (same as you've done...) lua_pushstring(ls, "x") lua_pushstring(ls, "something else") lua_settable(ls, -3) };
  6. well, that was it :| I really feel stupid :) Thanks !
  7. Hi, I'm having a hard time understanding what's the problem with this code. I've traced the problem to a couple of functions. All my objects are destroyed before the application ends. void Textured3d::CreateFromMemory(void *d, size_t size){ if(FAILED(D3DXCreateTextureFromFileInMemoryEx(device, d, (uint)size, D3DX_DEFAULT, D3DX_DEFAULT, D3DX_DEFAULT, 0, D3DFMT_UNKNOWN, D3DPOOL_MANAGED, D3DX_DEFAULT, D3DX_DEFAULT, 0, NULL, NULL, &data))){ throw(ERR_FILL(VIDERR_TEXTURECREATE, "Error loading texture into memory")); } } void Sprited3d::Draw(const D3DXVECTOR3 &pos, LPDIRECT3DTEXTURE9 t){ if(NULL==t) t=texture; sprite->Begin(D3DXSPRITE_ALPHABLEND); // sprite->Draw(t,NULL,NULL,&pos,D3DCOLOR_ARGB(255,255,255,255)); sprite->End(); } in this sample code, if I don't call the Textured3d::CreateFromMemory and don't call sprite->Draw (commented out above), all seems well. Direct3D9: :====> ENTER: DLLMAIN(010ce6e0): Process Attach: 000034fc, tid=00003518 Direct3D9: :====> EXIT: DLLMAIN(010ce6e0): Process Attach: 000034fc Direct3D9: (INFO) :Direct3D9 Debug Runtime selected. Direct3D9: (INFO) :======================= Hal HWVP device selected Direct3D9: (INFO) :HalDevice Driver Style 9 Direct3D9: :DoneExclusiveMode Direct3D9: (INFO) :Failed to create driver indexbuffer D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.44115e+017f. This is ok. D3DX: Unicode support: 1 'TextRPG.exe': Loaded 'C:\WINDOWS\system32\usp10.dll', No symbols loaded. Direct3D9: :====> ENTER: DLLMAIN(010ce6e0): Process Detach 000034fc, tid=00003518 Direct3D9: (INFO) :MemFini! Direct3D9: :====> EXIT: DLLMAIN(010ce6e0): Process Detach 000034fc The program '[13564] TextRPG.exe: Native' has exited with code 0 (0x0). but if I call that function (D3DxCreateTextureFromFileInMemoryEx) I get the following result after application finishes, with a "bla.exe has triggered a breakpoint": Direct3D9: :====> ENTER: DLLMAIN(010ce6e0): Process Attach: 000036a0, tid=000035ec Direct3D9: :====> EXIT: DLLMAIN(010ce6e0): Process Attach: 000036a0 Direct3D9: (INFO) :Direct3D9 Debug Runtime selected. Direct3D9: (INFO) :======================= Hal HWVP device selected Direct3D9: (INFO) :HalDevice Driver Style 9 Direct3D9: :DoneExclusiveMode Direct3D9: (INFO) :Failed to create driver indexbuffer D3D9 Helper: Warning: Default value for D3DRS_POINTSIZE_MAX is 2.19902e+012f, not 1.44115e+017f. This is ok. D3DX: Unicode support: 1 'TextRPG.exe': Loaded 'C:\WINDOWS\system32\usp10.dll', No symbols loaded. Direct3D9: :====> ENTER: DLLMAIN(010ce6e0): Process Detach 000036a0, tid=000035ec Direct3D9: (INFO) :MemFini! Direct3D9: (WARN) :Memory still allocated! Alloc count = 175 Direct3D9: (WARN) :Current Process (pid) = 000036a0 TextRPG.exe has triggered a breakpoint I've tried to even call EvictManagedResources() before releasing the device, with no luck. Any help is appreciated.
  8. LUA and UTF-8 encoding

    Quote:Original post by Average_Joe Thank you for the response and the link. I am really hoping that someone here has used a LUA script to hold foreign-language text strings (saved in UTF-8 encoding) and successfully read them in their code, and is willing to post a little bit of sample code on how they accomplished this. I can tell you that it works as you stated. I can use characters like ç ã ó inside LUA strings. And I'm not doing anything special. Just edit your file with something as ordinary as notepad. Quote:Original post by Average_Joe The file is saved in UTF-8 encoding, and will not load when I try to call luaL_loadbuffer on the file once it has been read into memory. that's the problem I think.
  9. LUA and UTF-8 encoding

    cannot really help but providing a link: http://lua-users.org/wiki/LuaUnicode hope it clarifies your problem.
  10. Isometric Tiles Culling

    but.... for the bottom tiles, you have to extend your drawing algorithm to catch raise block. So, you may think that the bottom row of tiles is X=0 to 20 and Y=10, but if you have a tile at X=10 and Y=8 with height=5, it would be visible in this view. Hope I made myself clear :)
  11. Quote:Original post by PCN The irritated dino blob, a game I'm working on. I translated it by myself and I think it would be this: El dinosaurio irritada burbuja. ...from "Feed the dino" or "walk the dino" I'm portuguese, but here it goes.... 1) blob... a strange word... first try: La particula de dinosaurio irritada. (the irritated dino particle) 2) Feed the dino: - Alimentar al dino 3) Walk the dino: (as in taking the dino to a walk) - Pasear al dino
  12. Armor

    all this talk revolves around armor in combat. And why not thinking on armor as a charisma enhancer? If you see a guy around the corner in leather, that wouldn't get your attention as much as a guy in a shinny full plate mail. But, maybe that hints a trader, and he will raise his prices. Also, you can have armor tied with ranks, armies, countries, and enforce that policy. Just my non english thoughts, translated by my non english brain.
  13. Hero / Anti-hero / Everyday Joe

    Quote:Original post by Wavinator Quote:Original post by mystb well, since (almost) every game offers a save game feature, I tend to explore the possibilities. Being a hero, villain or average joe, I like to see what options the designers thought I could take, and what surprises they had put inside for me. Thanks for the input mystb. It sounds like the role a game gives you has little impact on your actions because you as a player have an out-of-game "meta-goal" of experimenting. Would I be right then in saying that typically the fiction of the world doesn't really compel you toward one action or another? No, I'm compeled to play the role. What I do also tend to do is trying to see what could happen if I choosed another path. But I almost always choose the "role play" path even if exists another one with better results. If not, we would be playing numbers, and I'm too old for that :) But I think that it all depends on how do you implement your game. If it revolves around stats, numbers, modifiers, players will want to get the max out of each situation. If you have a strong story, that has a bigger value. Hope my english was good enough to expose my thoughs !
  14. Hero / Anti-hero / Everyday Joe

    well, since (almost) every game offers a save game feature, I tend to explore the possibilities. Being a hero, villain or average joe, I like to see what options the designers thought I could take, and what surprises they had put inside for me. In your example, maybe if try to stop them as a joe, I won't be beaten, but a police car appears in the last second, or I'm taken as a hostage. Explore is the key.
  15. Quote:Original post by Ookami Oh cool, I didn't know something like that existed. If it works as you say it does, that should be perfect for what I need. Thanks. So, in the end, as you see, the scripting language you use influences a lot the answers you might find useful ;)