Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Announcements and Showcase
MMOCube - POC 1 is deployed to the test server and available for public test

SamGrady
Guest
Quote
2024-03-28 19:55:55

I mean, I once thought about creating software like we did with the gamepad tool, so CopperCube wouldn't need to do anything except reading storage files with a bunch of variables. But then I realized that I didn't have the money to host a server...
🔎︎



okeoke
Registered User
Quote
2024-03-28 20:53:11

I'm using server approach right now.
It does request to the server with text, and you receive image back. You can try it yourself:
http://193.124.65.10:3000/getName/Your_text.png.
But it's a huge performance issue, if you have more than 2 or 3 players online. The whole thing runs in one thread, even though it is async, and you have a huge spike for everyone online if someone connects and tries to get all names at the same time.
So my current plan is to disable that endpoint and distribute local exe. I'm basically using the same libraries but it's build to exe using node-pack. That's why it has size of 30 mb. Probably, something like that could be done using C or FreeBasic or even lua and be 300 kb size, but I don't really have patience to figure it out.


okeoke
Registered User
Quote
2024-03-28 21:02:33

On client side I simply get the texture file using curl and save it to the local drive. It appears it's not possible to download an image file using ccbDoHttpRequest.
var encodedName = encodeURI(player.name);
var url = 'http://' + host + ':3000/getName/' + encodedName;
var curlCmd = 'curl ' + url + ' > names_cache/' + encodedName + '.png';
system(curlCmd, true);
applyNameTexture(encodedName, billboardCopy);
After that I simply check if the texture is loaded and if it is apply it:
function applyNameTexture(encodedName, billboardCopy) {
var filePath = 'names_cache/' + encodedName + '.png';
if (ccbFileExist(filePath) && ccbReadFileContent(filePath).length > 0) {
var t = ccbLoadTexture(filePath);
// @ts-ignore
ccbSetSceneNodeMaterialProperty(billboardCopy, 0, "Texture1", t);
}
else {
doLater(applyNameTexture, 100, [encodedName, billboardCopy]);
}
}



SamGrady
Guest
Quote
2024-03-28 21:10:28

I've used something like that:
🔎︎

As I said, it has a problem because of screen resolution, and to capture a screenshot I need to display this overlay with text for half a second.


okeoke
Registered User
Quote
2024-03-29 11:23:32

Nice, this is a creative way to do that.
I also tried to generate bmp programmatically like it's done here:https://github.com/ericandrewlew...
But I didn't manage to make it work in coppercube environment, event though it would be the best approach of all.


SamGrady
Guest
Quote
2024-03-29 12:06:39

Man, you know I don't understand all this coding stuff. I looked at the index.js and figured out that it's better to use a plain mesh and a sprite sheet with rotating faces to the camera, rather than using something that complex.


just_in_case
Moderator
Quote
2024-03-29 15:19:44

For the font you can definately use a sprite sheet and planemesh to create the text, just create a bitmap font in the form of sprite and then you can use frame number as index for the fonts, for example frame 1 is going to be uppercase A or something like that just map them and use them.

Or use something like this, If you checkout this github repo of mine, it uses bitmap fonts to create text for the menu and other stuff but it uses ccbDrawRectangleWithAlpha() command, but you can easily use planemesh instead of the rectangle.
https://github.com/vazahat/Coppe...

The same method was also used in the Duzakh game to create text elements by @samMhmdy.
So you can try that if you want, just pack the spritesheet along with the client exe so that it won't download the images from the internet.


okeoke
Registered User
Quote
2024-03-29 17:26:24

Thank you for sharing this. All the text related coding is a pain for the desktop. I still need to figure out scrollable text for the chat. Currently, I only have an idea on how to scroll message by message, but not by lines. It would be so much easier to just use html + css:)


okeoke
Registered User
Quote
2024-03-30 19:20:16

Since I'm not able to do a coding video at the moment, I decided to make a town test location using free assets from the Internet https://youtu.be/c-Q8N18uK8o.

Please note: This is all made from free assets from the web, I didn't make any of them.

Music:
https://opengameart.org/content/calming-rpg-town-theme

FPS Creator Fantasy Cartoon pack:
https://github.com/TheGameCreators/FPS-Creator-Classic

RPG item collections by drummyfish:
https://opengameart.org/content/rpg-item-collection-1
https://opengameart.org/content/rpg-item-collection-2
https://opengameart.org/content/rpg-item-collection-3

Cartoon knight by Lucian Pavel:
https://opengameart.org/content/cartoon-medieval-knight

Medieval Furniture by AnyRPG:
https://opengameart.org/content/medieval-furniture-0


just_in_case
Moderator
Quote
2024-03-31 09:06:15

@okeoke, you can try storing the messages as an object in a text file, in a format like this.
{username: "justin", message: "Hello, world!", timestamp: "11:04"};


and then you can load the objects from the text file as a javascript Array of objects where each line from the text will be an element for the array.

and in order to prevent array overflowing and memory issues, you can limit adding the amount of lines to the array, that is limit the amount of messages the user can access at a time, for example only last 100 messages can be shown or last 20 messages can be shown.

and upon scrolling you can add or remove the element from the array.

I might not be able to explain it properly but I think it will be easier if you just create 2 arrays.

One is global array that holds all the messages, and another one a temporary array whose elements are fixed in number that is the amount of messages that is going to be show on the screen at a time.

Let say we want the user to have access to 100 messages, so we fill the global array with all the 100 messages but in our game the user will be able to see only 10 messages at a time and upon scrolling he can read previous or next message.
so we create another temporary array that holds 10 elements only, and initially when the game starts we fill that temporary array with last 10 elements from the global array, and upon scrolling we can increase or decrease the index, and then based on the index fill the temporary array with the element data from the global array.

it is much better to create individual overlay holding each message for example if you are willing to create showing 10 message cards at a time that is 10 messages then simply create 12 overlay, 2 of them will remain hidden if you are willing to animate the scroll effect. if you don't want to animate the scroll effect then you can simply update the messages and username on 10 overlay cards and no need to create 12.

If you want you can stick with single overlay with multiline function and then you have to do extra coding, but it is easier to animate individual 2D overlays, all you need is lerping between position when scrolling and unhiding and hiding the hidden overlays.

I am not sure if you are able to understand a bit of what I am saying and it might be more confusing rather than more helping but maybe in future I will create a template for scrollable chat messages.


okeoke
Registered User
Quote
2024-03-31 09:13:26

[quote]it is much better to create individual overlay holding each message for example if you are willing to create showing 10 message cards at a time that is 10 messages then simply create 12 overlay[/quite].

Yes, that's an awesome idea! Thank you. I wonder, if it would be possible to actually make a smooth scrolling using that approach.


just_in_case
Moderator
Quote
2024-03-31 09:16:59

It is possible, actually, I am going to release some extension today that I created and they use overlays and animations as well, so it is possible to use smooth scrolling by lerping between overlay positions. Those extensions will definitely help people who find it difficult to work with overlay scaling, and centering and animating.


okeoke
Registered User
Quote
2024-04-30 08:11:52

If you wonder, I'm still working on this.

And POC5 is just deployed to the potato server!

New features:
* Enemies now attack back, and can actually kill you
* GUI was reworked to be not so ugly. HP bar and scrollable chat are added
* Biggest of them all: it's now possible to transition between scenes. Currently only 2 are available: "test" and "town".

Currently scene transition is only working in a "test" mode. You need to send a chat message with either "?test" or "?town" to switch to the corresponding scene.

🔎︎



okeoke
Registered User
Quote
2024-05-02 22:05:48

Updated download link:
https://drive.google.com/file/d/...


o139
Registered User
Quote
2024-05-03 08:40:30

nice!

so i have to type ?town to enter town?

i can not seem to be able to type ? in the textbox

i still have the problem with game windows size it is to large for my screen resolution im on linux so the .bat file do not work maybe add a fullscreen key


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "?nternational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact