Jump to content

  • Log In with Google      Sign In   
  • Create Account

fastcall22

Member Since 04 Feb 2008
Offline Last Active Today, 01:20 AM

#5255949 Drawing graphics in C++ w/out APIs?

Posted by fastcall22 on 07 October 2015 - 12:16 AM

To answer OP's question directly: It is simply impossible.

The C language itself has no ability to communicate with anything other than memory. The C standard library, among other things, provides basic I/O to file descriptors: stdin, stdout, stderr, and files. However, before you can even read or write to descriptors as described by the C standard library, there must already exist an API exposed by the operating itself to facilitate such means, and there must be a platform specific library which links platform-independent code to platform-specific code (the C runtime library). In a sense, Nypyren's example relies on a API. The BIOS itself (and/or DOS) exposes services to allow interaction between the software and the hardware. Why doesn't the C standard library "just provide" all these fancy things? Because it cannot guarantee that all platforms can support it. What good is platform-independent code, if platforms cannot support it? To put it bluntly, "(C and C++) doesn't even require your system to have a screen or keyboard"!

This isn't to say that APIs are bad. These days, there are so many layers of abstraction, it's unavoidable. APIs are absolutely necessary, and you must take the time to understand the libraries you use in order to write a well behaved program. If you're looking to get down to the wire with real-time software rendering, then you can use either your platform's API to create and window and blast pixels, or use a cross platform library to do it for you. Either way, there will be some cost in learning a new API.

But it's worth it.


#5254997 Unpredictable, ubiquitously rng seed

Posted by fastcall22 on 01 October 2015 - 10:01 AM

When a player receives the salt from the other player, it's easy to verify that its hash is indeed what had been sent originally.

Unfortunately this still suffers the out-of-order problem, where a player can decide his seed based on what the other player had sent.

the player who first receives their opponents salt could choose a salt that makes the final value most advantageous to themselves

In that case, perhaps a third party should act as a mediator, and hold all players' actions until he has received all players' actions.


#5254919 Unpredictable, ubiquitously rng seed

Posted by fastcall22 on 30 September 2015 - 09:01 PM

A UTC timestamp is good, but it is predictable. A player can decide his actions on the seed that will be used on the upcoming day.

I think the best approach would be a known seed, but salted with a number supplied from both players. This way, a player cannot determine what the next seed will be for the next advance of the game state:

1. Player A and player B agree on a PRNG algorithm and a starting seed from a third party source. A random number table can work really well for this purpose.
2. At the end of each turn, each player decides on a non-zero number (the salt) that should be added to the seed.
3. On the start of the next turn, the sum of both the player's chosen salts are added to the seed.
4. Each player solves the new game state with his and the other player's actions, using the new seed.


The outcome of each turn can be verified, since the PRNG algorithm is known, the state of the seed is deterministic.


#5254489 What exactly is API-First?

Posted by fastcall22 on 28 September 2015 - 03:44 PM

Feh.

All our projects have been API First before API First was a thing.
</webdevhipster>


Just wanted to throw more fuel to the SEO fire.


#5254423 I want to make a game but i have no skill!

Posted by fastcall22 on 28 September 2015 - 11:47 AM

Check out the For Beginners FAQ.


#5254288 Singleton and template Error (C++)

Posted by fastcall22 on 27 September 2015 - 06:25 PM

Unless you explicitly list out all template instantiations, you cannot separate the template into header and source files.

See also: Why can’t I separate the definition of my templates class from its declaration and put it inside a .cpp file?


That aside, you shouldn't use globals because blah blah blah.

EDIT:
SeanMiddleditch has a valid point


#5254282 Graphics API for Visual Studio 2015

Posted by fastcall22 on 27 September 2015 - 05:34 PM

Hey guys, I got Visual Studio 2015 but apparently SFML isn't compatible with it yet.

How so? The prepackaged binaries list Visual Studio 2015, both x64 and x86.


#5254098 MySQL statement error

Posted by fastcall22 on 26 September 2015 - 01:44 AM

a foreign key constraint fails ... FOREIGN KEY (`categoryId`) REFERENCES `category` (`id`)


This is important. You are attempting to add an `eventCategoryMap` to a non-existent `category`. Check that a category exists for your categoryId.


#5253832 MIDI file experts needed!

Posted by fastcall22 on 24 September 2015 - 10:20 AM

Well, given MIDI's history, I wouldn't be surprised if an older MIDI file used a non-standard extension or behavior that is supported in your tool but not in craigsapp/midifile.


... ಠ___ಠ
Also, please don't use windows notepad to compare binary files. You may get better results with a hex editor such as HxD.


#5253208 Is it possible to optimize this? (keeping a small array in registers)

Posted by fastcall22 on 20 September 2015 - 01:55 PM

I find the attitude a bit condescending. I've asked a well defined question about in my view interesting optimization problem and you are assuming I am missing something in the big picture.


Okay, fair enough. I wanted to be sure all the bases were covered.

Feel free to down vote our posts if you feel we've been unhelpful.


#5253051 SDL Image

Posted by fastcall22 on 19 September 2015 - 10:09 AM

Nice idea, throwing out your entire toolchain to add a library


Calling Dev-C++ a toolchain these days is giving it too much credit.

http://clicktobegin.net/programming/why-you-shouldnt-use-dev-c/ still applies in 2015.


#5252896 SDL Image

Posted by fastcall22 on 18 September 2015 - 10:48 AM

Easy.
  • Uninstall Dev C++
  • Install Visual Studio 2015 Community Edition (free), CodeBlocks (free), Qt (free)
  • Download and extract SDL_Image to your library folder /usr/lib or \lib\cpp\SDL_Image or what have you
  • Add the appropriate include path to the include directories of your project's build configuration
  • Add the appropriate library path to the library directories of your project's build configuration
  • Add SDL_Image.lib/.a/.o to your project's linker configuration
  • Copy SDL_Image.dll and its dependencies to your executable's working directory
And you're done!


#5252782 collision detection in maze issue

Posted by fastcall22 on 17 September 2015 - 06:31 PM

Or you could make the player a bit smaller such that he can fit in the corridors.


#5252528 Programming Role Playing Games with DirectX

Posted by fastcall22 on 16 September 2015 - 09:57 AM

Additionally, VC6.0 has been outdated for about two decades. Once you are comfortable with the basics of C++ and DirectX, you should consider picking up Visual Studio 2015 Community Edition for free. From there, you can start using DirectX 11 with the latest Windows SDK.

Though, it partially depends on what kind of system and hardware you're using and/or targeting.


#5252285 Programming Role Playing Games with DirectX

Posted by fastcall22 on 14 September 2015 - 09:57 PM

The C++ standard only allows alphanumeric identifiers and UTF-8/ANSI files. Check the character encoding of your source files.

Additionally, you can lookup the error number, C2018, on msdn:
https://msdn.microsoft.com/en-us/library/977dd354.aspx




PARTNERS