Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411507 Posts in 69374 Topics- by 58429 Members - Latest Member: Alternalo

April 26, 2024, 03:06:47 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)General thread for quick questions
Pages: 1 ... 38 39 [40] 41 42 ... 69
Print
Author Topic: General thread for quick questions  (Read 135408 times)
oahda
Level 10
*****



View Profile
« Reply #780 on: July 17, 2016, 06:37:38 AM »

Thanks a lot for all that great info!
Logged

gbelo
Level 0
**


hanging out


View Profile WWW
« Reply #781 on: July 25, 2016, 12:45:42 PM »

So we all know that Flash is in a persistent vegetative state and its plug has been pulled.

Is Haxe actually a viable alternative to Flash/ActionScript3? Because I want to (finally) port my project from Flash to something that actually.. you know, works. I did use the Flixel library for AS3, and I know HaxeFlixel exists.. that gives me hope.

I don't mind reworking my project from the ground up in e.g. Unity, but I'd rather not.
Logged

Cheezmeister
Level 3
***



View Profile
« Reply #782 on: July 25, 2016, 10:30:16 PM »

Haven't used Haxe, but word on the street is it's pretty legit.
Logged

෴Me෴ @chzmstr | www.luchenlabs.com ቒMadeቓ RA | Nextris | Chromathud   ᙍMakingᙌCheezus II (Devlog)
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #783 on: July 26, 2016, 04:50:52 AM »

Haxe and Haxeflixel is amazing. I highly recommend. It's even got it's own nice IDE these days if you are on windows.

http://www.haxedevelop.org/

Logged

LucasMaxBros
Level 2
**


My body is ready.


View Profile WWW
« Reply #784 on: July 28, 2016, 04:05:06 AM »

A question for virtual keys in Game Maker: So I'm working with customization for controls. Works well and dandy. But I want it to look nice and professional if I can and have it so I can show the current keys you have for your controls and draw what key you've switched it to. Every key has a code number to it, which I can use to read a specific image in a list of key sprites and draw it to match the key you just pressed.

But what I'm worried about is that there seems to be variations for some virtual key codes with different computers. So it seems that if I were to do this, if someone were to have a different virtual key code system while playing my game, would they sometimes end up getting keys that don't match? Or am I worried about nothing? But if it is the case, is there a better work around?
Logged

ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #785 on: July 28, 2016, 11:18:02 AM »

Virtual key codes are handled in a variety of ways by different APIs. I don't know specifically what Game Maker does, but you'd be able to find out by changing your system keyboard layout to something foreign, or Dvorak/QWERTY (whichever one you don't normally use). If the key in the same physical position still gives you the same code regardless of chosen layout, you should be OK. If the virtual key codes change based on system layout, and there's no lower level API that can give you physical key codes or scan codes, you might have to figure out another solution.
Logged

oahda
Level 10
*****



View Profile
« Reply #786 on: July 28, 2016, 12:38:14 PM »

Huh, shouldn't it be the other way around? I.e. if, say, the Q key reports the same code no matter where it is on the keyboard (different positions depending on QWERTY vs. AZERTY for example), then that is as it should be, and they can display the sprite for the Q key no matter what, while if the key in the position of Q on QWERTY reported the same code on AZERTY (and not a different one representing A) that would be problematic?
Logged

LucasMaxBros
Level 2
**


My body is ready.


View Profile WWW
« Reply #787 on: July 28, 2016, 04:18:03 PM »

So been doing more research. Still very surprised there isn't anything on this, I see tutorials for rebinding and stuff but they never have ones that show what keys you currently have as your setup.

But what I seem to be looking for is keyboard unicode, which I'm still having trouble with. I'd like the last key pressed to be read in universal code by using "ord" but it's not working. I also checked the ASCII and am confused because my keys aren't reading off as the same numbers listed even after checking multiple sources, I don't know the difference.

This is what Game Maker seems to be reading off of, but it doesn't give a name to what it is: http://cherrytree.at/misc/vk.htm

Can anyone make sense of this to me please? I know this works since all the keys I press will draw the number according to this table in-game. But IS this at all universal or is it specific to some keyboards?
Logged

Sik
Level 10
*****


View Profile WWW
« Reply #788 on: July 28, 2016, 04:59:40 PM »

Virtual keys = depends on the keyboard layout (what you want to show)
Scancodes = depends on the physical position (what you want to map)

...though looking around apparently Game Maker doesn't support scancodes? WTF?
Logged
LucasMaxBros
Level 2
**


My body is ready.


View Profile WWW
« Reply #789 on: July 28, 2016, 08:17:51 PM »

Yeah, found that out while looking too. I did find an answer to a degree from gamemaker reddit.

hypnozizziz:
"It's universal and yes it's ASCII. The exceptions would be foreign keyboards and those that are poorly manufactured (don't have keys sending the correct ASCII codes through their logic boards)."

I suppose this is probably as good as it gets. I can make it so foreign keyboards can still play, they just won't always read the keys off right when drawn, but I guess that would also be understandable since it's a different language. I just want things I make to be accessible to foreigners without too much confusion for them.
Logged

oahda
Level 10
*****



View Profile
« Reply #790 on: July 29, 2016, 12:58:47 AM »

I stumbled across an article from 2010 saying that "std::tuple can store up to 10 objects of different types"... Is this limit still true in 2016/C++14? :/ Also, are tuple values consecutive in memory, and if not, why not?
Logged

Kylotan
Level 0
**


View Profile WWW
« Reply #791 on: July 29, 2016, 05:18:07 AM »

Are you interested in the standard, or what is actually implemented? Practically it depends on your compiler/standard library implementation. In the past (i.e. Visual Studio 2012 and older, I think) I've seen std::tuple implemented as 10 separate specialisations, one for each number of different objects. However the implementation I'm looking at seems to implement them recursively with variadic templates, so it should theoretically be infinite.

I don't know if std::tuple guarantees contiguous memory but in practice it's hard to imagine a case when it wouldn't be, alignment/padding issues aside.
Logged
oahda
Level 10
*****



View Profile
« Reply #792 on: July 29, 2016, 05:47:47 AM »

Yeah, that more or less answers my question, so thank you. Does create one new question tho: are there any implementations that are still stuck with a limit of 10 that I need to watch out for?
Logged

Kylotan
Level 0
**


View Profile WWW
« Reply #793 on: July 29, 2016, 06:33:53 AM »

I'm not aware of any.
Logged
oahda
Level 10
*****



View Profile
« Reply #794 on: July 29, 2016, 12:03:27 PM »

Question for everybody:

0. What language do you use?
1. How do you feel about unit testing, and why?
2. Do you do it, or not, and why or why not?

You can answer multiple times for multiple languages if you would answer differently depending on the language.
Logged

ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #795 on: July 29, 2016, 01:50:41 PM »

Unit testing is what allows me to do anything ever lol, I don't have a big enough attention span to keep track of all the functions in a project at once, so I just usually use the current projects's easiest output method to test a new function to make sure that it works before plugging it into the rest of the mess. My languages are Python and C++.

I was not aware that the process had a name though, so thanks for that :D
Logged

oahda
Level 10
*****



View Profile
« Reply #796 on: July 29, 2016, 02:42:49 PM »

I tried looking into a couple of C++ libraries, but they were too fancy, even the single-header ones required odd setups and couldn't share data between the tests, so I ended up writing two simple macros of my own.

I haven't touched unit testing since Java in school many years ago, so I'm still not really sure what sort of stuff I ought to test... Everything?



I generally have no trouble keeping track of huge projects for years on end, but bugs do inevitably crop up, and I'm wondering if this sort of attention to detail might help out preventing those. But I'm also getting the feeling that unit tests are more of a team tool, and not something I necessarily have to use as a lone developer..? It also feels less like a game development thing and more like "enterprise" stuff (whatever that means)... And some things, like graphics code, can't really be tested this way, can it?

My only testing tends to consist of just throwing stuff more or less straight into production, or testing it by running it and seeing what happens, rather than really outputting anything, something I tend to save for bug hunting after stuff has already gone awry.
« Last Edit: July 29, 2016, 02:50:18 PM by Prinsessa » Logged

ThemsAllTook
Administrator
Level 10
******



View Profile WWW
« Reply #797 on: July 29, 2016, 06:26:14 PM »

0. C
1. Unit testing is awesome when it can be applied to the code you're writing. Not everything can be unit tested in a practical way.
2. My game code consists of one shared framework that has generic stuff that everything can use in it, and game-specific application code that's unique. Almost all of my framework code is unit tested (using TDD). Almost none of my application code has any tests, and if it does, it might be a candidate for framework inclusion.

I like unit testing because it allows me to fully exercise my code while I'm writing it. TDD makes sure that basically every line is covered by a test, except in places where testing would take an impractically large amount of effort and I decide to fudge it. It also helps me design clean APIs by forcing me to answer most of the important questions about how the API will be used. By writing tests first, building and watching them fail, then implementing just enough to make the next test pass, I verify that the tests themselves work as they're written.

I wrote my own unit test framework, which didn't take a whole lot of effort. It's pretty minimal, but does everything I need it to do. This is one of those cases where it seems like as long as you know what you want, creating it from scratch is likely to be a lot quicker and easier than finding and learning a third party solution that fits your needs.
Logged

Average Software
Level 10
*****

Fleeing all W'rkncacnter


View Profile WWW
« Reply #798 on: July 29, 2016, 07:27:06 PM »

0. What language do you use?

I use all of C, C++, Objective-C, and Ada, but C++ and Ada are my preferences.

1. How do you feel about unit testing, and why?

I loathe it.  I find the idea of testing code with more code to be logically absurd.  I've also been bitten several times by broken unit tests in my professional career.  Maybe there's a way to do them well, but I've never been in an organization that did it, and I've worked for some big players (Microsoft and Wizards of the Coast, for example).

2. Do you do it, or not, and why or why not?

Not unless someone is paying me to.  My own code is usually Ada, which has such strong safety mechanisms that unit tests are almost always redundant anyway.
Logged



What would John Carmack do?
oahda
Level 10
*****



View Profile
« Reply #799 on: July 30, 2016, 01:48:47 AM »

The sort of testing I did above just to see if stuff works I generally do quickly in some file with some cout or printf anyway after I code something up, just to see that it works. I suppose that's just testing, as opposed to unit testing?

Which is why I felt none of the frameworks I found were suitable for me, because they more or less required setting up a different target compiled independently of the main program, and made each test, well, a unit, which meant they couldn't really share code or variables between each other...

I definitely cannot see the practicality of that, at least for my purposes. So that's why the two macros I wrote essentially let me do exactly what I've been doing before, only with some fancier, colour-coded output. So I might use that (it's not like I have to supply a description every time either). But I don't think I'll be doing unit testing proper. It seems like it would slow me down unnecessarily for no obvious reason.
Logged

Pages: 1 ... 38 39 [40] 41 42 ... 69
Print
Jump to:  

Theme orange-lt created by panic