nesbox / TIC-80

TIC-80 is a fantasy computer for making, playing and sharing tiny games.
https://tic80.com
MIT License
5k stars 483 forks source link

Function to switch input mode? #97

Closed AnastasiaDunbar closed 7 years ago

AnastasiaDunbar commented 7 years ago

Would be useful for a game cartridge with an editor or a menu etc. EDIT: It's just that I think it's more uncomfortable to control a cursor with a gamepad because it's slower than using an actual mouse.

trelemar commented 7 years ago

I could see something like this being useful. Though I've always kinda wished you could simply use gamepad and mouse at the same time.

Crutiatix commented 7 years ago

Would by also useful to switch game input between options gamepad, mouse and both at once. Mainly on desktop it would be very usable or on phone with an external keyboard or a gamepad.

hashalon commented 7 years ago

it is not possible to use both gamepad and mouse at the same time as the buttons pressed and the mouse position are stored at the same position in the RAM. But it should be possible to have a way to switch of input method in game.

Crutiatix commented 7 years ago

One possibility would be to switch input mode every calling of TIC() so per one second it would check 30 times the gamepad and 30 times the mouse at the expense of reaction time :D

hseiken commented 7 years ago

I think, personally, supporting more than what TiC is modelling itself after is more reason to suggest NOT using TiC. I mean, you can just snag Love2D and be done with all requests that I've seen crop up here. If the requests are 'put more lua into TiC', I think the real question is, "Does TiC meet it's goals if it adopts "X" feature?"

In this case, and many of them, I'll be the stick in the mud for everyone and claim no on this idea. While it's enticing to think about 8 bit mouse, it simply isn't a thing and never was. Even systems from the old days that could support a mouse, many didn't since it wasn't a standard form of input. Arguing that it is a thing now makes no sense if the purpose of TiC is to provide the harsh limitations of options in order to foster specific kind of creativity.

If your creativity is being stifled by TiC's self-imposed limitations, again, there's plenty of other systems that do way more than TiC is intending that are all available right now. As someone who likes TiC's current direction, I gotta say a lot of the recent feature requests have been quite disappointing to this end and seem to want to just break TiC's fundamental challenges because they simply don't like them, rather than seeing them as a way to think about a problem differently, when the road you normally take is blocked off, what side streets can you use...

So if mouse support is not a thing, and you want to make an editor, you use a dpad and 2 buttons. NES' early library had quite a few games with level editors that didn't require a mouse. I personally believe this interface paradigm has yet to be fully explored and TiC seems like the perfect playground to do it.

In closing, TL:DR, I don't think this feature should be implemented due to lack of support of TiC's proposed goals of mimicking the limitations that used to be standard. So far, it's lifted A LOT Of limitations (You certainly couldn't push 200 sprites at 60fps or any kind of 3D worth a damn on many old computers, yet TiC can do it without even flinching....more than enough ceiling has been lifted off the old hardware caps, imo).

But I'm just one guy and not in charge of anything here, so all I can do is old-man rant.

And I did. Have a good day! :)

HomineLudens commented 7 years ago

There's also another point in having both mouse and keypad enable at same time. Due to TIC ability to run cross platform, it'll be quite complex to handle both touch coordinate and on screen buttons in android device/tablet and similar scenario. I feel quite comfortable with actual limitations (I can't see any :)

trelemar commented 7 years ago

@hseiken brings up alot of valid points. Switching input modes is probably not in the goals of what it's supposed to be. Slowly lifting the limitations in the end will stop tic from being tic. I don't know @nesbox's take on this but maybe we should just keep it the way it is. After all, if your making a gui for your game 6 buttons should suffice.

Crutiatix commented 7 years ago

I think that there have to be some limits for what to implement and what not. My opinion is that should be implemented that what can't be done in lua code (at all or would be very difficult) and at same time works with 8-bit values and represents them in 8-bit form. It is not about a software logic but about working with 8-bit datas and their representation. An disadvantage of old game consoles were low speed of computing and low memory. Now we have enough computing power and enough memory but we choosen to work with 8bit datas and their representation because of its beauty. Should be TIC to be just emulator of game consoles from the 8-bit era 40 years ago or should be inovative, creative and diferrent from others fantasy computers? I think that it is possible to make mini games in the style of 8-bit with features which were imposible or limited 40 years ago. TIC is a great development enviroment in which are/will be all needed features which simplify creating of games. In order to simplify development of games the TIC implements only what is needed for 8-bit work. And everything what can by represented by 8-bit could by part of this enviroment. What wrote @hseiken In case of swithing inputs or mentioned clip/trim function it's not about that it's not 8-bit, but that it was not at 40 years ago. We can be inovative and 8-bit at once.

trelemar commented 7 years ago

@Crutiatix I do see both sides to this. However ultimately it comes down to the vision of @nesbox.

I don't see how adding all these features makes TIC innovative though. Allowing mouse and gamepad input is by no means innovative by today's standards. Actually it's quite ordinary. The innovation started with the entire concept of a fantasy console, and credit is due to pico-8. Pico-8's limitations and specs make it so popular because it was the first of it's kind. It doesn't try to do anything fancy, and it doesn't have to. It really push the limits onto the developer and not the engine. I think TIC should strive for the same goals. Give the developer the tools required to do what they want within the original limitations of the console. I've said something similar in the past in the Discord chat. The possibilities with you can make in TIC already are limitless. It's all up to you on how you approach things.

Crutiatix commented 7 years ago

@trelemar You are right about why is Pico-8 popular. And because of this TIC can't became popular if just goes in its steps to same goal. Maybe @nesbox not even want popular game and he works on it mainly because of fun and self-development. I have absolutely nothing against it just present my opinion. Happy developer =a long-lasting productive project. :) If TIC wants to be inovative so it should have someting different and unique and thats would be features which allow to create such 8-bit games which will be imposible to create in Pico-8 or old consoles because of its limits but still with deep feel of 8-bit style. Someone in a Issues suggested online/network/bluetooth multiplayer. This is something what is unthinkable for 8-bit era game consoles but it could brings incredible feel into 8-bit gamming. And I think that this could brings to sunshine of popularity. @trelemar Like you wrote, a lot of features are common today, but only if you put it into 8-bit style game so it becomes inovative, because nobody or only a few people did it. Creativity and inovativity isn't only about creating an entirelly new things which nobody know, but also about taking common things and use it by uncommon new way. I am for simplicity of TIC and its API but not for restriction of features which do not break up 8-bit idea, can't be made in lua code and are really useful but are only uncommon in 40 years old games and consoles or others fantasy computers. PS: TIC has a long way ahead, and will be made a lot of decisions else which will make Nesbox. I just want give him another point of view how looks on these things. :)

AnastasiaDunbar commented 7 years ago

@Effer That's why just switching is better than having both gamepad and mouse simultaneously. @hseiken It's not a big of a deal, it's not like we are going to request for 24-bit colors, changing screen size, OpenGL shaders, networking, audio buffer or webcam support and etc. into TIC. It just would be much easier if the switch feature was actually implemented.

Here's a demonstration as an example ```lua -- title: paint example -- script: lua -- input: gamepad gamepad=true --Set this to true if the input is set to gamepad, otherwise false. width=240;height=136 tile={size=8,map={}} tile.width=math.floor(width/tile.size);tile.height=math.floor(height/tile.size) for y=1,tile.height do tile.map[y]={} for x=1,tile.width do tile.map[y][x]=false end end cursor={x=1,y=1} if(not gamepad)then previousHold=false hold=false end function int(bool)return bool and 1 or 0 end function clamp(x,min,max)return math.min(math.max(x,min),max)end function TIC() if(gamepad)then cursor.x=clamp(cursor.x+(int(btnp(3,20,btn(5) and 2 or 4))-int(btnp(2,20,btn(5) and 2 or 4))),1,tile.width) cursor.y=clamp(cursor.y+(int(btnp(1,20,btn(5) and 2 or 4))-int(btnp(0,20,btn(5) and 2 or 4))),1,tile.height) if(btnp(4))then tile.map[cursor.y][cursor.x]=not tile.map[cursor.y][cursor.x] end else previousHold=hold mouseX,mouseY,hold=mouse() cursor.x=clamp(math.floor((mouseX/tile.size)+1),1,tile.width) cursor.y=clamp(math.floor((mouseY/tile.size)+1),1,tile.height) if(hold==true and previousHold==false)then tile.map[cursor.y][cursor.x]=not tile.map[cursor.y][cursor.x] end end cls() for y=1,tile.height do for x=1,tile.width do rect((x-1)*tile.size,(y-1)*tile.size,tile.size,tile.size,tile.map[y][x]and 2 or 13) end end rectb(((cursor.x-1)*tile.size)+1,((cursor.y-1)*tile.size)+1,tile.size-2,tile.size-2,0) rectb(((cursor.x-1)*tile.size),((cursor.y-1)*tile.size),tile.size,tile.size,15) end ``` Which one feels better to use? The gamepad or the mouse to move the cursor? Gamepad is good for repetitive tasks like patterns but slower to move around the plane, mouse is better for drawing but uncomfortable for repetitive tasks. Also the mouse is easier to use for an interface rather than the gamepad which can be confusing.
trelemar commented 7 years ago

So what's everyone's feel on this? Should this issue be closed?

trelemar commented 7 years ago

10 days passed and no discussion on this. I think it should be closed for now. keep input as is for now.