# Nickie

Member

67

1. ## Custom Physics: Preventing objects from losing velocity in certain situation

Thank you for your replies-oppinions.   What I'm going to do is to prioritize the collision response of the objects that have largest area overlapped. This is most likely to solve the other problem(I hope).   P.S Randy nice tutorial you have written. It was really easy to follow and everything took place in my head. Good job.   MARKING THIS AS SOLVED.
2. ## Custom Physics: Preventing objects from losing velocity in certain situation

Illustration: http://s22.postimg.org/7agd30vap/Untitled.png So the little box is my character. The red arrow shows the current velocity(Some force to right + gravity). Below it are 2 blocks which has the same height. The problem is that my algorithm would solve the collision normals with error.(You can see them in green). These would mean that my character would not slide, but will stop in one place.  In this place both collision normals should have been UP(0,1).   Implementation details: I'm following this tutorial: http://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-the-basics-and-impulse-resolution--gamedev-6331     Is there something I miss and how can I fix this problem?
3. ## Good Electronics Projects for Beginners

Raspberry PI is fun but its tricky to power it if you are not lucky like me. All of the charges in my house were giving ~4.70V and raspberry was constantly getting into random kernel panic.  Its fny that after I powered it with arund 5V it still didn't work. I found that the low voltage had erased random bits on the SD card and the image was corrupted... And I need to travel ~40 minutes to the closest electronics shop... Yet I'll try to power it by batteries using a linear voltage regulator. If I have time to buy one 0_0... Still I would recommend it.. Its nice to have linux in your pocket.
4. ## Oh my glorious code!

The feeling of finding old code is awesome. Last week I found my old naruto(cuz there are sprites ) arena game in Visual Basic. Hah I wrote it when I was 13 or 14. Srsly I had multiplayer and 2 characters , though I didn't know what function is and everything was in one large, really large function(automatically generated from a timer I think, I had found that if I double click it shows me editor and I can start typing )   PS. I used the deprecated direct draw for drawing... . My greatest achievement was the moving camera that is following the character. Ohh also I found a vid of my game:  hope you like it
5. ## distributing my program

Find an option in VS project settings where the default is Multi-Threaded DLL or Debug Multu-threaded dll. Change it to simple "Multy-Threaded". That should work.
6. ## Using the message loop in another source file?

Hello there! For some reason I don't really understand what you mean but I will try to answer your question...   What is you framework? How is everything working? +There are many good articles about stuff like this: http://www.gamedev.net/page/resources/_/technical/game-programming/how-to-structure-a-game-r3113 for example... Just pick 2 and read them.   I assume you don't want yout whole game to be in one file and you want to split the things up. First it makes common sence the core game's main loop to be after the initialization function. I wouldn't spli them up. Though every other component would get its own file. I'll give an example on how to do this.   objects.h #pragma once class Entity { public: virtual void update(float deltaTime) = 0; virtaul void render(/* render context */) = 0; }; class Player : public Entity { public: void update(float deltaTime); void render(/* render context */); }; //... and so on... objects.cpp #include "objects.h" void Player::update(float deltaTime) { if(key_pressed('W')) { move_forward(); } //... and everything else you would like to see in your player } void Player::render(/* context */) { if(player_visible()) { context->render(get_player_vertex_data()); } }   main.cpp #include "objects.h" void init() { } std::list<Entity*> objs; void loop() { while(1) { //handle events while(there are messages) { } for(auto i = objs.begin(); i != objs.end(); ++i) { (*i)->update(time); (*i)->render(context); } } } void kill() { } int main() { init(); loop(); kill(); return 0; } Everthing declared can be used, if it is defined somewhere in any of the .cpp files
7. ## Defining some terms

Hello everyone, I would like you to define some words. Model - does it consist of just one mesh? Or multiple meshes? Mesh - does it contain multiple objects. I mean should the mesh contain more than one pair of index/vertex buffers for example. Node - It may be scene node, and it contain pointer to the mesh/model?, the texture, shader, etc.(to allow using the same mesh with different textures). It contain also parent(if the scene is tree oriented), relative position, etc..   Where does the animation goes to? There are thousands of ways that come to my mind to handle animation. Is the character represented from long list of verticles(just one buffer)? If so, I guess animation would go into the mesh object.   These questions may seem easy to answer by some people but I would like to make the things clear for myself. There may be different interpretations of the words I mentions, but what do you understand/imagine when you see these words.
8. ## Modern Garbage Collectors under the Hood

Boost's shared pointers are now part of the C++ standart(11) if I'm right. Before that you could still find it in tr1. So bascially the standart library has some code to help you manage the lifetime of your objects altough its not language feature itself.
9. ## Voxel engine load times

Well I had the same issue. I was loading everything at program startup. If I use vectors for the chunks/blocks it takes around 30 seconds to load everything. VS told me that I'm stuck at the allocations. Moved to raw array and the result was fantastic. You could not even feel that its allocating ~150MB. I was shocked then, now it seems quite normal.Allocating(searching in the heap) is not that heavy operation if you request single block of data. Searching multiple time is the problem.
10. ## Writing good code based on good architecture

Hello everyone. I'm catching a bad tendency about my code. Short after the piece of software grow at 20-25+ files the code seems to be hard to follow and understand. But with proper comments I can remove the last statement "understand". I'm trying to use some kind of patterns to achive better code however everything end up a big mess at the end. So... I fail to hide the complexity in my code. However I don't know how to google about books on the subject. I'm not native english speaker and I canno find good keywords.   My question is: Can you recommend me a good book that can help me write good code?
11. ## Writing good code based on good architecture

Well, I my problem is that I cannot find a good book, because I don't know what keywords to use to the search engine, for example. I don't have problem understanding english tech literature. I've already read game coding complete. The guys seem to know what are they talking about. And still many of the stuff is not suitable for real world code. Game Engine Architecture - Thats was my next choice after GCC. Well, I guess most of the stuff were already coverted in GCC and it was really easy book. The only thing that I didn't know about was the character animation. Currently I'm reading a random book on design patterns hoping it will help me produce good code.   Khatharr - nope. There is only one or two books about programming(in general) in my native language. Even the student's books in school about programming related classes are in english.   P.S. If everything I need is experience then thats good. I already coded one engine(completely refactored/rewritten 3 times) and I guess I'm getting better and better. I was just looking for a way to speed up the process. From my point of view: Code can always be better. Even after I have passed the stage "everything should be perfect" I still have the feeling I miss something.
12. ## once a py2exe program is compiled, can you modify the program without having a python interpreter?

Simply, no. The standart implementation of python(CPython) compiles the code only to bytecode.   For freeze - It saves the python bytecode as a C array and compile it in exe. then It simply run it by the interpreter. I guess py2exe use a similar way(as far as I know it does not require compiler). P.S. http://stackoverflow.com/questions/2912404/how-does-py2exe-actually-and-simply-explained-work If you don't want to read this: It still uses the standart interpreter to execute python bytecode. It is not turned into machine code.   Basically if someone decide to read your code or modify it, you cannot stop him. (Even if its in machine code/bytecode)   Also python bytecode keeps variables and function names, so I guess the source can be completely recovered from bytecode(without comments).
13. ## MSVCR110.dll is missing on executable

Well as far as I know, windows/your app should check the running directory for dlls from that kind. You can just google the name of the dll, download and put it in the same directory.   -or-   http://msdn.microsoft.com/en-us/library/aa278396%28v=vs.60%29.aspx check this out. Use /MT (I'm not really sure will this work, but I managed to run my app some years ago on a PC without almost any runtime libraries.)
14. ## Character Animation.

Hello! Which is the right way of implementing skeletal animation? Does it worth? Hardware vs software? The first thing that pop into my mind is getting all data in memory and one dynamic vertex buffer. Each frame calculate new vertex position in software and update the buffer? Is this the right way of doing this? Yes or no? If no,can u give me a hint if 1-2 sentences. I don't deserve more.. after all I ask before I have tried anything ;/
15. ## Character Animation.

Thank you. Everything I needed.

Thank you all. First of all, I know that a single person cannot do all the job.. My current plan is to synch the threads and get something on the screen, possibly get some input, etc. Currently I've got some general purpose(worker) threads and a sheduler maintaining list of my systems, their priorities and last time they were updated(render for graphics, update for physics... on so on). The sheduler has its own main thread, and in infitite loop it keep checking if the task queue is empty. If so, it orders the systems(by which need  to be updated most) and then find the most suitable to put on the queue.  (It cannot put render update task twice, since it will result in reading/writing shared data). Logic is considered a regular system. If the logic need to know if there is a wall 10meters in front of the character it shoud request a ray cast, so I actually need some kind of services. However having your tips in mind I realised that there are many other things I can reduce and make them more simple. I'll now redesign some parts.. My question is answered. Thank you.

Hello, I'm following the intel's multithreaded engine design document. http://software.intel.com/sites/default/files/m/d/4/1/d/8/Designing_a_Parallel_Game_Engine.pdf I've already implemented the thread pool, service manager, task manager, state manager(state synchronization, obj has moved, created, etc). The problem is that I currently have too many queues. I've got global task manager queue(under global I mean shared for all threads which make sense), service queues and state queues. All systems are hidden behind ISystem interface. So I don't feel confortable with the current way my systems interact. I've got the feeling there is a better way(maybe merging all queues in one?).   For example: I need to tell the graphics module that I want a full screen window with resolution 1024x768. What i do from logics module is: 1. Create object WindowProperties which is derived from ServiceRequestParams class. 2. Call function MakeServRequest(SRVC_SETRENDERWND(which service), this(where should the result be returned, ohh yeah I forgot, I've got another queue for service request results...), ServiceRequestParamsPtr); 3. Handling the request: If-else construct(I really couldn't think of way to "hide" this by polymorphism, altough it is the only if-else construct in my engine), doing the job, packing it in another structure derived from class ServiceRequestParams(yeah the same) and calling function ReturnRequestResult(Id (ServManager has included it in the data bundle pushed in the queue), class_to_return) 4. Waiting on the callers queue for an answer. Another ugly note: I need a way to track where is the data needed(I gave example with window creation, however this may be physics ray cast). I'm using request ids to identify different requests...   Ohhh ugly story. So is there a better way of doing this, can I merge some queues(I need queues for sure for synchronization, I'm on free-step mode), or I should just go back, clear the code as I can and live with it?
18. ## ANN an alternative to evolving multiple instances

There is one really good backprop tutorial. I needed 3 days to figure out what is happening, then I found it. Just from one read I implemented ANN library.   http://clemens.bytehammer.com/papers/BackProp/index.html   Good luck :)
19. ## Beyond 4294967295

Or you can easily implement your own big int library. It is really easy task. Last year, when I was 9th grade one of the problem we needed to solve in our local programming competition was: Without use of any other libraries(ohh they gave us one of the first borland compilers... C++ without namespaces. I was shocked then) we had to find the 1000th fibonacci and check if it can be evenly divided by another number, taken from the standart input.   So if this can be a task for 9th graders it should be easy...   What I did: array of chars which were dinamically allocated and used some loops to do basic operations. Also..You are free to overload operators like << to print directly.
20. ## Unity Scene design.

Hello everyone, I currently need to decide what type of scene will my game need. a/ A root and only one level of children. b/ Not only the root but all objects can have children   What is making my decision harder is that I don't know what the physics engine will do.(I guess bullet physics)   If I didn't have physics -> I've got bus and a character. Bus is parent of character -> character's matrix is being multiplied by its parent to find where I should draw it.(and where should the logic process it) I don't know how physics handle these stuff. I don't know can there be any connections like this(I've been playing with unity3d. I know just the most basic stuff about physic's objects)   For the design itself I'm following ( http://software.intel.com/sites/default/files/m/d/4/1/d/8/Designing_a_Parallel_Game_Engine.pdf ) I have an universal scene. I create the bus and character there like I said above. How should I recreate this in the physics system's scene? Should it be flat? Do I need some connection between a parent and a child(like the transform multiplication like I said above)?   Note: I don't need really advanced physics simulations, just rigid body and collision.   So...how would you do this?
21. ## Scene design.

Thank you for the answer. Pretty much everything I need. I already have experience coding such things(however without physics) and I usually do the same thing you suggested.  I'll just make my universal scene which support parent/children, create a function which will iterate through parents to get the real world position of the node. Then I'll create the physics system like a wrapper to bullet physics. Bullet will take care of its own structures.

24. ## Create a Game Engine

Creating a game engine is really hard task. Especially for someone that hasn't got enough experience. I wated around 1 year before I start my engine(after this idea first came into my mind). During this time I read all books which had the keywords "engine" and "programming" in their titles(If I could find them in PDF, i would really like to buy some of them however not everyone has money). And I can say, it would be better if I had waited a little more. The result was: 5 months working on engine. And then give up, and start it from the very beginning. WHY? Well, books don't tell how you should struct your code. They can just show the way. I also coun't make a plan for my project. I mean I couln't plan my features. This two mistakes bring me down. However I do not regret, I learned how to plan my future projects and how to make my code right with minimal effort.(under struct I meant const correctness, design, naming, etc.) If you are going to start it now... well, happy debugging. The choise is yours.
25. ## Python - strange behaviour

Hello everyone, Yesterday I got my homework from my math teacher. We are studing graphs ( f(x) = x^2 for example ) and how to visualize them( yeah I know, easy ) So she gave me the task to write a programm that will print the graph on the screen. I've chosen python because its high lvl language and I do't have exp with it. (I''m using pygame) I came to the part where I need to grab the mouse coordinates, substract them from the last mouse coords so I can get a vector represention my movement. elif event.type == MOUSEMOTION: print('--------------------') self.mousepos1 = self.mousepos2 self.mousepos1.Print() self.mousepos2.x, self.mousepos2.y = event.pos self.mousepos2.Print() self.mousemotion.Print() self.mousemotion.x = self.mousepos2.x - self.mousepos1.x self.mousemotion.y = self.mousepos2.y - self.mousepos1.y self.mousemotion.Print() Sorry for the possibly dumb question but why the hell this prints something like: -------------------- [ 614 , 258 ] [ 625 , 212 ] [ 0 , 0 ] [ 0 , 0 ] NOTE: I was using functions for +, -, * , /, however I put everything here because I have no idea why it is behaving this way(I assumed the functions may be the problem, but it isn't) EDIT: I'll post the whole code if requiredq just ask - its only 100 lines. I'm using python ver 3.2.2