• What Do You Need Help With? V6
    7,544 replies, posted
[QUOTE=robmaister12;41965142]A little bit of searching also brought up [URL="http://monocross.net/"]MonoCross[/URL], which appears to be free and works on iOS, Android, and WP[/QUOTE] MonoCross is free. With the small issue that it requires you to get the Xamarin SDK. If you look at the download page it will tell you to get it.
Thanks for the help guys, I'm also into getting a OCR library (looking into puma.net, if it matters). Does the 32kb limit include external libraries? I'm not quite sure what the IL actually is. And yeah, I'd probably want it to be free.
[QUOTE=buster925;41955358]Any advice for making a 2d game in c++?[/QUOTE] Learn SFML? [editline]26th August 2013[/editline] [QUOTE=Chris220;41963672]There's a lot more to it than this, but essentially it doesn't matter. Just pick whichever one seems nicest to you and go with it. Most things can be done just fine in all three languages, and if you ever need to switch then it's not a lot of effort to learn the differences.[/QUOTE] While I generally agree that the answer to "Which language should I learn?" is "It doesn't matter", he was asking which is "the most useful to know". For [I]that[/I] question I would definitely go with C simply due to the huge number of libraries available for it. Also, being procedural, I think it's easier to learn C and then learn OOP with something like C++ or C#. But you're right that there's a lot more to it than this.
[QUOTE=Chris220;41963672]There's a lot more to it than this, but essentially it doesn't matter. Just pick whichever one seems nicest to you and go with it. Most things can be done just fine in all three languages, and if you ever need to switch then it's not a lot of effort to learn the differences.[/QUOTE] [QUOTE=Larikang;41973083]Learn SFML? [editline]26th August 2013[/editline] While I generally agree that the answer to "Which language should I learn?" is "It doesn't matter", he was asking which is "the most useful to know". For [I]that[/I] question I would definitely go with C simply due to the huge number of libraries available for it. Also, being procedural, I think it's easier to learn C and then learn OOP with something like C++ or C#. But you're right that there's a lot more to it than this.[/QUOTE] Good to know, thanks guys!
[QUOTE=Larikang;41973083]While I generally agree that the answer to "Which language should I learn?" is "It doesn't matter", he was asking which is "the most useful to know". For [I]that[/I] question I would definitely go with C simply due to the huge number of libraries available for it. Also, being procedural, I think it's easier to learn C and then learn OOP with something like C++ or C#. But you're right that there's a lot more to it than this.[/QUOTE] Thing is, how 'useful' a language is is quite subjective. For example, I could argue that C# is more useful because you can generally make things (windows applications for shorter) faster, which could be more useful if that's what you need to do. Determining how 'useful' something is requires that one knows the advantages and disadvantages of all the available options.
Well im a noob on DX and 3d in general and i kinda hit a brick wall. Its supposed to move vertexes to be rendered but it does not do anything , did i not initialise something ? (Its in my main rendering loop) [code] D3DXMATRIX M1; D3DXMatrixIdentity(&M1); D3DXMatrixTranslation(&M1, 1200.0f, 400.0f, 0.0f); Dev9->SetTransform(D3DTS_WORLD,&M1); [/code] Heres the full code [code] #include "Rendering.h" #pragma comment(lib,"d3d9.lib") #pragma comment(lib,"d3dx9.lib") extern "C" int _fltused = 0; LPDIRECT3D9 D3D = NULL; LPDIRECT3DDEVICE9 Dev9 = NULL; D3DXMATRIX WorldMatrix; D3DXMATRIX ViewMatrix; D3DXMATRIX ProjectionMatrix; RenderData *RenderBuffer; void ZeroMem(volatile byte *Mem,DWORD Size) { for(DWORD i = 0; i < Size;i++) { Mem[i] = 0; } } void CopyMem(byte *MemTo,byte *MemFrom,DWORD Size) { for(DWORD i = 0;i < Size;i++) { MemTo[i] = MemFrom[i]; } } void InitD3D9(HWND WindowHandle) { D3D = Direct3DCreate9(D3D_SDK_VERSION); //D3D_SDK_VERSION is stored in d3d9.h D3DPRESENT_PARAMETERS DP; ZeroMem((byte*)&DP, sizeof(D3DPRESENT_PARAMETERS)); DP.Windowed = TRUE; //set to TRUE for windowed mode DP.SwapEffect = D3DSWAPEFFECT_DISCARD; //swapping method for our back buffer DP.BackBufferFormat = D3DFMT_X8R8G8B8; //sets the format of our back buffer DP.BackBufferCount = 1; //sets number of backbuffers DP.hDeviceWindow = WindowHandle; //specifies current window D3D-> CreateDevice(D3DADAPTER_DEFAULT,D3DDEVTYPE_HAL,WindowHandle,D3DCREATE_SOFTWARE_VERTEXPROCESSING,&DP,&Dev9); RenderBuffer = (RenderData*)GlobalAlloc(0x0040,9000); Dev9->SetRenderState(D3DRS_ZENABLE,0); // turn on the z-buffer } RenderData *AddToRenderBuffer(Vertex *VertArray,DWORD NumOfVerts,DWORD NumOfTris,WORD *Indices,DWORD NumOfIndices,char *TexturePath) { RenderData *RD = RenderBuffer; while(RD->VertexBuff != 0) RD++; Dev9->CreateVertexBuffer(NumOfVerts*sizeof(Vertex),0,D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1,D3DPOOL_DEFAULT,&RD->VertexObj,0); RD->VertexObj->Lock(0,NumOfVerts*sizeof(Vertex),&RD->VertexBuff,0); CopyMem((byte*)RD->VertexBuff,(byte*)VertArray,NumOfVerts*sizeof(Vertex)); RD->VertexObj->Unlock(); RD->VertArray = VertArray; RD->NumOfTris = NumOfTris; RD->NumOfVerts = NumOfVerts; if(Indices != 0) { Dev9->CreateIndexBuffer(2 * NumOfIndices,0,D3DFMT_INDEX16,D3DPOOL_MANAGED,&RD->IndexObj,0); RD->IndexObj->Lock(0,2 * NumOfIndices,(void**)&RD->IndexBuff,0); CopyMem((byte*)RD->IndexBuff,(byte*)Indices,NumOfIndices*2); RD->IndexObj->Unlock(); } if(TexturePath != 0) { D3DXCreateTextureFromFileA(Dev9,TexturePath,&RD->TextureObj); } return RD; } void RemoveFromRenderBuffer(RenderData *RD) { RD->VertexObj->Release(); RD->VertexObj = 0; RD->VertexBuff = 0; if(RD->TextureObj != 0) { RD->TextureObj->Release(); RD->TextureObj = 0; } } void ModifyVertex(RenderData *VertBuff,DWORD VertexNumber,Vertex *NewData) { RenderData *RD = RenderBuffer; while(RD->VertexBuff != VertBuff) RD++; RD->VertexObj->Lock(0,RD->NumOfVerts*sizeof(Vertex),(void**)VertBuff,0); Vertex *OldData = (Vertex*)VertBuff; for(DWORD i = 0; i < VertexNumber;i++) { OldData++; } *OldData = *NewData; RD->VertexObj->Unlock(); } void Render(void) { if(Dev9 == 0) return; RenderData *RD = RenderBuffer; Dev9->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); Dev9->BeginScene(); while(RD->VertexBuff != 0) { D3DXMATRIX M1; D3DXMatrixIdentity(&M1); D3DXMatrixTranslation(&M1, 1200.0f, 400.0f, 0.0f); Dev9->SetTransform(D3DTS_WORLD,&M1); Dev9->SetStreamSource(0,RD->VertexObj,0,sizeof(Vertex)); Dev9->SetFVF(D3DFVF_XYZRHW|D3DFVF_DIFFUSE|D3DFVF_TEX1); if(RD->TextureObj != 0) { Dev9->SetTexture(0,RD->TextureObj); } if(RD->IndexObj == 0) { Dev9->DrawPrimitive(D3DPT_TRIANGLESTRIP,0,RD->NumOfTris); } if(RD->IndexObj != 0) { Dev9->SetIndices(RD->IndexObj); Dev9->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0,RD->NumOfVerts,0,RD->NumOfTris); } RD++; } Dev9->EndScene(); Dev9->Present(NULL, NULL, NULL, NULL); } void WireFrame(bool OnOff) { if(OnOff == 1) { Dev9->SetRenderState(D3DRS_FILLMODE,D3DFILL_WIREFRAME); } if(OnOff == 0) { Dev9->SetRenderState(D3DRS_FILLMODE,D3DFILL_SOLID); } } void SetCam(float Xpos,float Ypos,float Zpos,float Xrot,float Yrot,float Zrot) { D3DXMatrixTranslation(&ViewMatrix, 1200.0f, 400.0f, 0.0f); Dev9->SetTransform(D3DTS_VIEW,&ViewMatrix); } [/code]
- snip -
I'm looking for some advice on what would be the ideal way to create an installer that can also patch files. Mostly binary files, in which I presume xdelta would be an ideal method, however that would require to have diff patches made for each file I would like to patch. Is there any other method involving a container file that holds all patches? On top of that, I would have to check the target files' checksum before patching each file. Any help is appreciated, thanks.
making a ascii type game with a few friends like and rpg/dwarf fortress type game any advice
[QUOTE=Z!NX;41986866]making a ascii type game with a few friends like and rpg/dwarf fortress type game any advice[/QUOTE] Try to keep properties separate from implementation, maybe even in a (validated) non-code file. With this type of game you're going to end up with a ton of similar but not quite the same entities and once they are modular enough you can create additional ones very quickly.
I asked this on the SFML forum but they were useless. I'm using SFML.NET inside a windows form and am having trouble getting a mousewheel event to fire. I have tried three different ways, using the Forms event handling, using the SFML window's event handling and creating an SFML event and handling that. Nothing seems to work and I think it is because SFML steals the focus from the form, in which case you would think that the SFML events would work but they don't. I have successfully handled some other events on the form which you will see below. Forms event, all of these other events fire, just not the MouseWheel event. [code] public Form1() { InitializeComponent(); this.Load += new System.EventHandler(this.Form1_Load); this.FormClosed += new FormClosedEventHandler(this.Form1_Closed); this.ResizeEnd += new EventHandler(this.Form1_ResizeEnd); this.MouseWheel += new MouseEventHandler(Form1_MouseWheel); } void Form1_MouseWheel(object sender, MouseEventArgs e) { Console.WriteLine("HI"); } [/code] Trying the SFML events. [code] //Load private RenderWindow SFMLWindow; private bool FormOpen = true; private Event mainEvent = new Event(); private void Form1_Load(object sender, EventArgs e) { SFMLWindow = new RenderWindow(this.Handle); SFMLWindow.Size = new Vector2u((uint)ClientSize.Width, (uint)ClientSize.Height); SFMLWindow.MouseWheelMoved += new EventHandler<MouseWheelEventArgs>(window_MouseWheelMoved); MainLoop(); } [/code] [code] //Loop private void MainLoop() { while (FormOpen) { Application.DoEvents(); SFMLWindow.DispatchEvents(); SFMLWindow.Clear(SFML.Graphics.Color.Black); MWheelInput(); SFMLWindow.Display(); } } [/code] [code] //Handling private void window_MouseWheelMoved(object sender, MouseWheelEventArgs e) { Console.WriteLine("FIRE!#!!!"); } private void MWheelInput() { if (mainEvent.Type == EventType.MouseWheelMoved) { Console.WriteLine("Fire"); } } [/code] It's probably something stupid.
Quick question: Is it possible to set up the blend functions and equations in OpenGL so that Result = (1 - source) * (1 - destination) ?
Not with just glBlendEquation and glBlendFunc.
[QUOTE=ThePuska;41998283]Not with just glBlendEquation and glBlendFunc.[/QUOTE] Sorry, I meant to write 1 - (1 - s)(1 - d)... I think. What I'm doing is drawing possibly transparent things to a framebuffer so I end up with pre-multiplied alpha, but it seems I won't be able to get the alpha channel completely right this way. [editline]28th August 2013[/editline] [code]GL.BlendFuncSeparate(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha, BlendingFactorSrc.One, BlendingFactorDest.OneMinusSrcAlpha);[/code] Would that be an exact solution for pre-multiplied colours and the right alpha value when drawing over (0, 0, 0, 0)? [editline]28th August 2013[/editline] Here's a Stack Overflow answer on how it works: [URL]http://stackoverflow.com/a/18497511/410020[/URL]
Hi, I have a problem where I have a int array that contains a ip address lets say "10 ,0 ,0 ,16382" that last octet needs to be divided to a maximum of 255 of each octet. When the last octet fills to 255 the third becomes a 1 and the fourth starts over towards 255 again and over and over. It also needs to take in to account the subnet ID and broadcast addresses of each subnet. In this case is 1024. I have done a little but not enough to go on so I would like your help to find a solution. The first subnet is 10.0.0.1 - 10.0.63.254 accordingly to [url]http://www.subnet-calculator.com/subnet.php?net_class=A[/url] Thanks.
Hello I need some help with some "Database" code I am writing. I have a class called database which is going to contain all of the classes it needs to store. Currently it only has one property in it called Customers which is a ObservableCollection<Customer>. Now I have this code to update it or delete a entry from it (it is networked so it gets send some commands over a stream) [code] public void CustomerData(string a_Data) { string type = a_Data.Substring(0, a_Data.IndexOf(':')); string data = a_Data.Substring(a_Data.IndexOf(':') + 1); if (type == "ADD") { m_Database.Customers.Add(JsonConvert.DeserializeObject<Customer>(data)); } else if (type == "DELETE") { int index; if(Int32.TryParse(data, out index)) { if(m_Database.Customers.Count > index) { m_Database.Customers.RemoveAt(index); } else { Console.WriteLine("Tried to remove customer which didn't exist in database"); } } } else if (type == "UPDATE") { int index; if (Int32.TryParse(data.Substring(0, data.IndexOf(':')), out index)) { if (m_Database.Customers.Count > index) { m_Database.Customers[index] = JsonConvert.DeserializeObject<Customer>(data.Substring(data.IndexOf(':') + 1)); } else { Console.WriteLine("Tried to update customer which didn't exist in database"); } } } } [/code] Now I was thinking this is way to much if I have to add that for each list I add to the database, is there any way using templates or reflection to make a generic function for all the ObservableCollections in the database class ?
You can store the collections in a Dictionary<Type, object>, then TryGetValue(...) them based on typeof(T) where T is a generic type parameter. To network it you'd have to send the type (name) in some form. JsonConvert should be able to deserialize an object based on a Type instead of a type parameter. You can construct a generic type at runtime from for example typeof(ObservableCollection<>) and get the getter and setter from there, but it's most likely easier to just use ObservableCollection<object>.
[QUOTE=landizz;42000681]Hi, I have a problem where I have a int array that contains a ip address lets say "10 ,0 ,0 ,16382" that last octet needs to be divided to a maximum of 255 of each octet. When the last octet fills to 255 the third becomes a 1 and the fourth starts over towards 255 again and over and over. It also needs to take in to account the subnet ID and broadcast addresses of each subnet. In this case is 1024. I have done a little but not enough to go on so I would like your help to find a solution. The first subnet is 10.0.0.1 - 10.0.63.254 accordingly to [url]http://www.subnet-calculator.com/subnet.php?net_class=A[/url] Thanks.[/QUOTE] I have written something that might be on the right track. Although the output is 0. [CODE]int IP::HostLoop(int HostPerSub, int AmountSub){ int FixMask[5] = {10, 0, 0, 0}; int ArrayCount = 0; float a = 0; for(int i=0;HostPerSub < i;i++){ FixMask[4] += 1; if (FixMask[4] == 255) FixMask[4] = 0; if (a != 0){ if(i < a) { a += 255; ArrayCount++; } if (a == 0) a = 127.5 * 2; if(i == a){ FixMask[3] += ArrayCount; if ( FixMask[3] == 255) FixMask[3] = 0; } } } cout << FixMask[2] << endl << FixMask[3] << endl << FixMask[4]; return 0; }[/CODE]
I need a good refresher on python before an upcoming technical interview (I dabbled, need to be super-ready ) Anyone got any good resources/tutorials?
Anyone worked with PhysX? I'm trying to implement the character controller. However, since the body is kinematic I have to apply gravity myself, as well as jumping. I am not sure how to do either properly. I've tried my own solution: first, raycast against the opposite of the up direction and with a distance of the contact offset. If we hit, then we are on the floor. This works alright, except for when I am on steep angle. I guess it's fine if you can't jump then, but it would still be nice. [cpp]PxRaycastHit hitInfo; PxVec3 footPos; footPos.x = controller->getFootPosition().x; footPos.y = controller->getFootPosition().y; footPos.z = controller->getFootPosition().z; bool gotHit = physics.getScene()->raycastSingle(footPos, -controller->getUpDirection(), controller->getContactOffset(), PxSceneQueryFlags(), hitInfo); if(gotHit) //Jump somehow?[/cpp] The issue now is that I am not sure how to jump. I thought about setting the gravity to a positive value, currently like so: [cpp]gravity = 50*Settings::Timestep;[/cpp] And then apply gravity each frame, like so: [cpp]gravity += physics.getScene()->getGravity().y * Settings::Timestep;[/cpp] However, this makes the jumping and falling very fast, much faster than I want it. I also have a terminal velocity of -20 units per frame, however I feel like that's too fast and might tone it down to be something like -100*Settings::Timestep. Alright sorry if that sounded stupid, because it kind of does. What my real questions are this: what is the correct way to check if an object is grounded? What is the correct way to invoke an impulse (jump) and to apply gravity? I think I am doing it correctly right now, I'll just tweak it a bit. But the issue is that sometimes I am not close enough to the ground to count as being grounded with a ray cast, but the physics engine disagrees. Would checking the delta of the previous linear velocity and the current linear velocity be enough? As in if we were at linearVelocity().y == 0 for both? Ah, now I know: I sweep test will do! However, I am not sure how to get the needed geometry out of the controller. What was I thinking? I'm a programmer. Fuck traversing through abstract classes and casting, I'll just make a new geo shape with the same properties as the one of the character.
You could try tracing normally to detect horizontal floor and tracing horizontally one or more times to detect slopes. The best way to jump is to set the velocity directly, or to add to it once and deny jumping again until the player has left the floor. If you apply acceleration the jump will depend on the time step of the next frame. Gravity should be constant during the jump so that the velocity increases linearly.
Alright so there is no issue with the time step, as it is going to be static (1/60). The issue right now is that I can climb walls. These walls are made up of a triangle mesh. I am able to just jump and keep jumping, because this counts as a collision. This is the code as of right now: [cpp]PxSweepHit hitInfo; PxVec3 centerPos; centerPos.x = controller->getFootPosition().x; centerPos.y = controller->getFootPosition().y; centerPos.z = controller->getFootPosition().z; //the capsule is the same as the character controller's bool gotHit = physics.getScene()->sweepSingle(PxCapsuleGeometry(0.25, 1.25), PxTransform(centerPos),PxVec3(0,-1,0),controller->getContactOffset(), PxSceneQueryFlags(PxSceneQueryFlag::eINITIAL_OVERLAP|PxSceneQueryFlag::eINITIAL_OVERLAP_KEEP|PxSceneQueryFlag::eNORMAL), hitInfo); if(gotHit){ gravity = 20*Settings::Timestep; std::cout << "Ray charles came back true "; }[/cpp]
Try to sweep with a thinner capsule, so it doesn't hit a wall the player is in contact with.
That's what I though too, but using a capsule of radius 0.1 and of height 1.25/2 (I realize now it is a half height, not a height, though it didn't affect things for some reason) yields the same issue. I think the issue lies in the centerPos vector. I am setting it as the foot position (i.e. the bottom of the capsule) when in reality it should be the center (I think). However, if I do this, then the trace collides with the controller's rigid body. Any ideas on how to ignore a sweep hit from the rigid body?
If there's not an explicit ignore function you could try temporarily removing the rigid body from the physics system.
Tried that. Didn't help. I tried to use a multi sweep, to see how the collisions where working out. When I was centered and didn't remove the actor, there was a continuous hit. So this was the kinematic actor. When I used the bottom position and didn't remove the actor, there was no such hit. Therefore the position should be the center position. I still get a hit against the flat wall areas. The normal that is reported is (0,1,0). Since the character has a sort of padding (the contact offset), I also added that to the capsule geometry (now it is initialized with a radius of 0.25+contactOffset).
what is the incentive to use DirectX over OpenGL?
[QUOTE=Shotgunz;42014520]what is the incentive to use DirectX over OpenGL?[/QUOTE] I hear it's faster on a few GPUs. Easier to port to Xbox (no Xbox support for OpenGL). The 360 version was based on 8.1, but is modified to fit the architecture. Xbox One will use DX11. (PS3 and 4 use OpenGL-based stuff) That's about it, really.
Sup guys. I'm having some trouble with this Python program. Basically the program is supposed to take an ISBN number, validate it, and print whether the input code is valid or not. Here's the full instructions: [quote]The first digit and all odd digits (except the last) are totaled. The second digit and all even digits are multiplied by 3 and totaled. The two totals are then added. The remainder of that total divided by 10 is subtracted from 10. Ifthe result is 10, then the check digit is 0; otherwise, the result is the check digit. Prompt the user for an ISBN and send it to a function that will • remove any dashes that they may have entered • convert each digit into an integer • store the integers in a list. Print the list to the screen for the first demo. For part 2: Calculate the check digit and compare to the last digit of the ISBN number. If they are the same, print the number entered by the user followed by “is a valid ISBN.” If they are different, print the number entered by the user followed by “is not a valid ISBN.” Try it with the example given. Then try it with 978-0-596-80237-0. It should work with both.[/quote] And here's what I have. I got really close, but I somehow keep getting "this number is invalid" when the number should be valid. [code]def filter(isbn): isbn = isbn.replace("-", "").replace(" ", "") y=[] y=list(isbn) return y input = (input("Enter the ISBN code for validation: ")) x=filter(input) for y in range(0,12): x[y]=int(x[y]) validate = (10-(((x[0]+x[2]+x[4]+x[6]+x[8]+x[10]) + (3*x[1]+3*x[3]+3*x[5]+3*x[7]+3*x[9]+3*x[11]))%10)) if validate == 10: validate = 0 if validate == x[12]: print (input, "is a valid ISBN") else: print (input, "is not a valid ISBN")[/code] Any suggestions would be greatly appreciated, I'm really stumped at this point.
You're checking a 12-digit isbn, while you probably want a 13-digit one.
Sorry, you need to Log In to post a reply to this thread.