Posts

Showing posts with the label programowanie

Nvidia - unsigned integer issues

Image
Yesterday I experienced another bunch of fun while using my laptop. My normal working environment is a desktop with an AMD graphics card, while choosing a laptop it was important for me to get some Nvidia GPU so I could test code on both machines. This was a smart decision as there are so many differences between them. This time I encounter another one. History Like always a little bit of the background: while doing tooling you need to think about nice interactive objects selections. The beginning was rough as I decided to use a physics ray-trace system to execute picking. This was a simple system where I was sanding a ray thru the world and tried to pick objects that collide with it.  The issue was: every object needed to have a collision body  it did not work very well with objects that had an alpha mask  did not support geometry that was deformed in shaders. I did not like any of these limitations so I decided one day to change the whole thing. I took this time a diffe...

Resource Center - High CPU usage

This is one of the recent issues that I was tracking This issue is pretty simple but because of that, its solution is not so trivial. So let's dig into it. The resource center is a standalone app that: Is a remote file system server  Integrate with Version Control System (currently P4) Is a resource server that is responsible for building resources Manage remote resource builders.  Manage the creation of game build Have UI which allows to browse the file system and trigger compilation of resources and build.   All communication uses TCP/IP sockets and most operations are async for performance reasons.  Recently I was doing changes to speed up the remote file system. I decided to switch all calls into async processing. While doing that I was put in front of the decision: Should I put all processing of connection read/write operations to a single thread? or maybe I should create a separate thread for each of them? I naively decided to go with a sing...

Little -> Monster

Image
Often when I do coding I asking myself how this small modification that I wanted to do converted into this monster that I working on ...  Good example is my recent decision to add regressions tests. I want to validating that I'm still able load some of the resources.  Spoiler alert : I spend already few hours and still don't have this tests. 

Catching up

There is so much going on this year that I don’t have too much time to write posts. For this who don’t follow my other blog this is some summary of most important changes: In February I started working for Unity Technologies. Engine slowly transit to Physics Base Rendering (PBR). I released new video https://youtu.be/q6Ql9MX4baM with game progress. Been at Unity HackWeek XII (I’m even on one of photos at blog, find me if you can :P) Dropping kinematic character physics in game. Now that I think about it each of this points could be separate post. But well there is no point in thinking about past and let’s focus on present and topics I work on in the same time: PBR transition. Physics changes. Game not working smooth. PBR transition This slow down a little bit because I try to read in free time recommended by friend moving frostbite to pbr . I start to see how much knowledge I missing to do it properly. There is all this sections about lights par...

Engine interview question

My friend know someone who is going to have skype interview for a position as engine junior programmer. I was asked for some guide or hints for this person. I think that this topic is interesting enough to change my long reply into nice post and hear what you think about it:) My email to him looked like this: " First he should stop being stressful and asking question of others what can be on interview. If he has knowledge and luck he will pass. Sometimes is more about luck than knowledge but generally If he will get too stressful, even luck won’t help him. About question they can ask whatever they want from just: How are you? Where you were studding? What you were studding? Why do you decide to have interview with us? To more technical one like: What programming languages you know and how well? What engines you know? If he sent them CV there will be probably few question about stuff you put there. If he worked previously somewhere I would expect question like: What y...

Code pollution

Image
Well time fly by and animation system starting take shape. Thanks to it I could do even some not bad looking animations in game (http://coffemonsters.blogspot.co.uk/2016/05/lba-preview-15.html) but well this is just another milestone in road to finished game.  Because of this thoughts I already moved to next issue: recovering of movie system. So far its going fine I added new movie resource, movie editor module. No I starting adding basic functionality: adding keys. This operation require list of selected objects in level. This part was designed great :D Because I can have N levels loaded in memory in the same time I created new level component which exist only in editor. It contain some editor specific data i.e. selection. It's added on loading from editor and it's not saved with level. When you want list of selected objects just pick component from level and I have access to selection. Great idea right ?  I thought this way when I was writing it. Right now I...

C++ riddle

This time small C++ riddle which took me some time to figure out :) Background: My editor currently use sockets connection to pass data between Qt UI and "Editor module" in engine. Inside editor module this happen on two threads: Processing events on editor module side Receive data and send result of events back to UI.  Code of two main function execute on them can found bellow: Processing events (Show/hide) EError CAppEditor::processEditorEvents( void ) { if (!m_eventsToProcess) { return EErrors::Succeeded_NothingToDo; } SEvent * events = wrAtomic::exchange(&m_eventsToProcess, (SEvent*)nullptr); if (events != nullptr && events->next != nullptr) { SEvent * rEvents = nullptr; while(events != nullptr) { SEvent* tmp = events; events = events->next; tmp->next = rEvents; rEvents = tmp; } events = rEvents; } while(e...

My little monster

This story started long ago while I was still student at University of Technology in Wrocław. It was probably year 2006 but I'm not sure right now. With time passing by all previous years slowly starting blending together but well I'm already at this age where this is pardonable. On one of C++ courses we got exercise to do program of our choice to show that we learned language. I decided that isometric game in SDL software mode will be great idea. And so I started working on it. What a great joy I had when everything finally started working together and I was able to send it to person conducting classes. I got passing marks and this was end of story.  Well at least for a lot of project this would be truth but in this cases there is a lot more. Some time passed and with friend we decided to make casual game. Code from course project was really useful but software rendering were too slow so I switched whole stuff on OpenGL and some time later we finished  "Pir...

Plans, real life and monkey job.

Funny thing about planning is that sometimes its not working out the way you want. This was case this week I planned to work on animations and ended doing small upgrade for resource system. The best thing is that I don't even feel bad about stuff ending this way :D  How I ended doing that is other story. Because I have policy of moving everything what I can to resource system which I have (this make stuff more consistent) I moved my rendering script to it. Everything would be good if not the fact that render script is initialized on main thread and my resource system never was prepared for request from other thread than game thread. So it was time to do improvement to allow for this :D This was even more important because there were sometimes crashes at startup of game. I split my task on 3 sub task: Access to resource data require locking of resource (i.e. meshRes->lock()->getMaterial();) Separation of resource from data so you could have resource handle and it ...

After break

Image
I took some break from writing on this blog but I had busy last few months. In this time I done a lot of changes in engine one of biggest "finished" one are changes in file system. But this time I don't to talk about what I done but more about what will come and what I working on right now. And I do some stuff with which I'm not feel most comfortable: Animation system. So I decided to seek some advice and explain what I do, why and how I would like to improve it. So be free to comment and critique. I don't fell that system I have right now is what I really want to have. This is this weird felling when you fell that system that you created is working but you fell that it's limiting you. Because of this felling recently more often I turn of computer and sit down with pen and notebook and think what I really want to do with this system. So far my conclusion is because I'm iterative develop White Rabbit Engine technology I didn't notice till n...

Tools Design

Image
Variable Set Editor - Main view Continuation of previous post :] this time with real examples :D Real tools design  This may look like joke but this one window took me ~3 days to do. This include all it's features and communication: Editor Engine. But this is reality. Creating good tools require time and I wasn't joking in  Summary  from previous post: "As you can see creating of good tools is not easy. You often need go back and forth to create something really useful. You don't want to modify everything by scripts in which you can make easily mistake. Good tool will for sure save you a lot of work and return effort that you spend on it." 

Few words about tools design

Image
Once again I will return to topic of tools. Mostly because right now this is the part of code I spend most of my time in.  I will focus in this post on one dialog: Variables Set Editor This one dialog may sound simple but if you start thinking more about it it's really complex tool.  So let's start with short description what Variables Sets are then lets move what we want achieve and in the end look on real implementation of this problem. Variables Set This is really simple system which allow you to specify some kind of properties. Right now I support only values of types:  StringID Float Vec4. Whole system may be use to store values like: life, attacks parameters, movement speed etc. In my case to this data have also access animation system which may request some kind of information which later may be use to control blends and generally its behavior. Because this is simple list of variables you want to be able to have some kind of hierarchy. i...

7 Hours of hell

Image
This will be story, my story based on true events. Hour 0 Recently I start using project generator not only to generate makes, projects and solutions but also to generate some code. Because of that from time to time I need to run one python script. This is not big problem but I decided to make my life easier and add button in Visual Studio 2010 (I'm working slowly on progression to new one) which will trigger this task. Sound simple right ? 

RTTI: Changes for better

As some of you may know White Rabbit Engine use it's own R un T ime T ype I nformation  system. And well like with everything else sometimes come time when you need to upgrade stuff. Recently I had another occasion to do iteration over this system. In this post I will try to give you a little bit insight how m  RTTI  look is engine, what changed and what are plans for future. But well let's start from begin.

Short Term Memory

Funny thing about doing your own tech is that you sometimes need to do some funny stuff. This week I needed done  Short Term Memory Manager. My comment in code describe it like this: Short Term Memory Manager (STM Manager). STM is memory which you want to use for short one-shot tasks:             Create->Execute->[GetResult]->Destroy It is limited by capacity so you never can use more than you pre-allocated for it. Right now it's use to transfer resource data CPU->GPU and in  animations tasks. For me this is temporary memory which I use for example to load texture data and then passing it to GPU upload (which will remove it). There are also other usage where I think using normal allocation...

Bug in rendering of editor

Image
Week ago I wrote post about porting editor to linux . I was mentioning there this weird bug : Editor works (Yes I know that drawing area is shifted to right. This is one of bugs that I still don't know why happening and I already spend on it like two days :/) Which is really nicely visible on this screen shoot: I spend on it like three days and still wasn't able to figure out why it happening or find any trace of it. I tried to ignore it but after noticing similar issues with blender and chrome I decided on desperate step.  From my experience I know that upgrades of system never ending good. This is the reason why I try avoid them as much as it possible. But well sometimes you need to do stupid things so I decided to update my Linux (Ubuntu 14.04) and graphics card drivers (fglrx-14.301) to newest versions. What went good: I was nicely surprised that system upgrade went without bigger problems. There were two steps 14.04 -> 14.10 -> 15.04 which took ...

Understanding of problem

This topic came to my mind in meantime of resolving linking problem on Linux. When I build dynamic library my app missed some of the symbols.  And no I didn't forget to compile *.cpp file which contain it. If it was so easy I wouldn't spend hours on resolving it. But this won't be topic of this post. The topic is about understanding of problem that we try resolve. I talking especially about this weird situations when something happening and we don't know why. I know different schools how to deal with this hard problems :]  Conclusion 1: It's for sure not in my code.  And this issue wasn't in my code :]  I didn't believed that this code was wrong from start. It was my fault for sure. Question only where.  Of course I'm not always was this way. In my younger days very often after hour of searching I were deciding it's for sure not my fault. Of course in 99% of time I was finding out later that I was wrong. Well privilege of being you...

Component system

Image
This time some more technical post about components system that I work on. So lets start from begin :) Making decision about switching to components took me almost year. Seem like pretty long time to rethink everything. But not necessarily when you need to change big part of your code base. So I focused on finding all pros and cons behind new system. In meantime I had a lot of talks with programmers friends in Poland and here in Canada. Thanks to them I was able to create my own opinion and vision what I want to achieve with this new code.

Tech talks: placement new

So another post under sign of programming. This time: placement new. So lets's look on this part of code :     ... if (techData.texturesCount[idx] > 0) {     tech->m_textures = new(memoryPtr) STextureSlot[tech->m_texturesCapacity];     memoryPtr += sizeof(STextureSlot) * tech->m_texturesCapacity; } else {     tech->m_textures = NULL; } ... It's a part of White Rabbit Engine materials creator. It's purpose is simple : allocate memory for material + techniques + textures slots. And use placement new to create objects. Everything so all materials data was put in continuous memory. Of course it's nice but there is one problem : this part of code is wrong. Everything look nice but placement new for arrays add additional data about array before objects. So   new(memoryPtr) STextureSlot[tech->m_texturesCapacity] use more memory than :   sizeof(STextureSlot) * tech->m_texturesCapacity; For me this m...

Multithreaded rendering (Part 3)

Image
After "little" break lets return to topic. Last time we ended on system that was already split on two threads. This week we will focus how to change it so it work the way we wanted: So let's start from analyzing a little more situation on which we ended  in last part : This model look already pretty good and would be enough in some situation. We can use it in this way : Place marked as " Sync " mean time in which "Gather Data" wait till rendering finish using  rApi render list (buffer contain all information's need to render frame). As we see game can update in meantime of rendering. So everything should work faster than in one thread.